Skip to main content
Version: V4

Computing Prizes

This section outlines how the prizes are computed for each draw. The high-level steps of this process are:

  • Get the Draw & Prize Distribution from the DrawBuffer and PrizeDistributionBuffer contracts respectively
  • Compute the user's TWAB for the draw given the draw start timestamp, beacon period & offsets
  • Get the total ticket supply TWAB
  • Compute the number of picks a user gets (this is the user's fraction of TWAB vs. total supply TWAB multipled by the number of picks for the draw)
  • For each pick, compute the users random number and compare it to winning random number
Prize Pool

Offchain Prize Calculation

Since the user may have hundreds or thousands of picks, this calculation can also be replicated off-chain. The high-level steps of this process are:

These steps are combined in the Draw Calculator CLI and executed in the v4-draw-results repo workflow to create the prize data.

Prize API

All prize data is made readily available at the Prize API.