PoolTogether 3.0
HomeAppBuilder
v3.0.1
v3.0.1
  • ✨Introduction
  • 📡Networks
  • 💱Migrating from V2 to V3
  • 🚰Resources
  • Protocol
    • 🌐Overview
    • 🏆Prize Pools
      • ⚖️ Fairness
      • Compound Prize Pool
      • yVault Prize Pool
      • Token Listener
    • 💸Prize Strategies
      • 🤑Single Random Winner
        • 🎟️ Ticket
        • 🎁Sponsorship
    • 🧞Random Number Generator
      • Blockhash
      • Chainlink VRF
  • Tutorials
    • Getting Started
    • Deposit into a Prize Pool
    • Withdraw from a Prize Pool
    • Create a Prize Pool
    • Create a Prize Strategy
  • Governance
    • 🏛️ Overview
    • 💰Comptroller
  • Security
    • Risks
    • Audits & Testing
    • Bounties
Powered by GitBook
On this page

Was this helpful?

  1. Protocol
  2. Prize Strategies
  3. Single Random Winner

🎟️ Ticket

PreviousSingle Random WinnerNextSponsorship

Last updated 5 years ago

Was this helpful?

The Ticket contract is an -compatible token that allows users to be selected by a token index.

The contract organizes the balances into a sum tree data structure, so that each address holds a "range" of tokens. A number can be used as an index within that range, and the holder of the tokens in that range is selected:

function draw(uint256 randomNumber) public view returns (address)

The randomNumber will be used as a token index into a specialized data structure that stores the user balances. The randomNumber is constrained to the token supply and modulo bias is corrected.

The returned address is the user who holds the token index corresponding to the random number.

💸
🤑
ERC20