Skip to main content
The Binary Prediction example lets a user stake SPL tokens on an up/down price move. It reads a MagicBlock pricing-oracle feed on the ER, snapshots the entry price, and settles after the bet expires.
This is an integration example, not a production risk engine. The pool acts as the counterparty without hedging its exposure and uses deliberately simple liquidity accounting.

View Repository

Build, test, and run the Anchor program and client.

Protocol Architecture

Place this example in a complete prediction-market or trading architecture.

What the example demonstrates

  • Session-authorized execution: place bets without repeated wallet prompts after setup.
  • SPL-token custody: stake and pool liquidity move through delegated eATAs.
  • Real-time pricing: opening and settlement prices come from the same configured oracle feed.
  • Expiry settlement: wins pay the configured multiplier, ties refund, and losses remain in the pool.

SPL Token Custody

Understand eATA custody and post-commit payout alternatives.

Pricing Oracle

Validate feed identity, freshness, and price data in your program.

Session Keys

Scope repeated trading actions and review the security boundaries.

Cranks

Extend manual settlement with scheduled expiry checks.