Skip to main content

Module event

Module event 

Source
Expand description

On-chain events (sol_log_data via Steel event! / .log()).

§Indexer contract

The off-chain indexer must subscribe to these events to reconstruct daily and weekly leaderboard state. Accounts alone are insufficient for daily rank snapshots because the on-chain Ledger only maintains rolling weekly aggregates, not per-day history.

§Daily leaderboard reconstruction

For each UTC day the indexer:

  1. Groups WinRecorded events by (player, UTC_day(period)) → daily wins + daily best streak.
  2. Groups BetRecorded events by (player, UTC_day(period)) → daily bet count.
  3. Excludes periods matching any MarketVoided event from accuracy calculations.
  4. Uses StreakBroken events to confirm streak resets (optional — can also derive from missing consecutive WinRecorded run).
  5. At UTC midnight, snapshots rank order for each player → feeds into weekly scoring.

The period field maps to a UTC day via the Market::open_ts / Market::close_ts stored on the Market PDA (288 periods per day for 5-minute rounds).

§Weekly score inputs (all on-chain, readable from events or Ledger state)

ComponentWeightSource
Best streak of the week50%WinRecorded.win_streak peak per week
Daily leaderboard placement30%Off-chain daily rank snapshots
Total correct calls10%WinRecorded.total_wins at week end
Accuracy rate10%total_wins / total_bets (min ~50 bets enforced off-chain)

Structs§

BetRecorded
Emitted by PlaceBet when tickets are actually debited (both commit and live windows).
Initialized
Emitted after successful Initialize.
MarketVoided
Emitted by AdminVoidMarket when a market is voided.
StreakBroken
Emitted by PlaceBet when a player’s streak is broken (previous period settled as a loss).
VoidRefunded
Emitted by AdminRefundVoidPosition for each refunded position.
WinRecorded
Emitted by ExecutorTreasury DISTRIBUTE when a win is confirmed for a player.