JackpotTicketNFT

ERC-721 contract that mints NFTs representing lottery tickets. Each ticket NFT contains the selected numbers and drawing information.

State Variables

Variable
Type
Description

jackpot

IJackpot

Immutable reference to the Jackpot contract

ticketArt

ITicketArt

Contract for generating ticket NFT art

contractURI

string

Contract-level metadata URI

userTickets

mapping

Tracks tickets per user per drawing

tickets

mapping(uint256 => TrackedTicket)

Ticket data by token ID

Structs

TrackedTicket

struct TrackedTicket {
    uint256 drawingId;       // Drawing this ticket is for
    uint256 packedTicket;    // Packed normal numbers and bonusball
    bytes32 referralScheme;  // Hash of referral scheme applied
}

ExtendedTrackedTicket

struct ExtendedTrackedTicket {
    uint256 ticketId;        // NFT token ID
    TrackedTicket ticket;    // Core ticket data
    uint8[] normals;         // Unpacked normal numbers
    uint8 bonusball;         // Unpacked bonusball
}

UserTickets (internal)

Events

Transfer (ERC-721)

Approval (ERC-721)

Functions

getUserTickets

Get all tickets owned by a user for a specific drawing.

Parameters:

Name
Type
Description

user

address

Address of the ticket owner

drawingId

uint256

Drawing ID to query tickets for

Returns:

Type
Description

ExtendedTrackedTicket[]

Array of extended ticket info including unpacked numbers

Example:


getTicketInfo

Get basic ticket information by token ID.

Parameters:

Name
Type
Description

ticketId

uint256

NFT token ID

Returns:

Type
Description

TrackedTicket

Ticket data with drawing ID, packed ticket, and referral scheme

Example:


getExtendedTicketInfo

Get full ticket information with unpacked numbers.

Parameters:

Name
Type
Description

ticketId

uint256

NFT token ID

Returns:

Type
Description

ExtendedTrackedTicket

Complete ticket info including unpacked numbers

Example:


tokenURI

Get the metadata URI for a ticket NFT.

Parameters:

Name
Type
Description

tokenId

uint256

NFT token ID

Returns:

Type
Description

string

Base64-encoded JSON metadata URI with ticket art


ownerOf (ERC-721)

Get the owner of a ticket NFT.


balanceOf (ERC-721)

Get total NFT balance for an address.


transferFrom (ERC-721)

Transfer a ticket NFT to another address.

Example:


approve (ERC-721)

Approve another address to transfer a specific ticket.


setApprovalForAll (ERC-721)

Approve/revoke an operator for all tickets.

Last updated