Secret Lottery: Update

Hey!

After some previous experimentation with Lucky Number, a very simple lottery type of game, we quickly realized that it had very poor incentive mechanics and some ways to exploit the game in itself.

So, I’ve been working on an updated and more economically viable lottery type game more in line with the popular Pancake Swap Lottery (PancakeSwap).

In summary, this is a lottery where users buy tickets that have a sequence of 6 digits. If the digits on those tickets match the winning digits in the correct order of the drafted ticket, users win a portion of the prize pool allocated to that specific sequence. A lottery round is approximately 12 hours from start to finish.

The main functionality is described below:

  • Buy Tickets: Users buy N Tickets with a sequence of 6 digits
    • Users can choose digits manually or the frontend randomly selects the digits of the tickets
    • Tickets are not refundable, once bought they cannot be given back
    • There is a bulk discount applied automatically to the ticket price incase multiple tickets are bought at the same time
    • Frontend limits the number of tickets per transaction with 500 (mainly due to gas cost limitations), but user can have as many tickets as they want on a specific round (user can buy 500 tickets then another 500 tickets…)
  • Staking: Prize Pot accumulates and is directly staked on the SEFI stake contract
    • When users buy tickets, the contract receive their tokens and deposit them on the staking contract
  • Round Triggers: Lottery Rounds are approximately 12 hours from start to finish (these can only be called by a specific address)
    • Trigger Close Round
      • Draft Winning Ticket Digits
      • Unstake all the prize pool
        • Redeem from the staking contract
        • Rewards are collected automatically too
    • Trigger End and Start Round
      • Allocate tokens to reward pot
      • Allocate tokens to burn + burn tokens
      • Allocate tokens to triggerer + transfer tokens to triggerer
      • Allocate Jackpot Tokens to new round + Deposit them on the staking SEFI contract
      • Start new round
  • Claim Rewards: Users can claim rewards for their winning ticket
    • Users can claim each ticket individual or multiple tickets on the same transaction
    • Claim tokens come from the reward pot of that specific round

Here are the main functions and respective flows that the contract executes:

image

image

image

Currently there is a holodeck-2 testnet version here: https://thatrand0muser.github.io/
Preview:


This is just a staging version so we can already mess around with the lottery and test all of its functionality. For a mainnet version of the frontend it will be more inline with the secret network design patterns.

Contract: GitHub - ThatRand0mUser/secret-lottery

Would really love some feedback on this!

2 Likes

Would you be able to shed a bit more light just for my understanding?

In this model, is staking SEFI done purely to accumulate a bit of additional prize pot or is there any other reason?

Yes the staking of SEFI is just to get the pot size larger. So more rewards = More incentives to buy tickets

The probability of getting the ticket that wins the largest pot size is 1 in a million, so every round that there is no ticket that wins the largest pot size, those tokens go to the pot of next round and will accumulate even more.

So in any given round, there is a chance that nobody wins the lottery?

However, any winner will win the entire pot in existence and all winnings are only from bets and staking (no house / external party in existence)?

Yes. This is modelled very closely to what PancakeSwap Lottery is doing.

The pot distribution at the end of every round is as follows:

  • Match only the first digit of the drafted ticket: 2% of the total pot size
  • Match the first 2 digits of the drafted ticket: 4% of the total pot size
  • Match the first 3 digits of the drafted ticket: 6% of the total pot size
  • Match the first 4 digits of the drafted ticket: 12% of the total pot size
  • Match the first 5 digits of the drafted ticket: 20% of the total pot size
  • Match all digits of the drafted ticket: 40% of the total pot size
  • Burn 15 % of the total pot size
    • If there are winning ticket/s with “Match all digits”, instead of the burn these 15% will be allocated to the next round so users can have so incentives to buy tickets from start of the round
  • Triggerer gets 1% of the total pot size to pay for gas costs and infrastructure to do the trigger

All these percentages will still be revised and will probably change as this is only the example that is deployed to the testnet.

And yes, all winnings come from bets (tickets bought by users) and the staking.
The only thing that you can call a “house/external party” is the Triggerer that is responsible to end and start new rounds. As this have some costs with gas fees and the infrastructure to be possible to call these functions automatically, we need to get a small share of the pot size to cover those costs.

1 Like