Instructions Reference#
All Seesaw protocol instructions, with discriminators, accounts, and arguments. The complete account-list appendix includes every live instruction's ordered accounts, shared groups, conditional tails, and signer/writable roles, generated from the SDK builders and checked against the Rust live-tag inventory.
Instruction Overview#
Instruction Discriminators#
The live public ABI has 191 public instructions spanning 0x00–0xBE, generated
from the single route table in program/src/abi_compaction.rs. The span is
dense: there are no reserved or tombstoned instruction bytes, and every byte
0xBF–0xFE is rejected with InvalidInstructionData before any account is
read. The removed aggregate-capacity governance, proof-buffer authentication and
Sports routes have no wire byte. Internal binary event recording
uses 0xFF. Tags 0x2D–0x2E are
set_pauser and update_operational_params. The retired oracle-governance tags and
config fields are absent. Consequently, there is no live pending Pyth program-ID update to apply.
| # | Instruction | Discriminator | Category |
|---|---|---|---|
| 0 | initialize_config | 0x00 | Configuration |
| 1 | update_authority | 0x01 | Authority |
| 2 | claim_authority | 0x02 | Authority |
| 3 | create_market | 0x03 | Market Lifecycle |
| 4 | snapshot_end | 0x04 | Market Lifecycle |
| 5 | resolve_market | 0x05 | Market Lifecycle |
| 6 | expire_market | 0x06 | Market Lifecycle |
| 7 | mint_shares | 0x07 | Token/Settlement |
| 8 | deposit_funds | 0x08 | Free Funds |
| 9 | withdraw_funds | 0x09 | Free Funds |
| 10 | withdraw_shares | 0x0A | Token/Settlement |
| 11 | merge_complete_set | 0x0B | Token/Settlement |
| 12 | place_order | 0x0C | Trading |
| 13 | place_multiple_post_only | 0x0D | Trading |
| 14 | swap_with_free_funds | 0x0E | Trading |
| 15 | place_limit_with_free_funds | 0x0F | Trading |
| 16 | batch_post_only_with_free_funds | 0x10 | Trading |
| 17 | cancel_order | 0x11 | Trading |
| 18 | cancel_multiple_orders_by_id | 0x12 | Trading |
| 19 | reduce_order | 0x13 | Trading |
| 20 | cancel_multiple_orders_by_id_with_free_funds | 0x14 | Trading |
| 21 | reduce_order_with_free_funds | 0x15 | Trading |
| 22 | reclaim_expired_order | 0x16 | Trading |
| 23 | redeem | 0x17 | Token/Settlement |
| 24 | force_close | 0x18 | Token/Settlement |
| 25 | mark_position_settled | 0x19 | Token/Settlement |
| 26 | close_position | 0x1A | Token/Settlement |
| 27 | close_market | 0x1B | Market Lifecycle |
| 28 | update_fee_config | 0x1C | Admin |
| 29 | update_treasury_recipients | 0x1D | Admin |
| 30 | set_referrer | 0x1E | Referral |
| 31 | claim_creator_fees | 0x1F | Fees |
| 32 | pause | 0x20 | Admin |
| 33 | unpause | 0x21 | Admin |
| 34 | enable_post_only_mode | 0x22 | Admin |
| 35 | disable_post_only_mode | 0x23 | Admin |
| 36 | update_tick_size | 0x24 | Admin |
| 37 | update_min_resting_notional | 0x25 | Admin |
| 38 | update_market_cap | 0x26 | Admin |
| 39 | set_market_emergency_status | 0x27 | Admin |
| 40 | force_cancel_market_orders | 0x28 | Admin |
| 41 | set_pauser | 0x29 | Admin |
| 42 | update_operational_params | 0x2A | Admin |
| 43 | ensure_trader_ledger_space | 0x2B | Market Lifecycle |
| 44 | ensure_deep_orderbook_space | 0x2C | Market Lifecycle |
| 45 | top_up_closer_rewards | 0x2D | Market Lifecycle |
| 46 | init_spline_series | 0x2E | Splines |
| 47 | update_series_template | 0x2F | Splines |
| 48 | update_seat_mid | 0x30 | Splines |
| 49 | attach_seat | 0x31 | Splines |
| 50 | settle_seat | 0x32 | Splines |
| 51 | recover_seat | 0x33 | Splines |
| 52 | deposit_series_vault | 0x34 | Splines |
| 53 | withdraw_series_vault | 0x35 | Splines |
| 54 | close_spline_series | 0x36 | Splines |
| 55 | begin_source_market | 0x37 | Source Markets |
| 56 | open_source_market | 0x38 | Source Markets |
| 57 | expire_external_market | 0x39 | External Markets |
| 58 | close_preallocated_child | 0x3A | External Markets |
| 59 | reclaim_external_market_preallocation | 0x3B | External Markets |
| 60 | top_up_external_progress_reserve | 0x3C | External Markets |
| 61 | evacuate_idle_seat | 0x3D | Keeper Maintenance |
| 62 | resolve_source_market | 0x3E | Source Markets |
| 63 | halt_source_market | 0x3F | Source Markets |
| 64 | update_source_close | 0x40 | Source Markets |
| 65 | finalize_source_market | 0x41 | Source Markets |
| 66 | close_source_accounts | 0x42 | Source Markets |
| 67 | initialize_source_control | 0x43 | Source Control |
| 68 | set_source_profile_policy | 0x44 | Source Control |
| 69 | initialize_witness_registry | 0x45 | Witness Registry |
| 70 | revoke_witness_slot | 0x46 | Witness Registry |
| 71 | set_witness_measurement | 0x47 | Witness Registry |
| 72 | register_attested_witness | 0x48 | Witness Registry |
| 73 | rotate_seat_quote_authority | 0x49 | Splines |
| 74 | approve_builder | 0x4A | Builder Fees |
| 75 | revoke_builder | 0x4B | Builder Fees |
| 76 | set_currency_freeze_exception | 0x4C | Currencies |
| 77 | register_currency | 0x4D | Currencies |
| 78 | initialize_currency_referral_treasury | 0x4E | Currencies |
| 79 | initialize_currency_referrer_earnings | 0x4F | Currencies |
| 80 | claim_currency_referrer_earnings | 0x50 | Currencies |
| 81 | rollup_currency_referral_fees | 0x51 | Currencies |
| 82 | initialize_currency_protocol_treasury | 0x52 | Currencies |
| 83 | withdraw_currency_protocol_treasury | 0x53 | Currencies |
| 84 | cancel_order_by_client_id | 0x54 | Order Management |
| 85 | cancel_owner_orders | 0x55 | Order Management |
| 86 | configure_strategy | 0x56 | Strategies |
| 87 | stop_strategy | 0x57 | Strategies |
| 88 | resume_strategy | 0x58 | Strategies |
| 89 | close_strategy | 0x59 | Strategies |
| 90 | reset_strategy_capital | 0x5A | Strategies |
| 91 | update_seat_shape | 0x5B | Splines |
| 92 | top_up_seat_commitment | 0x5C | Splines |
| 93 | attach_seat_from_series | 0x5D | Splines |
| 94 | update_series_subscription | 0x5E | Splines |
| 95 | top_up_series_lamports | 0x5F | Splines |
| 96 | flag_seat_below_floor | 0x60 | Splines |
| 97 | make_seat_dormant | 0x61 | Splines |
| 98 | close_seat | 0x62 | Splines |
| 99 | assert_balances | 0x63 | Trading |
| 100 | replace_maker_quotes | 0x64 | Managed Quotes |
| 101 | set_maker_quote_authority | 0x65 | Managed Quotes |
| 102 | initialize_maker_quote_state | 0x66 | Managed Quotes |
| 103 | close_maker_quote_state | 0x67 | Managed Quotes |
| 104 | fund_maker_quote_inventory | 0x68 | Managed Quotes |
| 105 | withdraw_maker_quote_inventory | 0x69 | Managed Quotes |
| 106 | reclaim_expired_orders | 0x6A | Managed Quotes |
| 107 | create_confidential_market | 0x6B | Confidential Market |
| 108 | record_confidential_terminal | 0x6C | Confidential Market |
| 109 | claim_owner_payout_escrow | 0x6D | Settlement |
| 110 | update_seat_params | 0x6E | Splines |
| 111 | update_seat_program | 0x6F | Splines |
| - | log | 0xFF | Internal Event |
Per-instruction sections below cover the core native surface. The signed source-market, control and witness registry routes, external-market maintenance, seat and series maintenance, builder approvals, currencies, owner cancellation, strategies, balance guards, managed quotes and confidential markets are specified in
spec/IX.md(unavailable reference) andspec/SOURCE_RESULTS.md(unavailable reference), which are checked against the source route table and instruction parsers by the IDL gate.A source market is opened, resolved, halted and given a new close time by a result that admitted witnesses signed. The result travels in the instruction data; the program checks the witness signatures against the deployment's witness registry and the profile policy in the same instruction. There is no proof buffer, no receipt account and no verifier CPI.
See Market-maker spline live surface for the full spline account layout, instruction data, and attachment model.
Compute units: The "Compute Units" figures in the per-instruction sections below are approximate estimates for budgeting only. Actual consumption varies with account state, matching depth, and runtime version — always benchmark against the deployed program and size your transaction CU limits with headroom.
Account-list convention#
Tables below list base accounts before the recorder suffix. On the current
native dispatch surface, every live public route except 0x2C, 0x2E, 0x2F,
0x30, 0x34, 0x35, 0x3A, 0x3C, 0x49, 0x63, 0x64, 0x6E, and 0x70 requires the
terminal read-only pair [self_program, log_authority]. Append it after any
instruction-specific tails. self_program must be this executable program;
log_authority must be its canonical PDA. A missing or malformed pair rejects
before instruction parsing. The thirteen Tail = no routes are intentionally
eventless or accept the pair only as an optional tail; follow their exact
account contracts rather than appending a recorder pair indiscriminately.
This reference describes the currently shipped native ABI. LOG is an
internal self-CPI route, not a public transaction instruction.
initialize_config#
One-time protocol initialization. Creates the config PDA, records the initial authority and eight protocol fee-recipient addresses, validates the default settlement mint, and writes the default taker fee coefficient and five-way allocation.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | config | - | W | Config PDA |
| 1 | authority | S | W | Upgrade authority and rent payer |
| 2–9 | treasury_recipients[0..7] | - | - | Eight distinct settlement-token fee recipients |
| 10 | default_settlement_mint | - | - | Settlement mint |
| 11 | system_program | - | - | System Program |
| 12 | program_data | - | - | Upgradeable program data |
InitializeConfig has 13 base accounts plus the required recorder pair: 15 total.
<!-- src: program/src/processor/initialize_config.rs:49 INITIALIZE_CONFIG_BASE_ACCOUNT_COUNT -->Arguments#
| Field | Type | Description |
|---|---|---|
| tick_size_bps | u16 | Price tick size |
The fee fields are initialized from shipped protocol defaults:
taker_fee_coefficient_bps = 400, protocol_fee_bps = 4_500,
maker_rebate_share_bps = 4_000, default_creator_fee_bps = 500,
referral_share_bps_of_fee = 500, builder_share_bps = 500, and
maker_rebate_min_rest_seconds = 10.
These are initialization values, not an attestation of deployed config.
The shipped allocation is 45% protocol / 5% creator / 5% referral / 5% builder / 40% maker rebate. Eligible maker fills credit the maker's free quote balance; ineligible maker allocation and rounding dust go to protocol, as do the referral allocation without an eligible referrer and the builder allocation when the order names no approved builder. See fee constants and allocation details.
<!-- src: program/src/logic/fee.rs:187 FeeSplit5::TARGET -->Constraint: authority must sign and must match the upgrade authority stored in program_data.
Compute Units#
~6,000 CU
create_market#
Create a new market for a configured Pyth feed and duration. The instruction initializes all market PDAs, validates the settlement mint, captures the first valid price from a transient Receiver PriceUpdateV2 account, and transitions the market into trading. Pyth Pull is the only supported oracle path.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | market | - | W | Market PDA |
| 1 | orderbook | - | W | Orderbook PDA |
| 2 | vault | - | W | SPL Token vault PDA |
| 3 | yes_mint | - | W | YES mint PDA |
| 4 | no_mint | - | W | NO mint PDA |
| 5 | asset_state | - | W | Per-feed asset state PDA |
| 6 | config | - | W | Protocol config; increments markets_created |
| 7 | price_update | - | - | Pyth price feed: transient Receiver PriceUpdateV2 |
| 8 | settlement_mint | - | - | USDT/SPL settlement mint |
| 9 | payer | S | W | Rent payer and market creator |
| 10 | system_program | - | - | System Program |
| 11 | token_program | - | - | SPL Token Program |
| 12 | yes_escrow | - | W | Market-owned YES escrow token account |
| 13 | no_escrow | - | W | Market-owned NO escrow token account |
| 14 | trader_ledger | - | W | Market-owned trader ledger PDA |
Sixteen base accounts — the fifteen-account head plus the immutable native resolution policy PDA, which the processor commits in the same atomic create — and the required recorder pair: 18 total. Creation is market-local: it reserves nothing from a protocol-wide pool and carries no concurrency epoch.
<!-- src: program/src/processor/create_market.rs:1039 process -->Arguments#
| Field | Type | Description |
|---|---|---|
| max_confidence_ratio_bps | u16 | Max Pyth confidence interval as bps of price; 0 disables this market guard |
| duration_seconds | u64 | Market duration, bounded by protocol min/max |
| max_oracle_jump_bps | u32 | Optional per-market start-to-end jump guard; 0 uses the protocol default |
| max_total_shares | u64 | Nonzero per-market YES/NO supply cap; the sole authoritative cap for this market |
The payload is exactly 22 bytes after the discriminator; every other length is rejected.
<!-- src: program/src/instruction.rs CreateMarketArgs::SIZE -->market_id is derived from the current timestamp and duration_seconds; clients do not pass it directly in the current instruction data. The payload carries no capacity: every market has the one canonical size (8,193 trader seats, 4,096 order slots per side; see Market Capacity).
Compute Units#
~25,000 CU
snapshot_end#
Capture the closing price from a transient Pyth Receiver PriceUpdateV2.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | market | - | W | Market PDA |
| 1 | price_update | - | - | Transient Receiver PriceUpdateV2 |
| 2 | settler | S | W | Permissionless settlement caller |
| 3 | config | - | - | Protocol config |
| 4 | vault | - | - | Canonical settlement vault |
The five base accounts require the two-account recorder suffix: seven total.
<!-- src: program/src/processor/mod.rs:129 requires_recorder_tail -->Arguments#
None.
Compute Units#
~15,000 CU
Side Effects#
- Captures the authenticated Pyth end snapshot and advances the lifecycle.
- Pays the configured closer reward to the successful settler.
- Does not cancel resting orders or return their collateral; use the explicit cancel, reclaim, redeem, or terminal cleanup paths.
place_order#
Submit a Limit, PostOnly or ImmediateOrCancel order.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | market | - | W | Market PDA |
| 1 | orderbook | - | W | Orderbook PDA |
| 2 | user_position | - | W | User position PDA |
| 3 | user_token_account | - | W | User's settlement-token account |
| 4 | vault | - | W | Market vault |
| 5 | user | S | W | Order owner |
| 6 | config | - | - | Protocol config |
| 7 | treasury_token_account | - | W | Protocol fee recipient |
| 8 | token_program | - | - | SPL Token Program |
| 9 | system_program | - | - | System Program, used when creating position PDA |
| 10 | settlement_mint | - | - | Settlement mint |
| 11 | yes_escrow | - | W | Market-owned YES escrow |
| 12 | no_escrow | - | W | Market-owned NO escrow |
| 13 | user_yes_ata | - | W | User YES token account |
| 14 | user_no_ata | - | W | User NO token account |
| 15 | yes_mint | - | W | YES mint PDA |
| 16 | no_mint | - | W | NO mint PDA |
| 17 | trader_ledger | - | W | Market-owned trader ledger PDA |
After the 18-account prefix, a spline-enabled market requires its one writable
creator spline at index 18. Next comes an optional single taker_referral_account
(read-only ReferralAccount), then an optional builder pair
[builder_approval (read-only), builder_token_account (writable)] for an approved
builder, then the mandatory recorder pair. The builder pair is never accepted on a
PostOnly order. The old referrer-wallet/earnings/treasury triple is not accepted.
Total accounts: 20–23 without a spline, 21–24 with the creator spline.
Arguments#
The payload is exactly 83 bytes after the discriminator.
| Offset | Field | Type | Description |
|---|---|---|---|
| 0 | outcome | u8 | 0=YES, 1=NO |
| 1 | intent | u8 | 0=BUY, 1=SELL |
| 2 | price_bps | u16 | Limit price [1, 9999] in the named outcome's own price space |
| 4 | quantity | u64 | Nonzero share quantity |
| 12 | order_type | u8 | 0=Limit, 1=PostOnly, 2=IOC |
| 13 | worst_acceptable_price_bps | u16 | IOC-only slippage bound; ignored for Limit/PostOnly |
| 15 | min_fill_quantity | u64 | IOC-only atomic minimum matched quantity; 0 disables; ignored for Limit/PostOnly |
| 23 | match_limit | u8 | Wire domain 0..=12; 0 uses the protocol default; counts maker iterations including evictions and self-trade hits |
| 24 | self_trade_behavior | u8 | 0=Abort, 1=CancelProvide, 2=DecrementTake |
| 25 | max_age_seconds | u32 | TTL for this order's resting remainder; zero selects market close, nonzero is capped at that close |
| 29 | reject_post_only_would_cross | u8 | PostOnly: 1 rejects with WouldCross; 0 slides one tick beyond the crossing maker, rejecting if no valid price remains |
| 30 | protocol_treasury_index | u8 | Preference in [0,8); the supplied config-approved recipient determines the effective index; unregistered recipient rejects |
| 31 | client_order_id | [u8; 16] | Optional client identifier; all-zero means none |
| 47 | execution_valid_until | i64 | Absolute execution deadline; 0 disables |
| 55 | resting_expires_at | i64 | Absolute resting deadline; 0 disables |
| 63 | max_quote_input | u64 | Maximum aggregate quote input; u64::MAX disables |
| 71 | min_quote_output | u64 | Minimum aggregate quote output; 0 disables |
| 79 | expected_fee_epoch | u32 | Fee policy epoch pin; 0 leaves it unpinned |
Clients never complement a NO price and never select a book side. The program
derives the stored custody side once (BuyYes, SellYes, BuyNo = bid receiving
NO, SellNo = ask escrowing NO); see order book encoding (unavailable reference).
Compute Units#
~15,000 - 50,000 CU (depends on matching)
cancel_order#
Remove an open order.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | market | - | W | Market PDA |
| 1 | orderbook | - | W | Orderbook PDA |
| 2 | user_position | - | W | User position PDA |
| 3 | user_token_account | - | W | User settlement-token account |
| 4 | vault | - | W | Market vault |
| 5 | user | S | - | Order owner |
| 6 | token_program | - | - | SPL Token Program |
| 7 | settlement_mint | - | - | Settlement mint |
| 8 | yes_escrow | - | W | YES escrow |
| 9 | no_escrow | - | W | NO escrow |
| 10 | user_yes_ata | - | W | User YES token account |
| 11 | user_no_ata | - | W | User NO token account |
| 12 | yes_mint | - | W | YES mint |
| 13 | no_mint | - | W | NO mint |
| 14 | trader_ledger | - | W | Trader-ledger PDA |
Fifteen base accounts plus the required recorder pair: 17 total.
<!-- src: program/src/processor/cancel_order.rs:81 CancelOrderAccounts -->Arguments#
| Field | Type | Description |
|---|---|---|
| order_id | u64 | Order to cancel |
Compute Units#
~8,000 CU
resolve_market#
Determine outcome from snapshots.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | market | - | W | Market PDA |
| 1 | asset_state | - | W | Asset-state PDA bound to the market feed |
| 2 | caller | S | W | Permissionless caller; receives closer reward |
| 3 | config | - | - | Protocol config |
| 4 | vault | - | W | Market vault |
| 5 | creator_token_account | - | W | Creator fee destination |
| 6 | settlement_mint | - | - | Settlement mint |
| 7 | token_program | - | - | SPL Token Program |
| 8 | native_policy | - | - | Immutable native resolution policy PDA |
Nine base accounts plus the required recorder pair: 11 total.
<!-- src: program/src/processor/resolve.rs:49 ResolveMarketAccounts -->Arguments#
None.
Compute Units#
~6,000 CU
Resolution Logic#
Prices are normalized to a common exponent and widened by their Pyth confidence intervals. The outcome is directional only when the intervals are strictly disjoint:
Equality never settles UP. A neutral result pays each YES and NO share half of the payout denominator (50/50), not a refund of entry cost.
<!-- src: program/src/logic/resolve_processor.rs:496 compute_outcome_with_confidence -->mint_shares (0x07)#
Deposit USDT to receive equal YES + NO tokens.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | market | - | W | Market PDA |
| 1 | yes_mint | - | W | YES mint |
| 2 | no_mint | - | W | NO mint |
| 3 | user_yes_ata | - | W | User YES token account |
| 4 | user_no_ata | - | W | User NO token account |
| 5 | user_stablecoin_ata | - | W | User settlement-token account |
| 6 | vault | - | W | Market vault |
| 7 | user | S | - | User |
| 8 | config | - | - | Protocol config |
| 9 | token_program | - | - | SPL Token Program |
| 10 | settlement_mint | - | - | Settlement mint |
Eleven base accounts plus the required recorder pair: 13 total.
<!-- src: program/src/processor/mint_shares.rs:32 MintSharesAccounts -->Arguments#
| Field | Type | Description |
|---|---|---|
| amount | u64 | Amount of USDT to deposit |
Compute Units#
~15,000 CU
redeem (0x17)#
Burn winning tokens for USDT after resolution.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | market | - | W | Market PDA |
| 1 | yes_mint | - | W | YES mint |
| 2 | no_mint | - | W | NO mint |
| 3 | user_yes_ata | - | W | User YES token account |
| 4 | user_no_ata | - | W | User NO token account |
| 5 | user_stablecoin_ata | - | W | User settlement-token account |
| 6 | vault | - | W | Market vault |
| 7 | user | S | - | User |
| 8 | token_program | - | - | SPL Token Program |
| 9 | settlement_mint | - | - | Settlement mint |
External markets require read-only market_meta next; native markets omit it.
An optional all-or-none writable trio [user_position, orderbook, trader_ledger]
follows. The recorder pair is always last. Native totals are 12 or 15 accounts;
external totals are 13 or 16.
Arguments#
| Field | Type | Description |
|---|---|---|
| amount | u64 | Amount of tokens to redeem |
| token_type | u8 | Which token to redeem (0=Yes, 1=No) |
Compute Units#
~15,000 CU
Payout Calculation#
withdraw_shares (0x0A)#
Convert trader-ledger free YES/NO share credits to SPL tokens.
Compute Units#
~10,000 CU
force_close (0x18)#
Force-close a position in an unresolved market after the expiration window.
It refunds only the remaining unfilled-bid collateral, rejects residual
ask-side share locks, and leaves owned YES/NO shares for Redeem after a
terminal outcome. It does not pay a 50/50 share payout.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | market | - | W | Market PDA |
| 1 | position | - | W | User position PDA |
| 2 | vault | - | W | Market vault |
| 3 | user_stablecoin_ata | - | W | Position owner's USDT account |
| 4 | caller | S | - | Permissionless caller |
| 5 | config | - | - | Protocol config |
| 6 | token_program | - | - | SPL Token Program |
| 7 | settlement_mint | - | - | Settlement token mint |
| 8 | orderbook | - | W | Canonical orderbook |
| 9 | trader_ledger | - | W | Canonical trader ledger |
| 10 | yes_escrow | - | W | Canonical YES escrow |
| 11 | no_escrow | - | W | Canonical NO escrow |
| 12 | yes_mint | - | W | Canonical YES mint |
| 13 | no_mint | - | W | Canonical NO mint |
Fourteen base accounts plus the required recorder pair: 16 total.
Prerequisites#
current_time >= t_end + expiration_window AND outcome == 0
Compute Units#
~12,000 CU
close_market (0x1B)#
Close resolved market after 7-day timeout. Transfers rent to creator.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | market | - | W | Market PDA |
| 1 | creator | - | W | Market creator (rent target) |
| 2 | caller | S | - | Caller (permissionless) |
| 3 | config | - | - | Protocol config |
| 4 | system_program | - | - | System Program |
| 5 | vault | - | W | Market settlement vault |
| 6 | token_program | - | - | SPL Token Program |
| 7 | orderbook | - | W | Market orderbook PDA |
| 8 | yes_escrow | - | W | YES escrow PDA |
| 9 | no_escrow | - | W | NO escrow PDA |
| 10 | trader_ledger | - | W | Dynamic ledger PDA |
| 11 | residual_recipient | - | W | Residual vault recipient |
After the 12-account prefix, native tails are writable [native_policy] or
[native_policy, yes_mint, no_mint]. External tails are [market_meta, external_policy] or
[market_meta, external_policy, yes_mint, no_mint]; both sidecars are writable. The mint pair is
needed when donated share surplus must be burned. A direct CloseMarket on an
external market fails: CloseSourceAccounts (0x42) runs the same close with the
market's source state in the external_policy slot, after checking that it is
the state bound to the market. The native policy, or the external metadata and
source state, are authenticated and refunded to the creator before parent
teardown. The resolver family comes from authenticated market state, not a
caller-selected option. Role 11 (residual_recipient) receives
any residual vault balance; it is always the creator's settlement-token account.
Every form then appends the mandatory recorder pair. Native totals are 15 or 17;
external totals are 16 or 18. No form releases or draws on a protocol-wide
capacity pool: each market's own max_total_shares disappears with the market,
so close is purely market-local and emits no capacity-release event.
Prerequisites#
current_time >= resolved_at + 604800 AND outcome != 0
Compute Units#
~8,000 CU
State Transitions#
Error Codes#
Seesaw uses a custom #[repr(u32)] error enum (SeesawError) with
category-prefixed hex codes that surface as ProgramError::Custom(code). Codes
are not in the Anchor 6000+ range. A representative selection (see the
SeesawError enum in the program source for the exhaustive list):
| Code | Name | Category | Description |
|---|---|---|---|
| 0x1001 | MarketExists | Market | Market already exists |
| 0x1002 | InvalidState | Market | Wrong market state for the operation |
| 0x1005 | AlreadyResolved | Market | Market already resolved |
| 0x1011 | InvalidStateTransition | Market | Illegal lifecycle transition |
| 0x2001 | OracleMismatch | Oracle | Oracle account does not match market |
| 0x2002 | StaleOracle | Oracle | Oracle price too old |
| 0x2003 | InvalidPrice | Oracle | Non-positive / invalid oracle price |
| 0x2005 | FeedIdMismatch | Oracle | Pyth feed id mismatch |
| 0x3001 | InvalidQuantity | Order | Order quantity out of range |
| 0x3004 | WouldCross | Order | Post-only order would cross the book |
| 0x3007 | SlippageExceeded | Order | Fill price worse than slippage guard |
| 0x4001 | MathOverflow | Math | Checked arithmetic overflowed |
| 0x5003 | InvalidPDA | Account | PDA derivation mismatch |
| 0x5005 | InsolvencyDetected | Account | Solvency invariant would break |
| 0x6001 | ProtocolPaused | Position | Protocol is paused |
| 0x7004 | SolvencyViolation | Token | Token operation breaks solvency |
| 0x8002 | InvalidFeeSplit | Fee | Fee split does not sum to 10,000 |
| 0x9001 | NoPendingAuthority | Authority | No pending authority to claim |
Category ranges: Market 0x1001+, Oracle 0x2001+, Order 0x3001+, Math
0x4001, Account 0x5001+, Position 0x6001, Token 0x7001+, Fee/Treasury
0x8001+, Authority 0x9001+.
claim_creator_fees (0x1F)#
Sweep deferred creator fees from the market vault to the creator's token account.
Permissionless — anyone may call it, but fees are always sent to market.creator.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | market | - | W | Market PDA |
| 1 | vault | - | W | Market vault (SPL Token, holds accumulated fees) |
| 2 | creator_token_account | - | W | Creator's token account for market.settlement_mint |
| 3 | settlement_mint | - | - | Settlement mint (TransferChecked) |
| 4 | caller | S | - | Permissionless caller (signer) |
| 5 | token_program | - | - | SPL Token Program |
Arguments#
None.
Prerequisites#
market.outcome != 0 (resolved or expired)
market.accumulated_creator_fees > 0
creator_token_account.owner == market.creator
creator_token_account.mint == market.settlement_mint
Compute Units#
~10,000 CU
Side Effects#
- Transfers
accumulated_creator_feesUSDT from vault to creator's token account viaTransferChecked. - Zeroes
market.accumulated_creator_fees. - Emits
CreatorFeesClaimedevent.
update_fee_config (0x1C)#
Admin-only. Retunes the taker fee coefficient, five-way allocation and maker
resting-age gate atomically. The fee is
ceil(notional × taker_fee_coefficient_bps × (10_000 − p) / 10_000²) with no cap. Instruction argument names below differ
from the stored config fields.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | config | - | W | Config PDA |
| 1 | authority | S | - | Protocol authority |
Arguments#
| Field | Type | Description |
|---|---|---|
| taker_fee_coefficient_bps | u16 | New coefficient k, 0..=10_000 |
| reserved | u16 | Must be zero |
| protocol_share_bps | u16 | Protocol share (bps of total fee) |
| creator_share_bps | u16 | Creator share (bps of total fee) |
| referral_share_bps | u16 | Referral share (bps of total fee) |
| builder_share_bps | u16 | Builder share (bps of total fee) |
| maker_rebate_share_bps | u16 | Eligible maker share (bps of total fee) |
| maker_rebate_min_rest_seconds | u32 | Minimum age for rebate eligibility |
Constraints:
protocol_share_bps + creator_share_bps + referral_share_bps + builder_share_bps + maker_rebate_share_bps == 10_0002_000 <= protocol_share_bps <= 4_500andbuilder_share_bps <= 1_000taker_fee_coefficient_bps <= 10_000andreserved == 0- At most one fee-config change per hour (
FEE_CONFIG_RATE_LIMIT_SECONDS)
Compute Units#
~3,500 CU
set_referrer (0x1E)#
Permissionless. Binds a ReferralAccount PDA to a user, recording the referrer and the attribution timestamp. First-touch and immutable; an existing referral account cannot be overwritten.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | referral_account | - | W | ReferralAccount PDA (user-scoped, to create) |
| 1 | user | S | W | User being attributed (pays rent) |
| 2 | referrer | - | - | Referrer wallet |
| 3 | referrer_earnings_account | - | - | Existing ReferrerEarningsAccount PDA for referrer |
| 4 | system_program | - | - | System Program |
Arguments#
None (referrer is read from accounts[2]).
Prerequisites#
referral_account does not yet exist
referrer != user (self-referral rejected)
referrer_earnings_account.referrer == referrer
Compute Units#
~5,000 CU
Side Effects#
- Writes
ReferralAccount { referee: user, referrer, created_at: now, expires_at: now + REFERRAL_DURATION_SECONDS, ... }to PDA. - Emits
ReferrerSetevent.
init_referrer_earnings_account (0x1F)#
Permissionless. Creates the per-referrer earnings escrow (ReferrerEarningsAccount PDA) if it doesn't exist. The referrer signs and pays rent. Also records which treasury shard the referrer is associated with for future claim_referrer_earnings calls.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | referrer_earnings_account | - | W | Earnings PDA to create |
| 1 | referrer | S | W | Referrer and rent payer |
| 2 | treasury_shard | - | - | Preprovisioned canonical shard for treasury_index |
| 3 | settlement_mint | - | - | Config default settlement mint |
| 4 | config | - | - | Protocol config |
| 5 | system_program | - | - | System Program |
Six base accounts plus the required recorder pair: eight total. The shard must
already exist via InitializeCurrencyReferralTreasury (0x4E); this instruction does
not create it and takes no token-program account.
Arguments#
| Field | Type | Description |
|---|---|---|
| treasury_index | u8 | Treasury shard index ∈ [0, 8) for this referrer's fees |
Compute Units#
~5,000 CU
claim_referrer_earnings (0x21)#
Sweep accumulated referrer earnings from the sharded referrer_treasury_k PDA to the referrer's token account. Permissionless — anyone may call it, but funds always go to the referrer.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | referrer_earnings_account | - | W | Referrer's ReferrerEarningsAccount PDA |
| 1 | referrer_treasury_k | - | W | Sharded referral escrow token account selected by the earnings account treasury_index |
| 2 | referrer_token_account | - | W | Referrer's token account for settlement_mint |
| 3 | settlement_mint | - | - | Settlement mint (TransferChecked) |
| 4 | referrer | S | - | Referrer wallet |
| 5 | token_program | - | - | SPL Token Program |
| 6 | config | - | - | Config PDA |
Arguments#
None.
Prerequisites#
referrer_earnings_account.accumulated > 0
referrer_token_account.owner == referrer
referrer_token_account.mint == config.default_settlement_mint
Compute Units#
~10,000 CU
Side Effects#
- Transfers
accumulatedUSDT fromreferrer_treasury_ktoreferrer_token_accountviaTransferChecked. - Zeroes
referrer_earnings_account.accumulated, bumpstotal_claimed, and writeslast_claim_at. - Emits
ReferralClaimedevent.
ensure_trader_ledger_space (0x2B)#
Pre-grow the TraderLedgerAccount PDA before CreateMarket. Because Solana
caps account growth at MAX_PERMITTED_DATA_INCREASE (10,240 bytes) per
instruction, the 1,181,984-byte canonical ledger takes 116 invocations.
CreateMarket rejects a ledger that has not been fully pre-grown.
Idempotent: a no-op once the PDA is at the canonical size.
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | trader_ledger | - | W | Trader-ledger PDA (may not yet exist) |
| 1 | market | - | - | Parent market PDA (seeds for ledger PDA) |
| 2 | payer | S | W | Rent payer (any caller) |
| 3 | system_program | - | - | System Program |
Arguments#
The growth target is compiled in, so no size is sent. The payload is empty (the
external-receipt form, which needs the receipt account) or the 48-byte native
binding [feed_id:32][duration_seconds:u64][market_id:u64]; every other length is
rejected.
Compute Units#
~5,000 CU per call
Usage#
ceil(688268 / 10240) = 68 EnsureTraderLedgerSpace invocations required before CreateMarket.
SDKs (@seesaw/core, sdk-rust, sdk-python) bundle this prelude automatically.
update_operational_params (0x2A)#
Admin-only. Post-deploy setter for nine operational parameters, including the
currently shipped creator-spline controls listed below. Rate-limited to once per
OPERATIONAL_PARAMS_RATE_LIMIT_SECONDS (3,600 s).
Accounts#
| # | Account | Signer | Writable | Description |
|---|---|---|---|---|
| 0 | config | - | W | Config PDA |
| 1 | authority | S | - | Protocol authority |
Arguments#
| Field | Type | Description |
|---|---|---|
| closer_cap_oracle_lamports | u64 | Oracle-class closer cap, 1..=50_000_000 lamports |
| closer_cap_plain_lamports | u64 | Plain-class closer cap, 1..=50_000_000 lamports |
| closer_ramp_oracle_seconds | u32 | Oracle-class ramp, 1..=604_800 seconds |
| closer_ramp_plain_seconds | u32 | Plain-class ramp, 1..=604_800 seconds |
| max_price_staleness_seconds | u64 | Oracle freshness seconds; 0 selects protocol default |
| market_expiration_window_seconds | u64 | Expiry delay seconds; 0 selects protocol default |
| min_market_duration_seconds | u64 | Minimum duration seconds; 0 selects protocol default |
| max_market_duration_seconds | u64 | Maximum duration seconds; 0 selects protocol default |
| max_order_size | u64 | Maximum share-token base units; must be nonzero |
| spline_flags | u8 | Bit 0 enables spline attachment |
| spline_min_commitment | u64 | Minimum stablecoin base-unit commitment; must be nonzero |
| spline_mid_jump_reset_bps | u16 | Material mid-price jump threshold for resetting eligibility |
All fields are supplied atomically; zero does not mean “leave unchanged.”
<!-- src: program/src/instruction.rs:1163 UpdateOperationalParamsArgs -->Constraint: Rate-limited by last_operational_params_update_at; returns
OperationalParamsRateLimit (0x800D) if called within the cooldown window.
Compute Units#
~3,500 CU
Rejected discriminators#
Bytes 0xBF–0xFE have no public route. Dispatch rejects
every one of them with InvalidInstructionData regardless of payload length
and before any account is read. set_pauser occupies 0x2D, update_operational_params
occupies 0x2E, and recover_seat occupies 0x37 and takes no payload
after its discriminator. See the current spline account contract.
Next Steps#
Canonical account sizes#
ensure_trader_ledger_space and ensure_deep_orderbook_space carry no size. Each call grows its child by at most 10,240 bytes toward the one canonical size: the trader ledger is 1,181,984 bytes (116 calls) and the deep orderbook is 192 + 336 * capacity = 1,376,448 bytes at the canonical capacity of 4,096 (135 calls).