How to Deploy a Lottery
To deploy a new lottery, anyone can call the create
function on the LooteryFactory
proxy contract.
create
function create(
string memory name,
string memory symbol,
uint8 pickLength,
uint8 maxBallValue,
uint256 gamePeriod,
uint256 ticketPrice,
uint256 communityFeeBps,
address prizeToken,
uint256 seedJackpotDelay,
uint256 seedJackpotMinValue
) external returns (address);
Parameters:
Argument | Description | Example input |
---|---|---|
name | The name of the Lottery and ticket NFT | WarpWatch PowerBALD |
symbol | The symbol of the ticket NFT | WWPB |
pickLength | How many numbers should be picked in a ticket | 5 |
maxBallValue | The maximum number that can be picked in a ticket (inclusive) | 18 (range: 1 to 18) |
gamePeriod | The length of a round in seconds. Minimum is 600 seconds | 86400 (24h) |
ticketPrice | The price of a ticket in the prize tokens decimal format | 99000000000000000000 (99 DEGEN) |
communityFeeBps | Percentage of ticket price that goes to the community, in basis points (5000 = 50%). The maximum is 9500 (95%), as 5% is reserved for the protocol fee. | 5000 (50%) |
prizeToken | The address of the ERC-20 token used as the lottery’s prize as well as the purchase currency. | 0xeb54dacb4c2ccb64f8074eceea33b5ebb38e5387 (WDEGEN) |
seedJackpotDelay | Delay after jackpot seed after which it can be topped up again. Cannot be zero. | 3600 (1 hour) |
seedJackpotMinValue | The minimum amount that must be supplied when calling seedJackpot. | 99000000000000000000 (99 DEGEN) |
In the resulting LooteryLaunched
event, we can find the newly deployed lottery address emitted in the argument looteryProxy
. The caller of the create
function is the owner of the new lottery.
Example deployment transaction.
Additional notes:
-
maxBallValue: Bear in mind that the number must be higher than
pickLength
, and that 0 is not a valid ball value. -
gamePeriod: The minimum game period of 600 seconds is 10 minutes.
-
seedJackpotDelay: This cannot be zero.
-
seedJackpotMinValue: This mitigates denial-of-service attacks, so set it to an appropriate amount but as high as possible. Cannot be zero.