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 ID | Start Time | End Time | Status |
|---|---|---|---|
| 1936800 | 14:00:00 | 14:15:00 | RESOLVED |
| 1936801 | 14:15:00 | 14:30:00 | TRADING |
| 1936802 | 14:30:00 | 14:45:00 | PENDING |
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#
Note:
create_marketatomically initializes the market account and captures the start price from Pyth, transitioning through the transientCREATEDstate directly intoTRADING.
State Details#
| State | What Happens | Duration |
|---|---|---|
| PENDING | No on-chain account yet | Until created |
| TRADING | Order book active, trades execute | Market's duration |
| SETTLING | End price captured, computing outcome | Seconds |
| RESOLVED | Outcome determined, redemptions available | Until close_market |
| EXPIRED | Market timed out, 50/50 collateral split | Until all force-closed |
| CLOSED | All accounts closed, rent reclaimed | Final |
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 Intent | Book Action | Price Conversion |
|---|---|---|
| Buy YES @ P | Bid @ P | None |
| Sell YES @ P | Ask @ P | None |
| Buy NO @ P | Ask @ (1-P) | new_price = 10000 - price |
| Sell NO @ P | Bid @ (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#
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#
Fees are configurable by the protocol admin. The defaults are:
| Fee Type | Default Rate | Recipient | When |
|---|---|---|---|
| Taker Fee | 2.00% | Split below | On trade |
| → Protocol | 1.50% | Treasury | On trade |
| → Creator | 0.50% | Market creator | On trade |
| Maker Fee | 0% | — | — |
| Max Taker | 5.00% | — | Ceiling |
Makers pay zero fees. The taker fee is split between the protocol treasury and the market creator.
Example Calculation#
Settlement Process#
After resolution, winners claim their payouts:
Related Documentation#
- Order Book Details - Matching engine deep dive
- Oracle Specification - Pyth integration details
- Settlement Rules - Claim process and edge cases