Comment on page

Fully Automatic System

Chainlink Automation is used as the solution to make lottery game can run endlessly.
Basically, Lottery Smart Contract is Keeper-compatible. -> Upkeep on BSC
“performUpkeep” function in Lottery Smart Contract is designed to:
  • Change state of a round: Start -> Active -> End
  • Round state is Start: proceed to transfer tokens from Auto Pool to Lottery Pool based on settings in Auto Pool of players.
  • Round state is End:
    • Recalculate tickets of players, reset Hold Tickets to zero if they do not hold enough token as recognized in the first deposit.
    • Call to Chainlink VRF to get randomness numbers
    • Find winners based on random numbers
    • Reward the prize winners
    • Initialize new round