PoolTogether 3.0
HomeAppBuilder
v3.2.0
v3.2.0
  • ✨Introduction
  • 📡Networks
  • 🚰Resources
  • Protocol
    • 🌐Overview
    • 🏆Prize Pools
      • âš–ī¸ Fairness
      • Compound Prize Pool
      • Stake Prize Pool
      • Custom Yield Sources
    • 💸Prize Strategies
      • Yield Sources
      • 🤑Multiple Winners
    • đŸŽŸī¸ Tokens
      • đŸŽŸī¸ Ticket
      • 🎁Sponsorship
      • 👂Token Listener
    • 🎲Random Number Generator
      • Blockhash
      • Chainlink VRF
    • đŸ´â€â˜ ī¸ Loot Box
    • â›ŊGas Usage
  • Governance
    • đŸ›ī¸ Overview
    • đŸ•šī¸ Controls
    • đŸ—ŗī¸ Process
  • Security
    • Risks
    • Audits & Testing
    • Bounties
Powered by GitBook
On this page

Was this helpful?

  1. Protocol
  2. đŸŽŸī¸ Tokens

đŸŽŸī¸ Ticket

PreviousđŸŽŸī¸ TokensNextSponsorship

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