Skip to main content

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:

ArgumentDescriptionExample input
nameThe name of the Lottery and ticket NFTWarpWatch PowerBALD
symbolThe symbol of the ticket NFTWWPB
pickLengthHow many numbers should be picked in a ticket5
maxBallValueThe maximum number that can be picked in a ticket (inclusive)18 (range: 1 to 18)
gamePeriodThe length of a round in seconds. Minimum is 600 seconds86400 (24h)
ticketPriceThe price of a ticket in the prize tokens decimal format99000000000000000000 (99 DEGEN)
communityFeeBpsPercentage 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%)
prizeTokenThe address of the ERC-20 token used as the lottery’s prize as well as the purchase currency.0xeb54dacb4c2ccb64f8074eceea33b5ebb38e5387 (WDEGEN)
seedJackpotDelayDelay after jackpot seed after which it can be topped up again. Cannot be zero.3600 (1 hour)
seedJackpotMinValueThe 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.