Skip to main content

How It Works

Deep dive into the mechanics that power Seesaw's prediction markets. This section covers the market lifecycle, oracle integration, order matching, and settlement process.

The Core Concept

Seesaw creates binary prediction markets - markets with exactly two outcomes:

Market Timing

Every market follows a precise cadence based on its configured duration and Unix timestamps. Durations range from 60 seconds to 7 days (default: 15 minutes):

market_id = floor(unix_timestamp / duration_seconds)
t_start   = market_id × duration_seconds
t_end     = t_start + duration_seconds

Example Timeline (UTC) — 15-minute markets

Market IDStart TimeEnd TimeStatus
193680014:00:0014:15:00RESOLVED
193680114:15:0014:30:00TRADING
193680214:30:0014:45:00PENDING

Multiple markets with different durations can run concurrently for the same asset (e.g., a 1-minute and a 1-hour SOL/USD market).

Complete Lifecycle

State Details

StateWhat HappensDuration
PENDINGNo on-chain account yetUntil created
CREATEDAccount initialized, awaiting start priceUntil t_start
TRADINGOrder book active, trades executeMarket's duration
SETTLINGEnd price captured, computing outcomeSeconds
RESOLVEDOutcome determined, claims availableUntil all claimed
CLOSEDAll accounts closed, rent reclaimedFinal

Price Mechanics

Shares are priced between 0 and 1 USDC (stored as basis points internally):

The Probability Relationship

Since YES and NO are complementary:

P(YES) + P(NO) = 100%

If YES trades at 0.60:
└── Implied P(UP) = 60%
└── NO should trade at 0.40
└── Implied P(DOWN) = 40%

Order Book Mechanics

Seesaw uses a single unified order book for YES shares. NO orders are automatically converted:

Conversion Rules

Your IntentBook ActionPrice Conversion
Buy YES @ PBid @ PNone
Sell YES @ PAsk @ PNone
Buy NO @ PAsk @ (1-P)new_price = 10000 - price
Sell NO @ PBid @ (1-P)new_price = 10000 - price

Oracle Integration

Seesaw uses Pyth Network for price data:

Sampling Rules

Start Price (P_start):

  • First Pyth update where publish_time >= t_start
  • Must have positive price
  • Immutable once captured

End Price (P_end):

  • First Pyth update where publish_time >= t_end
  • Must have positive price
  • Immutable once captured

Resolution Logic

if P_end >= P_start:
    outcome = UP
else:
    outcome = DOWN

Important: Equality (no change) resolves as UP.

Collateralization

Every share in circulation is backed 1:1 by USDC:

Solvency Invariant

The vault always holds enough to pay all possible winners:

vault_balance >= max(total_yes_shares, total_no_shares)

This ensures the protocol can always settle regardless of outcome.

Fee Structure

Fee TypeRateRecipientWhen
Taker Fee0.30%ProtocolOn trade
Maker Rebate0.10%Order placerOn trade
Net0.20%Protocol

Example Calculation

Trade: Buy 100 YES @ 0.50
Notional: 50 USDC

Taker pays:  50 × 1.003 = 50.15 USDC
Maker gets: 50 × 1.001 = 50.05 USDC
Protocol:   0.10 USDC

Settlement Process

After resolution, winners claim their payouts:

Related Documentation