Docs/Examples/Gladiator Oracle

GladiatorOracle (Bout Prediction Market)

Cross-contract prediction market — commit your pick, reveal it, win if GladiatorArena agrees.


Overview

GladiatorOracle is a commit-reveal prediction market layered on top of GladiatorArena. Players predict which gladiator will win the next autonomous bout, commit their pick secretly, reveal it before the bout resolves, and split the pot if they called it right.

PropertyValue
Base contractAutoLoopCompatible (no VRF — randomness comes from GladiatorArena)
VRF usageNone — reads boutWinners from GladiatorArena
Gas per tick~80k (settlement)
Sourceautoloop/src/games/GladiatorOracle.sol
Tests40 passing (unit + fuzz)

Why AutoLoop Is Structurally Required

Three independent reasons:

  1. Commit-reveal integrity: reveal must happen strictly before settlement. A player-controlled trigger could fire mid-reveal-phase after seeing opponents' choices.
  2. Adversarial multi-party: bettors on popular gladiators want delayed settlement; minority bettors want it fast. No player-controlled trigger is neutral.
  3. Cross-contract coordination: settlement requires both the reveal window to be over and the target bout to have resolved in GladiatorArena. A player could trigger settlement the instant the bout resolves, before all reveals are in. AutoLoop's cadence guarantees the full reveal window completes first.

Game Mechanics

  • Rounds: each round targets a specific GladiatorArena bout by boutId.
  • Commit: players submit keccak256(abi.encode(gladiatorId, salt, sender)) along with a minimum stake.
  • Reveal: players prove their commit by submitting the gladiatorId + salt. Contract verifies the hash.
  • Settlement: AutoLoop fires when revealEndAt has passed and gladiatorArena.boutWinners(targetBoutId) != 0. The winning gladiator is read directly from GladiatorArena — no additional VRF needed.
  • Payout: correct predictors split the pot proportionally to their stake.
  • Forfeiture: unrevealed commits and wrong predictions forfeit stakes to the pot or protocol.

Cross-Contract Architecture

GladiatorArena ──boutWinners(boutId)──→ GladiatorOracle.progressLoop()
      ↑                                          ↑
  AutoLoop tick                           AutoLoop tick
  (resolves bout)                    (settles predictions)

Both contracts are independently registered with AutoLoop. The oracle's shouldProgressLoop() checks two conditions:

loopIsReady =
    block.timestamp >= r.revealEndAt &&
    !r.settled &&
    gladiatorArena.boutWinners(r.targetBoutId) != 0;

Revenue Model

  • 5% rake on every round pot
  • Forfeited stakes (unrevealed commits) go to the winners' pool
  • Rounds with no correct predictors send full pot to protocol
  • AutoLoop gas fees on each settlement tick

Deploy

# Deploy GladiatorArena first
ARENA_ADDR=<deployed GladiatorArena address>

forge create src/games/GladiatorOracle.sol:GladiatorOracle \
  --constructor-args $ARENA_ADDR 120 120 1000000000000000 500 \
  --rpc-url $RPC_URL --private-key $PRIVATE_KEY --broadcast

Args: gladiatorArena, commitDuration, revealDuration, minStake, protocolRakeBps.

Dashboard

Play GladiatorOracle on the AutoLoop Dashboard.