Raffle Mechanics
Configuration and parameters for raffles.
Raffle Overview
Each raffle is initialized with a configurable number of tickets. Users can buy any number of tickets, with no limit, until all tickets are sold out. The numbers for tickets to be purchased are randomly generated, or can be selected manually by the user from available remaining tickets (rather than being issued sequentially by the contract).
At the end of the raffle, a specified number of tickets are drawn in order (first, second, third place, etc).
If a user holds a ticket with the same number as one drawn for a prize, they win the prize allocated to that place. If a winning ticket number has not been bought by any user, the ticket is not redrawn and the prize for that place instead goes to the treasury.
There are two types of prize for every raffle:
A percentage of the "pot", or the total value of all tickets purchased for the raffle.
An NFT (optional).
First place wins a percentage of the pot and the NFT, if applicable, while the remaining places win only percentages of the pot.
Because a percentage of the entry fees for each raffle can be burned, gem distribution can be net deflationary for the platform, and is never inflationary.
Raffle Configuration
The following variables can be configured for each raffle:
The currency used to purchase tickets. The default currency is RUBY.
The price of each ticket in the purchase currency.
The address and id of the NFT to award for first prize. This can be disabled (i.e. there is no NFT prize) by setting it to zero.
The percentage of the pot that will go to each prize place (maximum ten prizes).
The percentage of the pot to be burned.
The percentage of the pot that will go to the treasury, or another specified address. This address also receives any prizes for which a ticket has not been purchased.
The total number of tickets to be generated.
The duration of the raffle in seconds. The raffle will end after this time, regardless of whether all tickets have been sold.
Example Raffle
A raffle is initialized with:
1,000 tickets
Tickets are priced in RUBY tokens
The purchase price for a ticket is 1 [RUBY]
A gemstone NFT is specified for the prize
Four prizes are specified for first, second, third, and fourth places: 35%, 25%, 15%, and 10% of the pot respectively (total 85%)
5% of the pot is to be burned
10% of the pot goes to the treasury address
The raffle will last for 24 hours
The raffle begins and users purchase 780 tickets for a total of 780 RUBY. The raffle ends after 24 hours with the remaining tickets sold.
Four ticket numbers are drawn: 201, 438, 778, and 955.
Ticket 201 has been purchased and the holder receives the first prize of 35% of the pot, or 273 RUBY, and the NFT prize.
No one has purchased ticket 438, so the second prize (25% of the pot or 195 RUBY) goes to the treasury address.
Ticket 778 has been purchased and the holder receives the third prize of 15% of the pot, or 117 RUBY.
Ticket 955 has been purchased and the holder receives the fourth prize of 10% of the pot, or 78 RUBY.
5% of the pot, or 39 RUBY, is burned.
10% of the pot, or 78 RUBY, is sent to the treasury address, in addition to the 195 RUBY from second prize.
Any prize (including NFTs) can be claimed by the winner indefinitely. There is no deadline.
Last updated