Skip to content

Latest commit

 

History

History
47 lines (43 loc) · 2.26 KB

File metadata and controls

47 lines (43 loc) · 2.26 KB

Lottery Contract Checklist

General Features

  • Players can buy tickets with 7 numbers (1–49)
  • Each round lasts 5 minutes (ROUND_DURATION)
  • Round starts automatically when the first ticket is bought
  • Only owner can draw the winner after the round ends
  • Random numbers generated using Chainlink VRF
  • Winning numbers stored in winningNumbers[7]
  • Rewards calculated for players with 2+ matching numbers
  • Owner takes 10% fee from total pool
  • Players can claim rewards using claimReward()
  • Lottery automatically resets for the next round after rewards are calculated
  • Uses pull pattern (pendingRewards) to avoid high gas during distribution
  • Validates input numbers to ensure they are 1–49
  • Tracks rounds using roundStartTime and lotteryOpen
  • Keeps track of tickets array and pendingRewards mapping
  • Emits events for transparency:
    • TicketPurchased
    • RequestSent
    • WinningNumbersGenerated
    • RewardClaimed

New / Updated Features (Pending Testing)

  • Winning numbers are unique (no duplicates) ✅ pending
  • Winning numbers are sorted in ascending order ✅ pending
  • Rollover pool: leftover ETH after rewards stays in contract for the next round ✅ pending
  • Only current round tickets cleared; previous round rewards remain pending ✅ pending
  • Lottery automatically ready for next round without manual reset ✅ pending

Deployment & Usage Checklist

  • Deploy contract with Chainlink VRF subscription ID
  • Buy a ticket using buyTicket() (include 7 numbers and ENTRY_FEE)
  • Wait 5 minutes for the round to end
  • Owner calls drawWinner() to request VRF random numbers
  • Wait for Chainlink VRF callback (fulfillRandomWords())
  • Players call claimReward() to receive ETH if matched ≥2 numbers
  • New round starts automatically when first ticket is bought

Notes

  • ⚠️ Ensure MetaMask gas fees are sufficient for each transaction
  • ⚠️ Do not send ETH manually to the contract — always use buyTicket()
  • 🔍 Monitor events in Remix:
    • TicketPurchased
    • RequestSent
    • WinningNumbersGenerated
    • RewardClaimed