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 Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD \
--pyth-feed-id ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d \
--settlement-mint EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--duration 900 \
--oracle-mode push
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.
To create a Pull market, use --oracle-mode pull and pass a Receiver-owned
PriceUpdateV2 account as --pyth-feed; keep Hermes bearer access on a
server-side relay configured with PYTH_API_KEY.
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 EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
Step 3: Place a sell order#
Sell the NO shares you do not want, effectively taking a YES position:
seesaw order place \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--side sell-no \
--price 4500 \
--quantity 1000000 \
--token-account ATA1abc123def456ghi789jkl012mno345pqr678stu \
--treasury-token-account TreasuryShard111111111111111111111111111 \
--settlement-mint EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--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 \
--pyth-feed Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD \
--pyth-feed-id ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d \
--creator Cre8orAddr123456789abcdefghijklmnopqrstuv \
--duration 900
Step 6: Resolve the market#
seesaw market resolve \
--market-id 112640 \
--pyth-feed-id ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d \
--creator Cre8orAddr123456789abcdefghijklmnopqrstuv \
--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 EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
Step 8: Close the market#
Reclaim rent after all positions are settled:
seesaw market close \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--creator Cre8orAddr123456789abcdefghijklmnopqrstuv
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 EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
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 \
--creator Cre8orAddr123456789abcdefghijklmnopqrstuv
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 EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
Step 3: Place a bid (buy YES)#
seesaw order place \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--side buy-yes \
--price 4800 \
--quantity 2000000 \
--token-account ATA1abc123def456ghi789jkl012mno345pqr678stu \
--treasury-token-account TreasuryShard111111111111111111111111111 \
--settlement-mint EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--user-yes-ata YesATA1abc123def456ghi789jkl012mno345pqr6 \
--user-no-ata NoATA1abc123def456ghi789jkl012mno345pqr67 \
--order-type post-only
Step 4: Place an ask (sell YES)#
seesaw order place \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--side sell-yes \
--price 5200 \
--quantity 2000000 \
--token-account ATA1abc123def456ghi789jkl012mno345pqr678stu \
--treasury-token-account TreasuryShard111111111111111111111111111 \
--settlement-mint EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--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 EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--user-yes-ata YesATA1abc123def456ghi789jkl012mno345pqr6 \
--user-no-ata NoATA1abc123def456ghi789jkl012mno345pqr67
# Place a tighter bid
seesaw order place \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--side buy-yes \
--price 4900 \
--quantity 2000000 \
--token-account ATA1abc123def456ghi789jkl012mno345pqr678stu \
--treasury-token-account TreasuryShard111111111111111111111111111 \
--settlement-mint EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--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 all_time --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
Run a compliance check#
seesaw api compliance-check \
--address User1abc123def456ghi789jkl012mno345pqr678s \
--token eyJhbGci...
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#
Lower the cap to 1.50% and soften the decay slope to 4.50% while keeping the 50/10/40 split:
seesaw --keypair /path/to/authority-keypair.json admin update-fee-config \
--fee-cap 150 \
--decay-rate 450 \
--protocol-share 5000 \
--creator-share 1000 \
--referral-share 4000
The three shares are bps of the total fee and MUST sum to exactly 10_000. --fee-cap is bounded at 500 (5.00% hard ceiling).
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 40% of the taker fee to your
referrer's ReferrerEarningsAccount. You still pay the same total fee.
seesaw order place \
--market Mkt1abc123def456ghi789jkl012mno345pqr678stu \
--side buy-yes \
--price 5000 \
--quantity 1000000 \
--token-account ATA1abc123def456ghi789jkl012mno345pqr678stu \
--treasury-token-account TreasuryShard111111111111111111111111111 \
--settlement-mint EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--user-yes-ata YesATA1abc123def456ghi789jkl012mno345pqr6 \
--user-no-ata NoATA1abc123def456ghi789jkl012mno345pqr67 \
--referrer RefAddr123456789abcdefghijklmnopqrstuvwxyz \
--referrer-treasury-index 3
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