Price-Backed Markets
OddsZero supports short-expiry binary markets (e.g. "Will BTC be UP in 15m / 30m?") that resolve automatically against a real asset price at expiry — no human opinion involved. This is implemented by price_oracle.move and the create_price_market entry point.
How it works
Creation (
create_price_market): the creator supplies afeed_id(e.g. a Pyth BTC/USD feed id) and thereference_price(asset price at creation). The three outcomes are fixed to["Up", "Down", "Push"](index 0 = Up, index 1 = Down, index 2 = Push).expiry_minutesselects a preset:15minutes → dispute window120_000 ms(2 min), max drift60_000 ms(1 min).30minutes → dispute window300_000 ms(5 min), max drift60_000 ms(1 min).
The market carries a
PriceFeedConfigso the keeper can resolve it later. ThePushoutcome triggers when the settlement price is withinpush_threshold_bps(default 0.25%) of the reference price; the market is voided and both Up and Down holders are refunded pro-rata from the collateral snapshot at finalize.Expiry:
ends_at = now + expiry_minutes · 60_000.Resolution (
auto_resolve_price_market): the canonical, permissionless path. Anyone can invoke with a genuinePriceInfoObjectfrom Pyth. The contract performs on-chain attestation viaprice_oracle::verified_reading(feed id match, freshness check, confidence band, non-negative price). The outcome is derived on-chain:|settlement_price − reference_price| > push_threshold_bps → Up or Down |settlement_price − reference_price| ≤ push_threshold_bps → Push (void, pro-rata refund)Deprecated:
resolve_market_priceis kept for backward compatibility butauto_resolve_price_marketis the canonical permissionless path.
Why it matters
- No oracle bias: the outcome is a pure function of real price data at the exact expiry.
- Fast settlement: short dispute windows mean the market finalizes within minutes, not days.
- Auditability:
PriceFeedConfiguredandPriceResolvedevents record the feed, reference price, settlement price, and publish time for anyone to verify.
Constraints
- Only price-backed markets may be resolved via
auto_resolve_price_market/resolve_market_price(the market must have aprice_config). - The resolver must still be a registered oracle and must not be the market creator.
- The category is forced to
"Crypto"for these markets. - Price markets use a 2-second
max_settlement_drift_msand short dispute windows (120s for 15m / 300s for 30m presets).
Event schemas
PriceFeedConfigured { market_id, feed_id, reference_price, up_index, down_index, push_index, auto_resolve }PriceResolved { market_id, settlement_price, reference_price, winning_outcome, publish_time }CreatorSeedRefunded { market_id, creator, amount }— emitted when the creator's seed is refunded at finalize or viareclaim_abandoned_seed.
