JackpotBridgeManager

Enables cross-chain ticket purchases and winnings claims using EIP-712 signatures. Acts as custodian for tickets purchased from other chains.

Important: Ticket recipient addresses must be EOAs (Externally Owned Accounts), not smart contract addresses. Using a smart contract address as a recipient may result in lost tickets or winnings.

State Variables

Variable
Type
Description

jackpot

IJackpot

Immutable reference to Jackpot contract

jackpotTicketNFT

IJackpotTicketNFT

Immutable reference to ticket NFT contract

usdc

IERC20

Immutable USDC token reference

relayDepository

IRelayDepository

Bridge depository for cross-chain transfers

ticketOwner

mapping(uint256 => address)

Ticket ID → owner address

userTickets

mapping(address => mapping(uint256 => Set))

User → drawing → ticket IDs

Structs

ClaimWinningsData

struct ClaimWinningsData {
    uint256[] ticketIds;       // Tickets to claim
    RelayTxData bridgeDetails; // Bridge transaction info
}

RelayTxData

Constants

Events

TicketsBought

WinningsClaimed

FundsBridged

Functions

buyTickets

Purchase tickets on behalf of a cross-chain user.

Important: The _recipient address must be an EOA (Externally Owned Account), not a smart contract address. Using a smart contract address may result in lost tickets or winnings.

Parameters:

Name
Type
Description

_tickets

Ticket[]

Array of tickets to purchase

_recipient

address

Address that owns the tickets (on origin chain)

_referrers

address[]

Referrer addresses for fee sharing

_referralSplitBps

uint256[]

PRECISE_UNIT-scaled weights

_source

bytes32

Source identifier for tracking

Returns:

Type
Description

uint256[]

Array of minted ticket IDs

Example:


claimWinnings

Claim winnings and bridge funds to destination chain via signature.

Parameters:

Name
Type
Description

_userTicketIds

uint256[]

Ticket IDs to claim

_bridgeDetails

RelayTxData

Bridge transaction details

_signature

bytes

EIP-712 signature from ticket owner

Requirements:

  • At least one ticket ID must be provided

  • Signature must be valid and from ticket owner

  • Tickets must have claimable winnings

  • Bridge amount must match claimed amount

Example:


claimTickets

Transfer ticket NFTs to local chain custody via signature.

Parameters:

Name
Type
Description

_ticketIds

uint256[]

Ticket IDs to transfer

_recipient

address

Address to receive the NFTs

_signature

bytes

EIP-712 signature from ticket owner

Requirements:

  • Recipient must not be zero address

  • Recipient must not be the bridge manager

  • Signature must be valid and from ticket owner

Example:


getUserTickets

Get all ticket IDs owned by a user for a specific drawing.

Parameters:

Name
Type
Description

_user

address

Address of the ticket owner

_drawingId

uint256

Drawing to query

Returns:

Type
Description

uint256[]

Array of ticket IDs


createClaimWinningsEIP712Hash

Create EIP-712 hash for claiming winnings.


createClaimTicketEIP712Hash

Create EIP-712 hash for claiming tickets.

Cross-Chain Flow

Buying Tickets from Another Chain

  1. User initiates purchase on origin chain

  2. Relayer receives message and calls buyTickets on Base

  3. Bridge manager holds NFTs as custodian

  4. Ownership tracked via ticketOwner mapping

Claiming Winnings Cross-Chain

  1. Drawing completes on Base

  2. User creates EIP-712 signed message on origin chain

  3. Relayer calls claimWinnings with signature

  4. Winnings are bridged back via Relay depository

Moving Tickets to Local Custody

  1. User signs ticket claim message

  2. Relayer executes claimTickets

  3. NFTs transferred from bridge manager to recipient

  4. User can now interact directly with tickets

Last updated