Program reference
Program id: B6SNWEda1wfQbrw1Yd9m3166ojpyX4ANiARrWeVPAKFH (Anchor 1.2.1, SBPF v3). The quote token is USDC.
Accounts and seeds
| Account | Seeds | What it holds |
|---|---|---|
| Config | "config" |
admin, keeper, quote and stake mints and vaults, batch timing, fee and split, bond, reward accumulator, treasury share |
| Vault authority | "vault" |
no data; owns every vault token account (associated token accounts of each mint) |
| Market | "market", id |
base mint, decimals and token program, base vault, pool, pool kind (0 Orca Whirlpool, 1 Raydium CLMM), guard, enabled |
| Balance | "bal", owner, mint |
free and locked amounts of one mint for one owner |
| Batch | "batch", id (u64 le) |
commit count, open orders, and per market: samples, mean inputs, price, state, book totals, matched notional |
| Order | "order", commitment |
owner, batch, commitment, status, and once opened: market, side, amount; the ciphertext until it opens |
| StakePosition | "stake", owner |
staked $BPOOL and reward debt |
The commitment
sha256(owner (32) || batch (u64 le) || market (u8) || side (u8, 0 buy, 1 sell) || amount (u64 le) || limit (u128 le, Q64.64 quote per base, raw units) || salt (32))
Buy amounts are in USDC raw units (fee included), sell amounts in the base token's raw units.
Instructions
| Instruction | Who | What it does |
|---|---|---|
initialize |
upgrade authority | creates Config and the USDC vault |
add_market, update_market |
admin | adds a market after checking the pool trades its base against USDC; enables, disables, sets the guard |
set_commits_paused, set_keeper, set_admin |
admin | pauses new orders, sets the keeper address, hands over admin |
set_stake_mint |
admin, once | sets $BPOOL as the stake token, forever |
withdraw_treasury |
admin | withdraws the treasury share of fees, never a user balance |
open_balance, deposit, withdraw |
owner | opens a balance, moves tokens in or out |
commit |
owner | posts a hidden order and its 0.10 USDC bond |
poke |
anyone | samples pool prices for the current batch |
reveal |
anyone with the preimage | opens an order, fixes the batch price on the first reveal of a market |
finalize |
anyone | computes the matched notional of a market once the reveal window is over |
claim |
anyone | applies a live order's fill and closes it |
forfeit |
anyone | closes an order nobody opened in time; its bond becomes fees |
close_batch |
anyone | closes a settled batch, rent back to whoever opened it |
stake, unstake, claim_rewards |
owner | $BPOOL staking, rewards in USDC |
Events
Committed, Priced (batch, market, price, samples, void), Revealed (outcome: 0 sat out, 1 live, 2 bond kept), Finalized (price, matched, book totals), Filled (base, quote, fee, refund per order), Forfeited.
