Examples#
Real-world workflows demonstrating common Seesaw CLI usage patterns. Each example walks through a complete scenario with full commands.
1. Complete Market Lifecycle#
Goal: Walk through the full on-chain lifecycle of a prediction market from creation to teardown — create, trade, snapshot, resolve, redeem, and close.
Prerequisites#
# Initialize config and verify setup
seesaw config init-file
seesaw config show
Step 1: Create a market#
seesaw market create \
--pyth-feed-id ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d \
--settlement-mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB \
--max-total-shares 1000000000 \
--duration 900 \
--max-confidence-ratio 500
Save the returned market, marketId, and orderbook addresses for later steps. The output JSON includes a "signature" field — a non-null value confirms the transaction landed on-chain.
This CLI creates Pull markets. With PYTH_API_KEY (or PYTH_API_KEY_FILE, or
--pyth-api-key) set, the CLI builds and posts the Receiver update itself. To keep
posting and creation apart, post the start price first with
seesaw pyth post-update --feed <feed id> and pass the printed account as
--price-update <account>; that create needs no Hermes key and no Seesaw API, but
the update must be at most 60 seconds old when CreateMarket lands. See
creation options for provider and exact tip approvals.
Step 2: Mint share pairs#
Deposit USDT to receive equal YES and NO shares:
seesaw position mint \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--amount 1000000 \
--stablecoin-account ATA1abc123def456ghi789jkl012mno345pqr678stu \
--yes-account YesATA1abc123def456ghi789jkl012mno345pqr6 \
--no-account NoATA1abc123def456ghi789jkl012mno345pqr67 \
--settlement-mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
Step 3: Place a sell order#
Sell the NO shares you do not want, effectively taking a YES position. The price is quoted in NO's own price space (4500 bps = 0.45 USDT per NO share):
seesaw order place \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--outcome no \
--intent sell \
--price 4500 \
--quantity 1000000 \
--protocol-treasury-index 3 \
--token-account ATA1abc123def456ghi789jkl012mno345pqr678stu \
--settlement-mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB \
--user-yes-ata YesATA1abc123def456ghi789jkl012mno345pqr6 \
--user-no-ata NoATA1abc123def456ghi789jkl012mno345pqr67
Step 4: Wait for the market window to end#
Monitor the market state:
seesaw market get Mkt1abc123def456ghi789jkl012mno345pqr678stu
When tEnd has passed, proceed to snapshot. Checkpoint: state in the output should be "Trading" while the window is open and "PendingEnd" once it closes.
Step 5: Snapshot the end price#
seesaw market snapshot \
--market-id 112640 \
--price-update Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD \
--pyth-feed-id ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d \
--creator Cre8orAddr123456789abcdefghijklmnopqrstuv \
--settlement-mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB \
--duration 900
--price-update is an end-boundary update that is already posted. Post one with your key with
seesaw pyth post-update --feed <feed id> --at <tEnd>, or pass --pyth-api-key (or set
PYTH_API_KEY) instead of --price-update and the CLI posts it in the same bundle. Resolution
and every later step need no Pyth key. seesaw market crank <market> runs the remaining
permissionless steps in order; market plan prints them first.
Step 6: Resolve the market#
seesaw market resolve \
--market-id 112640 \
--pyth-feed-id ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d \
--creator Cre8orAddr123456789abcdefghijklmnopqrstuv \
--creator-token-account Cre8orATA123456789abcdefghijklmnopqrst \
--settlement-mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB \
--duration 900
Step 7: Redeem winning shares#
If the outcome was UP and you hold YES shares:
seesaw position redeem \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--amount 1000000 \
--token-type yes \
--stablecoin-account ATA1abc123def456ghi789jkl012mno345pqr678stu \
--yes-account YesATA1abc123def456ghi789jkl012mno345pqr6 \
--no-account NoATA1abc123def456ghi789jkl012mno345pqr67 \
--settlement-mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
Step 8: Close the market#
Reclaim rent after all positions are settled:
seesaw market close --market Mkt1abc123def456ghi789jkl012mno345pqr678stu
2. Emergency Force-Close#
Goal: Recover funds from a resolved or expired market where the position owner has not redeemed — anyone can force-close on their behalf and reclaim the account rent.
Scenario#
Market Mkt1abc... was resolved 2 hours ago but user User1abc... has not redeemed. You want to force-close their position to reclaim account rent.
Step 1: Verify market state#
seesaw market get Mkt1abc123def456ghi789jkl012mno345pqr678stu
Checkpoint: confirm the state field in the output is "Resolved" or "Expired" before proceeding.
Step 2: Check the position#
seesaw position get \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--user User1abc123def456ghi789jkl012mno345pqr678s
Checkpoint: confirm settled is false and yesShares or noShares are non-zero.
Step 3: Force-close#
seesaw market force-close \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--position-owner User1abc123def456ghi789jkl012mno345pqr678s \
--user-stablecoin-ata ATA1abc123def456ghi789jkl012mno345pqr678stu \
--settlement-mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
The position owner's USDT ATA receives their payout (if any), and the position account is closed.
Step 4: Close the market#
Once all positions are force-closed or redeemed:
seesaw market close --market Mkt1abc123def456ghi789jkl012mno345pqr678stu
3. Market Making#
Goal: Provide liquidity by quoting a bid/ask spread with post-only orders, then re-quote as the market moves — makers pay zero taker fee on Seesaw.
Step 1: Check the current order book#
seesaw order list --market Mkt1abc123def456ghi789jkl012mno345pqr678stu
Step 2: Mint shares for inventory#
seesaw position mint \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--amount 5000000 \
--stablecoin-account ATA1abc123def456ghi789jkl012mno345pqr678stu \
--yes-account YesATA1abc123def456ghi789jkl012mno345pqr6 \
--no-account NoATA1abc123def456ghi789jkl012mno345pqr67 \
--settlement-mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
Step 3: Place a bid (buy YES)#
seesaw order place \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--outcome yes \
--intent buy \
--price 4800 \
--quantity 2000000 \
--protocol-treasury-index 3 \
--token-account ATA1abc123def456ghi789jkl012mno345pqr678stu \
--settlement-mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB \
--user-yes-ata YesATA1abc123def456ghi789jkl012mno345pqr6 \
--user-no-ata NoATA1abc123def456ghi789jkl012mno345pqr67 \
--order-type post-only
Step 4: Place an ask (sell YES)#
seesaw order place \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--outcome yes \
--intent sell \
--price 5200 \
--quantity 2000000 \
--protocol-treasury-index 3 \
--token-account ATA1abc123def456ghi789jkl012mno345pqr678stu \
--settlement-mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB \
--user-yes-ata YesATA1abc123def456ghi789jkl012mno345pqr6 \
--user-no-ata NoATA1abc123def456ghi789jkl012mno345pqr67 \
--order-type post-only
You are now quoting a 4-cent spread (4800–5200 bps). Checkpoint: both commands return a "signature" confirming on-chain placement. The post-only order type ensures your orders are never matched as taker (makers pay zero fee on Seesaw).
Step 5: Monitor your orders#
seesaw order list \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--owner $(solana address)
Step 6: Cancel and re-quote as needed#
# Cancel the bid (--free-funds skips token-account/yes-ata/no-ata if using free funds)
seesaw order cancel \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--order-id 42 \
--token-account ATA1abc123def456ghi789jkl012mno345pqr678stu \
--settlement-mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB \
--user-yes-ata YesATA1abc123def456ghi789jkl012mno345pqr6 \
--user-no-ata NoATA1abc123def456ghi789jkl012mno345pqr67
# Place a tighter bid
seesaw order place \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--outcome yes \
--intent buy \
--price 4900 \
--quantity 2000000 \
--protocol-treasury-index 3 \
--token-account ATA1abc123def456ghi789jkl012mno345pqr678stu \
--settlement-mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB \
--user-yes-ata YesATA1abc123def456ghi789jkl012mno345pqr6 \
--user-no-ata NoATA1abc123def456ghi789jkl012mno345pqr67 \
--order-type post-only
4. Querying Protocol Data#
Goal: Inspect live markets, leaderboards, stats, and compliance data from the Seesaw indexer without submitting any transactions.
List active markets#
seesaw api markets
Get detailed market info#
seesaw api market Mkt1abc123def456ghi789jkl012mno345pqr678stu
View the leaderboard#
# Weekly PnL leaderboard
seesaw api leaderboard --period weekly --metric pnl
# All-time win rate
seesaw api leaderboard --period allTime --metric winRate
# Daily volume leaders
seesaw api leaderboard --period daily --metric volume
Check protocol stats#
seesaw api stats
View personal stats (requires auth)#
export SEESAW_API_TOKEN=eyJhbGci...
seesaw api stats-personal
Check your jurisdiction attestation and trading limits#
These commands sign the indexer's wallet-authentication message with your keypair.
seesaw compliance attestation
seesaw compliance limits
5. Admin Operations#
Goal: Initialize and tune the on-chain protocol config — fee parameters, tick size, emergency pause/unpause — using the authority keypair.
Step 1: Initialize the protocol#
This is a one-time operation that creates the on-chain config account. The current multi-fee-recipient layout requires all 8 protocol treasury token accounts up front.
seesaw --keypair /path/to/authority-keypair.json admin init \
--treasury-recipients '[
"TreasuryShard111111111111111111111111111",
"TreasuryShard222222222222222222222222222",
"TreasuryShard333333333333333333333333333",
"TreasuryShard444444444444444444444444444",
"TreasuryShard555555555555555555555555555",
"TreasuryShard666666666666666666666666666",
"TreasuryShard777777777777777777777777777",
"TreasuryShard888888888888888888888888888"
]' \
--settlement-mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB \
--program-data ProgramDataAddr123456789abcdefghijklmnop \
--tick-size 100
Step 2: Verify the config#
seesaw config get
Step 3: Retune the fee curve#
Set the taker fee coefficient to 450 bps with a five-way allocation of 45% protocol, 5% creator, 5% referral, 5% builder, and 40% eligible maker.
<!-- src: program/src/logic/fee.rs:187 FeeSplit5::TARGET --> <!-- src: packages/cli/src/commands/admin/index.ts:651 update-fee-config -->seesaw --keypair /path/to/authority-keypair.json admin update-fee-config \
--taker-fee-coefficient 450 \
--protocol-share 4500 \
--creator-share 500 \
--referral-share 500 \
--builder-share 500 \
--maker-rebate-share 4000 \
--maker-rebate-min-rest-seconds 10
The five shares are bps of the total fee and must sum to 10_000. The coefficient accepts 0 through 10,000 bps.
Step 4: Update tick size#
Reduce the minimum price increment from 100 bps to 50 bps for finer price granularity:
seesaw --keypair /path/to/authority-keypair.json admin update-tick-size \
--tick-size 50
Step 5: Emergency pause#
If an issue is detected, pause all trading:
seesaw --keypair /path/to/authority-keypair.json admin pause
Verify the protocol is paused:
seesaw config get
Step 6: Resume trading#
After the issue is resolved:
seesaw --keypair /path/to/authority-keypair.json admin unpause
6. Referral Program#
Goal: Attribute taker fees to a referrer at order time and claim accumulated referral earnings — demonstrating the first-touch lock, the earnings-account initialization, and the claim flow.
Step 1: Set your referrer#
First-touch attribution is immutable for 365 days. CLI order submission still needs the explicit referrer address and the referrer's treasury shard so it can append the required referral accounts.
seesaw fee set-referrer \
--referrer RefAddr123456789abcdefghijklmnopqrstuvwxyz
Step 2: (Referrer) Create the earnings account#
Run once per referrer, permissionless. Use the same --treasury-index when
placing referred orders and claiming referral earnings.
seesaw fee init-referral-account \
--treasury-index 3 \
--mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
Step 3: Trade with explicit referral accounts#
Every subsequent taker fill can attribute the configured referral share (5% at
shipped defaults) to an eligible referrer as a deferred market liability, later
rolled up to ReferrerEarningsAccount. You still pay the same total fee.
Eligible makers separately earn the maker rebate in free quote balance;
ineligible maker allocation and rounding dust go to protocol. See
fee constants.
seesaw order place \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--outcome yes \
--intent buy \
--price 5000 \
--quantity 1000000 \
--protocol-treasury-index 3 \
--token-account ATA1abc123def456ghi789jkl012mno345pqr678stu \
--settlement-mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB \
--user-yes-ata YesATA1abc123def456ghi789jkl012mno345pqr6 \
--user-no-ata NoATA1abc123def456ghi789jkl012mno345pqr67 \
--referrer RefAddr123456789abcdefghijklmnopqrstuvwxyz
Step 4: (Referrer) Claim accumulated earnings#
Permissionless. Funds always route to the referrer regardless of caller.
seesaw fee claim-referral \
--ata RefATA123456789abcdefghijklmnopqrstuvwxyz \
--mint Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB \
--treasury-index 3