- Procedures
- 3
- Functions
- 10
- Custom types
- 5
Procedures
BuyTicketinput 1
Attempts to buy tickets while SELLING state is active. Logic: - If locked: refund full invocationReward and return TICKET_SELLING_CLOSED. - If reward < price: refund full reward and return TICKET_INVALID_PRICE. - If no capacity left: refund full reward and return TICKET_ALL_SOLD_OUT. - Otherwise: add up to slotsLeft tickets; refund remainder and unfilled part.
Input0
None
Output1
- returnCodeuint8
SetPriceinput 2
Input1
- newPriceuint64
Output1
- returnCodeuint8
SetScheduleinput 3
Input1
- newScheduleuint8
Output1
- returnCodeuint8
Functions
GetFeesinput 1
Returns currently configured fee percentages.
Input0
None
Output5
- teamFeePercentuint8
- distributionFeePercentuint8
- winnerFeePercentuint8
- burnPercentuint8
- returnCodeuint8
GetPlayersinput 2
Retrieves the active players list for the ongoing epoch.
Input0
None
Output3
- playersid[1024]
- playerCounteruint64
- returnCodeuint8
GetWinnersinput 3
Returns historical winners (ring buffer segment).
Input0
None
Output3
- winnersstruct[1024]
- winnersCounteruint64
- returnCodeuint8
GetTicketPriceinput 4
Input0
None
Output1
- ticketPriceuint64
GetMaxNumberOfPlayersinput 5
Input0
None
Output1
- numberOfPlayersuint64
GetStateinput 6
Input0
None
Output1
- currentStateuint8
GetBalanceinput 7
Input0
None
Output1
- balanceuint64
GetNextEpochDatainput 8
Input0
None
Output1
- nextEpochDataNextEpochData
GetDrawHourinput 9
Input0
None
Output1
- drawHouruint8
GetScheduleinput 10
Input0
None
Output1
- scheduleuint8
Custom types
WinnerInfostruct · 48 B
Fields5
- winnerAddressid
- revenueuint64
- tickuint32
- epochuint16
- dayOfWeekuint8
NextEpochDatastruct · 16 B
Fields2
- newPriceuint64
- scheduleuint8
StateDatastruct · 80.1 KB
Fields18
- winnersstruct[1024]
- Circular buffer storing the history of winners. Maximum capacity is defined by RL_MAX_NUMBER_OF_WINNERS_IN_HISTORY.
- playersid[1024]
- Set of players participating in the current lottery epoch. Maximum capacity is defined by RL_MAX_NUMBER_OF_PLAYERS.
- teamAddressid
- Address of the team managing the lottery contract. Initialized to a zero address.
- ownerAddressid
- Address of the owner of the lottery contract. Initialized to a zero address.
- nexEpochDataNextEpochData
- Data structure for deferred changes to apply at the end of the epoch.
- ticketPriceuint64
- Price of a single lottery ticket. Value is in the smallest currency unit (e.g., cents).
- playerCounteruint64
- Number of players (tickets sold) in the current epoch.
- winnersCounteruint64
- Index pointing to the next empty slot in the winners array. Used for maintaining the circular buffer of winners.
- lastDrawDayuint8
- Date/time guard for draw operations. lastDrawDateStamp prevents more than one action per calendar day (UTC).
- lastDrawHouruint8
- lastDrawDateStampuint32
- teamFeePercentuint8
- Percentage of the revenue allocated to the team. Value is between 0 and 100.
- distributionFeePercentuint8
- Percentage of the revenue allocated for distribution. Value is between 0 and 100.
- winnerFeePercentuint8
- Percentage of the revenue allocated to the winner. Automatically calculated as the remainder after other fees.
- burnPercentuint8
- Percentage of the revenue to be burned. Value is between 0 and 100.
- scheduleuint8
- Schedule bitmask: bit 0 = WEDNESDAY, 1 = THURSDAY, ..., 6 = TUESDAY. If a bit is set, a draw may occur on that day (subject to drawHour and daily guard). Wednesday also follows the "Two-Wednesdays rule" (selling stays closed after Wednesday draw).
- drawHouruint8
- UTC hour [0..23] when a draw is allowed to run (daily time gate).
- currentStateEState
- Current state of the lottery contract. SELLING: tickets available; LOCKED: selling closed.
DrawEntropyDatastruct · 528 B
Fields4
- entropyuint64[64]
- playerCounteruint64
- tickuint32
- epochuint16
EState
enum · uint8
