verifiable random

Fairness

No black box. Every winner is derivable from public on-chain state — anyone can re-check.

Randomness
blockhash + prevrandao

Winner seed = keccak256(blockhash, prevrandao, snapshotRoot, drawId, totalWeight). Computed synchronously inside closeDraw().

Snapshot
Pinned to closing block

Token balances are read at the exact block the draw closes — no after-the-fact ticket inflation.

Merkle proof
On-chain verifyWinner()

Any user can call Raffle.verifyWinner(drawId, holder, weight, cumStart, proof) and get true/false back.

How a draw works, step by step
  1. 01
    Draw opens
    openNextDraw() creates a new draw on-chain. Between draws, the fee sweep worker converts trading tax into stock tokens accumulating in the treasury.
  2. 02
    Window closes
    After 30 minutes the backend pushes setSnapshot(root, totalWeight) — the eligible holder Merkle root — then calls closeDraw() which computes the winner seed in the same tx.
  3. 03
    Winner is derivable
    The seed % totalWeight falls inside a single holder's [cumStart, cumStart+weight) range. Anyone can identify the winner off-chain by walking the Merkle tree.
  4. 04
    Backend airdrops
    The backend transfers 100% of every stock token in the treasury to the winner (one tx per ticker). No signature needed from the winner — the tokens just show up.
  5. 05
    Draw finalized
    finalize(drawId, winner) is called on the raffle contract, transitioning state to Paid and emitting PrizePaid. This is what makes the win appear on the History page.
Verify a draw yourself

Any draw on the History page exposes the on-chain tx hashes you can inspect:

  • closeDrawTxTx that closed the draw + computed the winner seed. Contains the seed value and the snapshot root.
  • finalizeTxBackend records the winner address after airdropping. Emits PrizePaid with the winner.
  • airdropTxsOne ERC-20 transfer tx per stock ticker (SPCX, TSLA, NVDA, AAPL) from the treasury to the winner.
Always excluded from draws

These addresses can hold the token but never win:

  • · LP / DEX pair
  • · Burn address (0x…dEaD)
  • · Protocol treasury / tax recipient
Open source

Raffle contract is open source. Read it, fork it, build on it.