{ "address": "Anyy78cCJqapwvvFsignmQ45an5PCg9HfeDhDtAPNfmA", "metadata": { "name": "trading", "version": "0.1.0", "spec": "0.1.0", "description": "Continuum trading accounts: Hyperliquid-style trade-only session keys over Manifest order books" }, "instructions": [ { "name": "claim_rebate", "docs": [ "Pay what the position has earned into the trader's own cUSDC account." ], "discriminator": [ 180, 77, 169, 215, 170, 162, 242, 1 ], "accounts": [ { "name": "authority", "signer": true }, { "name": "account", "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "account.owner", "account": "TradingRules" } ] } }, { "name": "trader", "relations": [ "account" ] }, { "name": "mr_market" }, { "name": "clp", "pda": { "seeds": [ { "kind": "const", "value": [ 99, 108, 112 ] }, { "kind": "account", "path": "mr_market" } ], "program": { "kind": "const", "value": [ 118, 63, 21, 136, 120, 75, 251, 217, 141, 83, 221, 151, 158, 38, 87, 206, 12, 129, 179, 110, 131, 178, 220, 187, 250, 67, 198, 105, 252, 252, 75, 71 ] } } }, { "name": "rebate", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 114, 101, 98, 97, 116, 101 ] }, { "kind": "account", "path": "mr_market" } ] } }, { "name": "position", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 114, 101, 98, 97, 116, 101, 95, 112, 111, 115 ] }, { "kind": "account", "path": "mr_market" }, { "kind": "account", "path": "trader" } ] } }, { "name": "pot", "writable": true }, { "name": "trader_usdc", "writable": true }, { "name": "token_program", "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" } ], "args": [] }, { "name": "claim_seat", "docs": [ "Claim the trader's seat on a market, which Manifest needs before", "deposits and resting orders. The trader PDA pays the rent. A session key", "may only claim a seat on the market's canonical book: the first remaining", "account must be its CanonicalBooks." ], "discriminator": [ 47, 217, 3, 139, 51, 238, 55, 107 ], "accounts": [ { "name": "authority", "signer": true }, { "name": "account", "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "account.owner", "account": "TradingRules" } ] } }, { "name": "trader", "writable": true, "relations": [ "account" ] }, { "name": "market", "writable": true }, { "name": "mr_market", "docs": [ "The Continuum market whose token this book trades." ] }, { "name": "manifest_program", "address": "MNFSTqtC93rEfYHB6hF82sKdZpUDFWkViLByLd1k1Ms" }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [] }, { "name": "close_account", "docs": [ "Close the trading account and return all its rent to the owner. Owner", "only. Remaining accounts are the trader's token accounts to close: each", "must be its associated token account and empty. The trader's SOL and the", "rules account's rent go to the owner too. Book seats stay with Manifest,", "which cannot release them; they work again if the account is reopened,", "as does anything still in them." ], "discriminator": [ 125, 255, 149, 14, 110, 34, 72, 24 ], "accounts": [ { "name": "owner", "writable": true, "signer": true, "relations": [ "account" ] }, { "name": "account", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "owner" } ] } }, { "name": "trader", "writable": true, "relations": [ "account" ] }, { "name": "token_program", "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [] }, { "name": "commit_order", "docs": [ "Commit an order from the trading account. It fills at the next official", "price, or after its time to live anyone can refund it; either way the", "tokens and the rent come back to the trader PDA, never anywhere else.", "A session-signed commit counts against the session's budget (a buy at", "its cUSDC, a sale at the NAV of what it sells) and needs an active market." ], "discriminator": [ 106, 167, 189, 186, 74, 113, 139, 232 ], "accounts": [ { "name": "authority", "signer": true }, { "name": "account", "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "account.owner", "account": "TradingRules" } ] } }, { "name": "trader", "writable": true, "relations": [ "account" ] }, { "name": "mr_market" }, { "name": "clp" }, { "name": "order", "writable": true }, { "name": "in_mint" }, { "name": "out_mint" }, { "name": "escrow", "writable": true }, { "name": "trader_in", "writable": true }, { "name": "trader_out" }, { "name": "clp_vault" }, { "name": "token_program", "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" }, { "name": "system_program", "address": "11111111111111111111111111111111" }, { "name": "clp_program", "address": "8xauDRjw9XRyk4FE3hW1JKjD8nC87gfr59Xig1dJqLES" } ], "args": [ { "name": "params", "type": { "defined": { "name": "CommitArgs" } } } ] }, { "name": "deposit", "docs": [ "Move tokens from the owner's wallet into the trading account." ], "discriminator": [ 242, 35, 198, 137, 82, 225, 242, 182 ], "accounts": [ { "name": "owner", "signer": true, "relations": [ "account" ] }, { "name": "account", "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "owner" } ] } }, { "name": "trader", "relations": [ "account" ] }, { "name": "owner_token", "docs": [ "The owner's own associated token account for this mint." ], "writable": true }, { "name": "trader_token", "docs": [ "The trader PDA's associated token account for this mint." ], "writable": true }, { "name": "token_program", "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" } ], "args": [ { "name": "params", "type": { "defined": { "name": "AmountParams" } } } ] }, { "name": "deposit_to_market", "docs": [ "Move tokens from the trader's token account into its seat on a market." ], "discriminator": [ 197, 176, 80, 94, 231, 143, 169, 139 ], "accounts": [ { "name": "authority", "signer": true }, { "name": "account", "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "account.owner", "account": "TradingRules" } ] } }, { "name": "trader", "writable": true, "relations": [ "account" ] }, { "name": "market", "writable": true }, { "name": "mr_market" }, { "name": "trader_token", "docs": [ "The trader PDA's associated token account for this mint." ], "writable": true }, { "name": "vault", "writable": true }, { "name": "mint" }, { "name": "token_program", "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" }, { "name": "manifest_program", "address": "MNFSTqtC93rEfYHB6hF82sKdZpUDFWkViLByLd1k1Ms" } ], "args": [ { "name": "params", "type": { "defined": { "name": "AmountParams" } } } ] }, { "name": "fund_rebate", "docs": [ "Put harvested collateral yield into the pot. CLP authority only. Counted in", "the realised yield that caps the rate, so it must only ever carry yield." ], "discriminator": [ 92, 28, 88, 58, 204, 106, 236, 124 ], "accounts": [ { "name": "authority", "signer": true }, { "name": "mr_market" }, { "name": "clp", "pda": { "seeds": [ { "kind": "const", "value": [ 99, 108, 112 ] }, { "kind": "account", "path": "mr_market" } ], "program": { "kind": "const", "value": [ 118, 63, 21, 136, 120, 75, 251, 217, 141, 83, 221, 151, 158, 38, 87, 206, 12, 129, 179, 110, 131, 178, 220, 187, 250, 67, 198, 105, 252, 252, 75, 71 ] } } }, { "name": "rebate", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 114, 101, 98, 97, 116, 101 ] }, { "kind": "account", "path": "mr_market" } ] } }, { "name": "pot", "writable": true }, { "name": "from", "writable": true }, { "name": "token_program", "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" } ], "args": [ { "name": "params", "type": { "defined": { "name": "AmountParams" } } } ] }, { "name": "init_rebate_market", "docs": [ "Open a market's rebate state and its cUSDC pot. CLP authority only." ], "discriminator": [ 43, 67, 140, 185, 217, 4, 10, 109 ], "accounts": [ { "name": "authority", "writable": true, "signer": true }, { "name": "mr_market" }, { "name": "clp", "pda": { "seeds": [ { "kind": "const", "value": [ 99, 108, 112 ] }, { "kind": "account", "path": "mr_market" } ], "program": { "kind": "const", "value": [ 118, 63, 21, 136, 120, 75, 251, 217, 141, 83, 221, 151, 158, 38, 87, 206, 12, 129, 179, 110, 131, 178, 220, 187, 250, 67, 198, 105, 252, 252, 75, 71 ] } } }, { "name": "rebate", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 114, 101, 98, 97, 116, 101 ] }, { "kind": "account", "path": "mr_market" } ] } }, { "name": "pot", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 114, 101, 98, 97, 116, 101, 95, 112, 111, 116 ] }, { "kind": "account", "path": "mr_market" } ] } }, { "name": "collateral_mint" }, { "name": "token_program", "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [] }, { "name": "open_account", "docs": [ "Create the owner's trading account. The trader PDA needs no account of", "its own; the owner funds it with SOL for Manifest seat rent." ], "discriminator": [ 101, 152, 91, 243, 176, 36, 189, 101 ], "accounts": [ { "name": "owner", "writable": true, "signer": true }, { "name": "account", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "owner" } ] } }, { "name": "trader", "pda": { "seeds": [ { "kind": "const", "value": [ 116, 114, 97, 100, 101, 114 ] }, { "kind": "account", "path": "owner" } ] } }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [] }, { "name": "open_account_paid", "docs": [ "Create a trading account for an owner that cannot pay rent itself: a", "program's PDA, signing through invoke_signed (the CLP's pool, which", "quotes on the books through its own account). `payer` funds the rules", "account and owns nothing in it. Everything else is the same account:", "deposits come from, and withdrawals go to, the owner's own token", "accounts, and a session key may only trade inside the band." ], "discriminator": [ 254, 65, 74, 133, 8, 114, 9, 145 ], "accounts": [ { "name": "payer", "writable": true, "signer": true }, { "name": "owner", "signer": true }, { "name": "account", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "owner" } ] } }, { "name": "trader", "pda": { "seeds": [ { "kind": "const", "value": [ 116, 114, 97, 100, 101, 114 ] }, { "kind": "account", "path": "owner" } ] } }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [] }, { "name": "open_rebate_position", "docs": [ "Create a trader's empty position and vault for a market. Anyone may pay." ], "discriminator": [ 27, 225, 17, 65, 182, 31, 204, 61 ], "accounts": [ { "name": "payer", "writable": true, "signer": true }, { "name": "account", "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "account.owner", "account": "TradingRules" } ] } }, { "name": "trader", "relations": [ "account" ] }, { "name": "mr_market" }, { "name": "rebate", "pda": { "seeds": [ { "kind": "const", "value": [ 114, 101, 98, 97, 116, 101 ] }, { "kind": "account", "path": "mr_market" } ] } }, { "name": "position", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 114, 101, 98, 97, 116, 101, 95, 112, 111, 115 ] }, { "kind": "account", "path": "mr_market" }, { "kind": "account", "path": "trader" } ] } }, { "name": "vault", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 114, 101, 98, 97, 116, 101, 95, 118, 97, 117, 108, 116 ] }, { "kind": "account", "path": "mr_market" }, { "kind": "account", "path": "trader" } ] } }, { "name": "short_mint" }, { "name": "token_program", "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [] }, { "name": "place_orders", "docs": [ "Cancel and place resting orders from the seat's balance. Session-signed", "orders must be priced inside the band, under the per-order limit and", "within the session's budget, on the market's canonical book of an active", "market. Remaining accounts may carry up to two global groups (see", "manifest::GlobalGroup), so orders can fill makers' global orders; a", "session-signed call puts the market's CanonicalBooks before them." ], "discriminator": [ 60, 63, 50, 123, 12, 197, 60, 190 ], "accounts": [ { "name": "authority", "signer": true }, { "name": "account", "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "account.owner", "account": "TradingRules" } ] } }, { "name": "trader", "writable": true, "relations": [ "account" ] }, { "name": "market", "writable": true }, { "name": "mr_market" }, { "name": "manifest_program", "address": "MNFSTqtC93rEfYHB6hF82sKdZpUDFWkViLByLd1k1Ms" }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [ { "name": "params", "type": { "defined": { "name": "OrdersParams" } } } ] }, { "name": "refresh_rebate", "docs": [ "Permissionless crank: accrue the index, then re-measure traders' net", "position against the cap (remaining accounts: the exposure inventory) and", "the realised yield, and set the rate." ], "discriminator": [ 8, 159, 42, 197, 58, 204, 124, 107 ], "accounts": [ { "name": "mr_market" }, { "name": "clp", "pda": { "seeds": [ { "kind": "const", "value": [ 99, 108, 112 ] }, { "kind": "account", "path": "mr_market" } ], "program": { "kind": "const", "value": [ 118, 63, 21, 136, 120, 75, 251, 217, 141, 83, 221, 151, 158, 38, 87, 206, 12, 129, 179, 110, 131, 178, 220, 187, 250, 67, 198, 105, 252, 252, 75, 71 ] } } }, { "name": "rebate", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 114, 101, 98, 97, 116, 101 ] }, { "kind": "account", "path": "mr_market" } ] } } ], "args": [] }, { "name": "revoke_session", "docs": [ "Revoke the session key at once. Owner only." ], "discriminator": [ 86, 92, 198, 120, 144, 2, 7, 194 ], "accounts": [ { "name": "owner", "signer": true, "relations": [ "account" ] }, { "name": "account", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "owner" } ] } } ], "args": [] }, { "name": "set_canonical_books", "docs": [ "Set (or replace) the Manifest books a session key may trade for a", "Continuum market, one per side. The trading program's upgrade authority", "only; it pays the record's rent the first time. Each book's header must", "trade that side's token for the market's collateral." ], "discriminator": [ 236, 168, 170, 200, 240, 229, 81, 63 ], "accounts": [ { "name": "authority", "writable": true, "signer": true }, { "name": "mr_market" }, { "name": "books", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 99, 97, 110, 111, 110, 105, 99, 97, 108, 95, 98, 111, 111, 107, 115 ] }, { "kind": "account", "path": "mr_market" } ] } }, { "name": "long_book" }, { "name": "short_book" }, { "name": "program", "address": "Anyy78cCJqapwvvFsignmQ45an5PCg9HfeDhDtAPNfmA" }, { "name": "program_data" }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [] }, { "name": "set_session", "docs": [ "Grant (or replace) the session key, with its per-order limit and total", "budget, and start the budget afresh. Owner only." ], "discriminator": [ 156, 135, 126, 111, 184, 206, 194, 141 ], "accounts": [ { "name": "owner", "signer": true, "relations": [ "account" ] }, { "name": "account", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "owner" } ] } } ], "args": [ { "name": "params", "type": { "defined": { "name": "SessionParams" } } } ] }, { "name": "stake_rebate", "docs": [ "Move S from the trader's token account into its rebate vault. The owner,", "the session key or the keeper (CLP authority)." ], "discriminator": [ 131, 246, 107, 46, 40, 87, 210, 55 ], "accounts": [ { "name": "authority", "signer": true }, { "name": "account", "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "account.owner", "account": "TradingRules" } ] } }, { "name": "trader", "relations": [ "account" ] }, { "name": "mr_market" }, { "name": "clp", "pda": { "seeds": [ { "kind": "const", "value": [ 99, 108, 112 ] }, { "kind": "account", "path": "mr_market" } ], "program": { "kind": "const", "value": [ 118, 63, 21, 136, 120, 75, 251, 217, 141, 83, 221, 151, 158, 38, 87, 206, 12, 129, 179, 110, 131, 178, 220, 187, 250, 67, 198, 105, 252, 252, 75, 71 ] } } }, { "name": "rebate", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 114, 101, 98, 97, 116, 101 ] }, { "kind": "account", "path": "mr_market" } ] } }, { "name": "position", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 114, 101, 98, 97, 116, 101, 95, 112, 111, 115 ] }, { "kind": "account", "path": "mr_market" }, { "kind": "account", "path": "trader" } ] } }, { "name": "vault", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 114, 101, 98, 97, 116, 101, 95, 118, 97, 117, 108, 116 ] }, { "kind": "account", "path": "mr_market" }, { "kind": "account", "path": "trader" } ] } }, { "name": "trader_short", "writable": true }, { "name": "token_program", "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" } ], "args": [ { "name": "params", "type": { "defined": { "name": "AmountParams" } } } ] }, { "name": "swap_pool", "docs": [ "Swap on the CLP's bin book from the trading account. The book trades", "only while the market floats; the CLP enforces that. A session-signed", "swap must fill inside the band, judged on what actually moved, so a", "stolen key cannot force a fill deep into the book, and it counts against", "the session's budget (a buy at the cUSDC paid, a sale at the NAV of what", "was sold). The pool needs no canonical-books check: the CLP's pool_swap", "requires it to be the CLP's own [b\"pool\", market, side] PDA, which only", "the CLP admin can create.", "Remaining accounts are passed through to the CLP's `pool_swap`: when the", "market is capped, the pool long/short synth vaults then the CLP's long/short", "token accounts (the exposure cap's inventory, r63)." ], "discriminator": [ 217, 231, 109, 45, 255, 31, 195, 220 ], "accounts": [ { "name": "authority", "signer": true }, { "name": "account", "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "account.owner", "account": "TradingRules" } ] } }, { "name": "trader", "relations": [ "account" ] }, { "name": "trader_usdc", "writable": true }, { "name": "trader_synth", "writable": true }, { "name": "pool", "writable": true }, { "name": "clp", "writable": true }, { "name": "synth_vault", "writable": true }, { "name": "usdc_vault", "writable": true }, { "name": "revenue_attribution", "writable": true }, { "name": "mr_market" }, { "name": "synth_mint" }, { "name": "usdc_mint" }, { "name": "token_program", "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" }, { "name": "clp_program", "address": "8xauDRjw9XRyk4FE3hW1JKjD8nC87gfr59Xig1dJqLES" } ], "args": [ { "name": "params", "type": { "defined": { "name": "PoolSwapArgs" } } } ] }, { "name": "unstake_rebate", "docs": [ "Move staked S back to the trader's token account. The owner or the session key." ], "discriminator": [ 57, 44, 44, 220, 175, 78, 178, 153 ], "accounts": [ { "name": "authority", "signer": true }, { "name": "account", "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "account.owner", "account": "TradingRules" } ] } }, { "name": "trader", "relations": [ "account" ] }, { "name": "mr_market" }, { "name": "clp", "pda": { "seeds": [ { "kind": "const", "value": [ 99, 108, 112 ] }, { "kind": "account", "path": "mr_market" } ], "program": { "kind": "const", "value": [ 118, 63, 21, 136, 120, 75, 251, 217, 141, 83, 221, 151, 158, 38, 87, 206, 12, 129, 179, 110, 131, 178, 220, 187, 250, 67, 198, 105, 252, 252, 75, 71 ] } } }, { "name": "rebate", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 114, 101, 98, 97, 116, 101 ] }, { "kind": "account", "path": "mr_market" } ] } }, { "name": "position", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 114, 101, 98, 97, 116, 101, 95, 112, 111, 115 ] }, { "kind": "account", "path": "mr_market" }, { "kind": "account", "path": "trader" } ] } }, { "name": "vault", "writable": true, "pda": { "seeds": [ { "kind": "const", "value": [ 114, 101, 98, 97, 116, 101, 95, 118, 97, 117, 108, 116 ] }, { "kind": "account", "path": "mr_market" }, { "kind": "account", "path": "trader" } ] } }, { "name": "trader_short", "writable": true }, { "name": "token_program", "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" } ], "args": [ { "name": "params", "type": { "defined": { "name": "AmountParams" } } } ] }, { "name": "withdraw", "docs": [ "Move tokens from the trading account back to the owner's wallet. The", "owner or the session key may sign: the only destination is the owner's", "own associated token account, so a stolen key cannot take anything." ], "discriminator": [ 183, 18, 70, 156, 148, 109, 161, 34 ], "accounts": [ { "name": "authority", "signer": true }, { "name": "account", "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "account.owner", "account": "TradingRules" } ] } }, { "name": "trader", "relations": [ "account" ] }, { "name": "owner_token", "docs": [ "The owner's own associated token account for this mint." ], "writable": true }, { "name": "trader_token", "docs": [ "The trader PDA's associated token account for this mint." ], "writable": true }, { "name": "token_program", "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" } ], "args": [ { "name": "params", "type": { "defined": { "name": "AmountParams" } } } ] }, { "name": "withdraw_from_market", "docs": [ "Move tokens from the trader's seat on a market back to its token account." ], "discriminator": [ 170, 89, 125, 57, 13, 46, 169, 160 ], "accounts": [ { "name": "authority", "signer": true }, { "name": "account", "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "account.owner", "account": "TradingRules" } ] } }, { "name": "trader", "writable": true, "relations": [ "account" ] }, { "name": "market", "writable": true }, { "name": "mr_market" }, { "name": "trader_token", "docs": [ "The trader PDA's associated token account for this mint." ], "writable": true }, { "name": "vault", "writable": true }, { "name": "mint" }, { "name": "token_program", "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" }, { "name": "manifest_program", "address": "MNFSTqtC93rEfYHB6hF82sKdZpUDFWkViLByLd1k1Ms" } ], "args": [ { "name": "params", "type": { "defined": { "name": "AmountParams" } } } ] }, { "name": "withdraw_sol", "docs": [ "Return SOL the trader PDA holds for rent to the owner. Owner only. The", "PDA must keep its rent-exempt minimum unless emptied completely." ], "discriminator": [ 145, 131, 74, 136, 65, 137, 42, 38 ], "accounts": [ { "name": "owner", "writable": true, "signer": true, "relations": [ "account" ] }, { "name": "account", "pda": { "seeds": [ { "kind": "const", "value": [ 97, 99, 99, 111, 117, 110, 116 ] }, { "kind": "account", "path": "owner" } ] } }, { "name": "trader", "writable": true, "relations": [ "account" ] }, { "name": "system_program", "address": "11111111111111111111111111111111" } ], "args": [ { "name": "params", "type": { "defined": { "name": "AmountParams" } } } ] } ], "accounts": [ { "name": "CanonicalBooks", "discriminator": [ 218, 154, 232, 101, 250, 197, 191, 33 ] }, { "name": "Clp", "discriminator": [ 158, 129, 72, 4, 111, 37, 48, 111 ] }, { "name": "Market", "discriminator": [ 219, 190, 213, 55, 0, 227, 198, 154 ] }, { "name": "Pool", "discriminator": [ 241, 154, 109, 4, 17, 177, 109, 188 ] }, { "name": "RebateMarket", "discriminator": [ 242, 229, 10, 107, 103, 87, 137, 201 ] }, { "name": "RebatePosition", "discriminator": [ 154, 143, 72, 20, 162, 50, 120, 169 ] }, { "name": "TradingRules", "discriminator": [ 242, 5, 25, 218, 122, 189, 174, 179 ] } ], "events": [ { "name": "AccountClosed", "discriminator": [ 19, 250, 79, 236, 91, 80, 148, 48 ] }, { "name": "AccountOpened", "discriminator": [ 250, 89, 39, 67, 35, 119, 126, 63 ] }, { "name": "CanonicalBooksSet", "discriminator": [ 209, 22, 6, 113, 123, 32, 41, 137 ] }, { "name": "CommitPlaced", "discriminator": [ 64, 246, 131, 20, 154, 99, 147, 190 ] }, { "name": "Deposited", "discriminator": [ 111, 141, 26, 45, 161, 35, 100, 57 ] }, { "name": "MarketFundsMoved", "discriminator": [ 59, 190, 119, 4, 205, 113, 18, 50 ] }, { "name": "OrdersPlaced", "discriminator": [ 15, 255, 2, 69, 167, 241, 20, 254 ] }, { "name": "PoolTraded", "discriminator": [ 102, 252, 51, 243, 227, 8, 113, 78 ] }, { "name": "RebateClaimed", "discriminator": [ 225, 106, 198, 84, 60, 69, 42, 135 ] }, { "name": "RebateFunded", "discriminator": [ 187, 119, 179, 136, 146, 34, 252, 64 ] }, { "name": "RebateMarketOpened", "discriminator": [ 99, 143, 72, 180, 229, 110, 34, 112 ] }, { "name": "RebateRefreshed", "discriminator": [ 255, 101, 155, 45, 76, 249, 200, 46 ] }, { "name": "RebateStaked", "discriminator": [ 224, 162, 131, 190, 223, 189, 71, 70 ] }, { "name": "RebateUnstaked", "discriminator": [ 192, 182, 46, 143, 216, 55, 23, 82 ] }, { "name": "SessionRevoked", "discriminator": [ 90, 48, 35, 234, 203, 192, 126, 211 ] }, { "name": "SessionSet", "discriminator": [ 217, 40, 191, 250, 153, 135, 184, 144 ] }, { "name": "Withdrawn", "discriminator": [ 20, 89, 223, 198, 194, 124, 219, 13 ] } ], "errors": [ { "code": 6000, "name": "NotAuthorized", "msg": "Signer is neither the owner nor the account's active session key" }, { "code": 6001, "name": "OwnerOnly", "msg": "Only the owner can do this" }, { "code": 6002, "name": "SessionExpired", "msg": "The session key has expired or was revoked" }, { "code": 6003, "name": "InvalidExpiry", "msg": "Session expiry must be in the future and at most 30 days away" }, { "code": 6004, "name": "OrderTooLarge", "msg": "Order is larger than the session's per-order limit" }, { "code": 6005, "name": "WrongTokenAccount", "msg": "Token account is not the trading account's own" }, { "code": 6006, "name": "NotAManifestMarket", "msg": "Account is not a Manifest market" }, { "code": 6007, "name": "ZeroAmount", "msg": "Amount must be greater than zero" }, { "code": 6008, "name": "MathOverflow", "msg": "Arithmetic overflow" }, { "code": 6009, "name": "NotOurMarket", "msg": "That Manifest market does not trade this Continuum market's token for its collateral" }, { "code": 6010, "name": "NoReferencePrice", "msg": "The market has no posted price yet" }, { "code": 6011, "name": "OutsideBand", "msg": "Session-signed orders must be priced inside the band around the posted price" }, { "code": 6012, "name": "UnsupportedOrderType", "msg": "Only limit, immediate-or-cancel and post-only orders are supported" }, { "code": 6013, "name": "TooManyOrders", "msg": "Too many orders or cancels in one call" }, { "code": 6014, "name": "NotFilled", "msg": "Fill-or-kill order did not fill in full" }, { "code": 6015, "name": "InvalidFillOrKill", "msg": "Fill-or-kill takes one immediate-or-cancel order and no cancels" }, { "code": 6016, "name": "NoSeat", "msg": "The trader has no seat on this market" }, { "code": 6017, "name": "InvalidDirection", "msg": "Direction must be 0 (buy) or 1 (sell)" }, { "code": 6018, "name": "BadGlobalAccounts", "msg": "Global accounts must come in groups of mint, global, global vault, market vault and token program, for this market's mints" }, { "code": 6019, "name": "InsufficientStake", "msg": "Not that much S is staked" }, { "code": 6020, "name": "RebateFundingAboveYield", "msg": "The rebate pot can't be funded beyond the collateral yield the market has harvested since the rebate opened" }, { "code": 6021, "name": "SessionBudgetExceeded", "msg": "The session has used its budget; the owner must grant it again" }, { "code": 6022, "name": "SessionAccountReadOnly", "msg": "A session-signed trade must pass the trading account as writable, to record what the session has spent" }, { "code": 6023, "name": "CanonicalBooksMissing", "msg": "A session-signed book call must pass the market's canonical-books account first among the remaining accounts" }, { "code": 6024, "name": "NotCanonicalBook", "msg": "A session key may only use the market's canonical Manifest book" }, { "code": 6025, "name": "MarketNotActive", "msg": "A session key cannot trade a market that is not active" }, { "code": 6026, "name": "InvalidProgramData", "msg": "The program account does not match the program data account" }, { "code": 6027, "name": "NotUpgradeAuthority", "msg": "Only the trading program's upgrade authority can set the canonical books" } ], "types": [ { "name": "AccountClosed", "type": { "kind": "struct", "fields": [ { "name": "owner", "type": "pubkey" }, { "name": "token_accounts", "docs": [ "Token accounts closed, their rent paid to the owner." ], "type": "u8" }, { "name": "sol", "docs": [ "The trader's SOL paid to the owner." ], "type": "u64" } ] } }, { "name": "AccountOpened", "type": { "kind": "struct", "fields": [ { "name": "owner", "type": "pubkey" }, { "name": "account", "type": "pubkey" }, { "name": "trader", "type": "pubkey" } ] } }, { "name": "AmountParams", "type": { "kind": "struct", "fields": [ { "name": "amount", "type": "u64" } ] } }, { "name": "CancelOrder", "docs": [ "Borsh-identical to Manifest's `CancelOrderParams`." ], "type": { "kind": "struct", "fields": [ { "name": "order_sequence_number", "type": "u64" }, { "name": "order_index_hint", "type": { "option": "u32" } } ] } }, { "name": "CanonicalBooks", "docs": [ "The Manifest books a session key may trade for one Continuum market, one per", "side (0 long, 1 short), set by the trading program's upgrade authority. Owner", "signed calls may use any book for the market's tokens; session-signed ones", "only these (audit TR-3)." ], "type": { "kind": "struct", "fields": [ { "name": "mr_market", "type": "pubkey" }, { "name": "books", "type": { "array": [ "pubkey", 2 ] } }, { "name": "bump", "type": "u8" }, { "name": "reserved", "type": { "array": [ "u8", 32 ] } } ] } }, { "name": "CanonicalBooksSet", "type": { "kind": "struct", "fields": [ { "name": "mr_market", "type": "pubkey" }, { "name": "long_book", "type": "pubkey" }, { "name": "short_book", "type": "pubkey" } ] } }, { "name": "Clp", "docs": [ "Per-market CLP operational account.", "", "Seeds: `[b\"clp\", market_id]`", "", "After the global vault migration, this account no longer holds LP capital.", "It tracks market-specific operational state: inventory risk, yield deployments", "and vault pair-minting counters." ], "type": { "kind": "struct", "fields": [ { "name": "market_id", "type": "pubkey" }, { "name": "total_fees_collected", "type": "u64" }, { "name": "oi_cap", "type": "u64" }, { "name": "current_oi", "type": "u64" }, { "name": "bump", "type": "u8" }, { "name": "inventory_budget", "type": { "defined": { "name": "InventoryBudget" } } }, { "name": "inventory_state", "type": { "defined": { "name": "InventoryState" } } }, { "name": "yield_strategy", "type": { "defined": { "name": "YieldStrategyConfig" } } }, { "name": "oracle_config", "docs": [ "Oracle program config account for this market." ], "type": "pubkey" }, { "name": "deployment_count", "docs": [ "Number of active yield deployments" ], "type": "u8" }, { "name": "yield_deployments", "type": { "vec": { "defined": { "name": "YieldDeployment" } } } }, { "name": "total_deployed", "docs": [ "Total amount currently deployed for yield" ], "type": "u64" }, { "name": "authority", "type": "pubkey" }, { "name": "vault_l_deployed", "docs": [ "L tokens currently outstanding from vault minting." ], "type": "u64" }, { "name": "vault_s_deployed", "docs": [ "S tokens currently outstanding from vault minting." ], "type": "u64" }, { "name": "total_vault_pairs_minted", "docs": [ "Cumulative USDC used for vault pair minting (informational)." ], "type": "u64" }, { "name": "retired_venue_state", "docs": [ "RETIRED. 136 bytes that once held a fee counter (u64) and four account", "addresses (Pubkeys) for a liquidity venue the protocol no longer uses.", "Live accounts may still hold that stale data. Nothing reads or writes", "these bytes; they keep every later field at its offset. Zero them, or", "migrate them, before giving them any new meaning." ], "type": { "array": [ "u8", 136 ] } }, { "name": "allocated_from_global", "docs": [ "USDC currently allocated to this market's operating vault from GlobalClp.", "Incremented by allocate_to_market; decremented by vault_mint_pairs." ], "type": "u64" }, { "name": "swap_guards", "docs": [ "Swap guards / circuit-breaker config. Default (zeroed) = disabled." ], "type": { "defined": { "name": "SwapGuardsState" } } }, { "name": "swap_window_start", "docs": [ "Rolling notional-cap window: start time and cUSDC used so far." ], "type": "i64" }, { "name": "swap_window_used", "type": "u64" }, { "name": "swap_prev_price", "docs": [ "Last NAV accepted by a swap (for the deviation breaker; 0 = none yet)." ], "type": "u64" }, { "name": "commit_spread_bps", "docs": [ "Keeper-posted committed-order half-spread (bps), driven by the same vol", "model as the book. `settle_swap` uses max(this, COMMIT_SPREAD_BPS) so it", "never quotes thinner than the 10bps floor. 0 (unset/legacy) → floor.", "This is the lever that prices the protocol's short-convexity exposure on", "large committed fills (r38: flips a 20x asset from 99% bust → 0%)." ], "type": "u16" } ] } }, { "name": "CollateralType", "docs": [ "Collateral type identifier" ], "type": { "kind": "enum", "variants": [ { "name": "USDC" }, { "name": "USDT" }, { "name": "PYUSD" }, { "name": "USDe" }, { "name": "Other" } ] } }, { "name": "CollateralVault", "docs": [ "Individual collateral vault for a specific stablecoin", "Each stablecoin has its own vault for blast-radius containment" ], "type": { "kind": "struct", "fields": [ { "name": "mint", "docs": [ "Mint address of this collateral token" ], "type": "pubkey" }, { "name": "vault", "docs": [ "Vault token account address" ], "type": "pubkey" }, { "name": "collateral_type", "docs": [ "Type of collateral (for provenance)" ], "type": { "defined": { "name": "CollateralType" } } }, { "name": "total_deposited", "docs": [ "Total amount deposited in this vault" ], "type": "u64" }, { "name": "is_active", "docs": [ "Whether this vault is active for deposits" ], "type": "bool" }, { "name": "weight_bps", "docs": [ "Weight for collateral (100 = 1:1, 95 = 0.95:1 for riskier stables)" ], "type": "u16" } ] } }, { "name": "CommitArgs", "docs": [ "A committed order: it fills at the next official price or is refunded." ], "type": { "kind": "struct", "fields": [ { "name": "side", "docs": [ "0 long, 1 short." ], "type": "u8" }, { "name": "direction", "docs": [ "0 buys the token with cUSDC, 1 sells it for cUSDC." ], "type": "u8" }, { "name": "amount_in", "type": "u64" }, { "name": "min_out", "type": "u64" }, { "name": "nonce", "docs": [ "Any number the trader has not used on this market; it names the order." ], "type": "u64" } ] } }, { "name": "CommitPlaced", "type": { "kind": "struct", "fields": [ { "name": "owner", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "order", "type": "pubkey" }, { "name": "side", "type": "u8" }, { "name": "direction", "type": "u8" }, { "name": "amount_in", "type": "u64" }, { "name": "session", "type": "bool" } ] } }, { "name": "Deposited", "type": { "kind": "struct", "fields": [ { "name": "owner", "type": "pubkey" }, { "name": "mint", "type": "pubkey" }, { "name": "amount", "type": "u64" } ] } }, { "name": "InventoryBudget", "docs": [ "Inventory risk budget configuration", "q = fraction of treasury in volatile token" ], "type": { "kind": "struct", "fields": [ { "name": "soft_lower_bps", "docs": [ "Soft lower bound for volatile fraction (basis points, e.g., 1000 = 10%)" ], "type": "u16" }, { "name": "soft_upper_bps", "docs": [ "Soft upper bound for volatile fraction (basis points, e.g., 2500 = 25%)" ], "type": "u16" }, { "name": "hard_lower_bps", "docs": [ "Hard lower bound - emergency action if breached (basis points, e.g., 500 = 5%)" ], "type": "u16" }, { "name": "hard_upper_bps", "docs": [ "Hard upper bound - emergency action if breached (basis points, e.g., 3500 = 35%)" ], "type": "u16" }, { "name": "max_drawdown_bps", "docs": [ "Maximum allowed drawdown (basis points, e.g., 2000 = 20%)" ], "type": "u16" }, { "name": "target_drawdown_bps", "docs": [ "Target operating drawdown (basis points, e.g., 1200 = 12%)" ], "type": "u16" }, { "name": "enforce_hard_bounds", "docs": [ "Whether to enforce hard bounds (can pause operations)" ], "type": "bool" } ] } }, { "name": "InventoryState", "docs": [ "Current inventory state tracking" ], "type": { "kind": "struct", "fields": [ { "name": "volatile_value", "docs": [ "Current volatile token value in treasury (in USDC terms)" ], "type": "u64" }, { "name": "stable_value", "docs": [ "Current stable token value in treasury" ], "type": "u64" }, { "name": "current_q_bps", "docs": [ "Current q ratio (volatile / total) in basis points" ], "type": "u16" }, { "name": "peak_value", "docs": [ "Peak treasury value (for drawdown calculation)" ], "type": "u64" }, { "name": "current_drawdown_bps", "docs": [ "Current drawdown from peak (basis points)" ], "type": "u16" }, { "name": "soft_breach", "docs": [ "Whether we're in soft bound breach" ], "type": "bool" }, { "name": "hard_breach", "docs": [ "Whether we're in hard bound breach (emergency)" ], "type": "bool" }, { "name": "last_update", "docs": [ "Last update timestamp" ], "type": "i64" } ] } }, { "name": "Market", "type": { "kind": "struct", "fields": [ { "name": "authority", "type": "pubkey" }, { "name": "fee_recipient", "type": "pubkey" }, { "name": "asset_symbol", "type": "string" }, { "name": "oracle_address", "type": "pubkey" }, { "name": "oracle_type", "type": { "defined": { "name": "OracleType" } } }, { "name": "long_mint", "type": "pubkey" }, { "name": "short_mint", "type": "pubkey" }, { "name": "collateral_mint", "docs": [ "Primary collateral mint (legacy single-collateral mode)" ], "type": "pubkey" }, { "name": "collateral_vault", "docs": [ "Primary collateral vault (legacy)" ], "type": "pubkey" }, { "name": "multi_collateral_enabled", "docs": [ "Whether multi-collateral mode is enabled" ], "type": "bool" }, { "name": "collateral_vault_count", "docs": [ "Number of active collateral vaults" ], "type": "u8" }, { "name": "collateral_vaults", "docs": [ "Collateral vaults for multi-stable support" ], "type": { "vec": { "defined": { "name": "CollateralVault" } } } }, { "name": "initial_l_price", "docs": [ "Initial Long token price (used for Short NAV calculation)" ], "type": "u64" }, { "name": "initial_s_price", "docs": [ "Initial Short token price" ], "type": "u64" }, { "name": "mint_fee_bps", "docs": [ "Mint fee in basis points (e.g., 10 = 0.1%)" ], "type": "u16" }, { "name": "redeem_fee_bps", "docs": [ "Redeem fee in basis points" ], "type": "u16" }, { "name": "total_l_supply", "docs": [ "Total supply of Long tokens. Paired mint/redeem keeps this equal to", "`total_s_supply`; single-side keeper mint/redeem (`keeper_mint_single`,", "see lib.rs) intentionally moves only one side, so the two supplies can", "diverge, giving a first-order (directional) delta the γ decay does NOT charge." ], "type": "u64" }, { "name": "total_s_supply", "docs": [ "Total supply of Short tokens. Equal to `total_l_supply` under paired", "mint/redeem, but single-side keeper mint/redeem deliberately lets it", "diverge (see `total_l_supply` above)." ], "type": "u64" }, { "name": "total_collateral", "docs": [ "Total collateral locked (sum across all vaults)" ], "type": "u64" }, { "name": "is_active", "type": "bool" }, { "name": "bump", "type": "u8" }, { "name": "risk_state", "docs": [ "Current risk state (updated by keepers from oracle)" ], "type": { "defined": { "name": "RiskState" } } }, { "name": "risk_state_updated_at", "docs": [ "Last time risk state was updated" ], "type": "i64" }, { "name": "risk_fee_config", "docs": [ "Risk-based fee configuration" ], "type": { "defined": { "name": "RiskFeeConfig" } } }, { "name": "user_twap_price", "docs": [ "TWAP price for user quoting (updated by keepers)" ], "type": "u64" }, { "name": "twap_updated_at", "docs": [ "Last TWAP update time" ], "type": "i64" }, { "name": "worst_case_config", "docs": [ "Configuration for worst-case quoting" ], "type": { "defined": { "name": "WorstCaseQuotingConfig" } } }, { "name": "oracle_confidence", "docs": [ "Oracle confidence interval (updated by keepers)" ], "type": "u64" }, { "name": "keeper_authority", "docs": [ "Whitelisted keeper authority that is allowed to update risk state" ], "type": "pubkey" }, { "name": "dev_tax_pct", "docs": [ "Dev tax percentage (updated by keeper based on CLP TVL tiers)" ], "type": "u8" }, { "name": "yield_ceiling_bps", "docs": [ "Maximum fraction of total_collateral deployable to yield protocols (basis points).", "Default: 6000 (60%). Remaining 40% stays liquid to cover redemptions." ], "type": "u16" }, { "name": "deployed_to_yield", "docs": [ "Amount of collateral currently deployed to external lending protocols.", "Invariant: deployed_to_yield <= total_collateral * yield_ceiling_bps / 10_000" ], "type": "u64" }, { "name": "total_yield_harvested", "docs": [ "Cumulative yield harvested to CLP vault (never decrements, informational)." ], "type": "u64" }, { "name": "yield_enabled", "docs": [ "Whether collateral yield deployment is enabled for this market." ], "type": "bool" }, { "name": "buffer_target_bps", "docs": [ "Keeper-posted overcollateralization buffer (bps OVER parity), the dynamic", "solvency target. Target ratio = 10_000 + buffer_target_bps, clamped to", "[MIN_BUFFER_BPS, MAX_BUFFER_BPS]. 0 (legacy/unset) is treated as the default", "200 (102%) by `target_ratio_bps()`, so old accounts behave as before until the", "keeper posts a value. Sized from σ-regime + live inventory (vol_model::dynamic_buffer)." ], "type": "u16" }, { "name": "s_gamma_index", "docs": [ "Keeper-posted decay scalar on the SHORT NAV, in 1e9 fixed point", "(1_000_000_000 = 1.0 = no decay). The effective short NAV is", "`(K / l_nav) · s_gamma_index / 1e9`. It only ever ratchets DOWN, by the", "realized variance the short pair accrues, so holding the short across a", "choppy path costs the decay, which banks as collateral surplus (the", "long leg is never touched). `0` (legacy/unset) is read as 1e9 by", "`short_gamma_index()`, so old accounts behave exactly as before until", "the keeper posts a value. NOT a perp funding rate; there is no periodic", "cash transfer; it is a structural mark on the short token's value, so the", "1:1 paired round-trip and buy-and-hold mechanics are unchanged at a fixed γ." ], "type": "u64" }, { "name": "gamma_day_start_ts", "docs": [ "Unix ts the current γ day-bucket opened. 0 = no bucket yet." ], "type": "i64" }, { "name": "gamma_day_decay_1e9", "docs": [ "γ index units (1e9) decayed inside the current day-bucket. TELEMETRY", "ONLY: tracked so an auditor can see the day's total, never enforced." ], "type": "u64" }, { "name": "gamma_last_write_ts", "docs": [ "Unix ts of the last accepted γ write. Lets an auditor alarm on writer", "SILENCE, the failure mode no cap can catch, because it looks like calm." ], "type": "i64" }, { "name": "gamma_epoch", "docs": [ "Bumped by a re-anchor. Carried in `SetGammaParams` as a CAS so a decay", "post computed against a pre-re-anchor γ can never land after the fold", "and re-charge the whole epoch." ], "type": "u32" }, { "name": "reanchor_count", "docs": [ "How many re-anchors this market has seen. 0 = never." ], "type": "u32" }, { "name": "genesis_s_price", "docs": [ "`initial_s_price` as of genesis, before any re-anchor folded γ into it.", "Backfilled lazily on the first re-anchor; 0 = never re-anchored, so the", "live `initial_s_price` IS the genesis value." ], "type": "u64" }, { "name": "last_reanchor_ts", "docs": [ "Unix ts of the last re-anchor. 0 = never." ], "type": "i64" }, { "name": "short_payoff_cap_c_1e9", "docs": [ "Reserved for the capped short payoff `S = γ·min(K/P, C·K/P₀)` (1e9", "fixed). The instruction ships in upgrade #2; the FIELD lands here so", "that upgrade is instructions-only and needs no second realloc.", "0 = unset = uncapped, i.e. exactly today's behavior." ], "type": "u64" }, { "name": "price_adjust_num", "type": "u64" }, { "name": "price_adjust_den", "docs": [ "Denominator of the cumulative corporate-action ratio. See", "`price_adjust_num`. 0 = unset = identity." ], "type": "u64" }, { "name": "price_adjust_pending_num", "docs": [ "A corporate action ARMED AHEAD of its ex-date: the cumulative pair that", "becomes live at `price_adjust_effective_ts`. Until then the current", "`price_adjust_num/den` keeps applying.", "", "This exists because arming a ratio early is otherwise actively harmful,", "not merely useless. The adjustment multiplies the NEXT raw print, and", "before the ex-date that print is still PRE-split, so an early 2:1 would", "double the stored price, the 25% move guard would reject every push, and", "the market would halt from the moment of arming until the split actually", "happened. Gating on a timestamp is what makes \"schedule it weeks ahead\"", "a true statement instead of a longer outage." ], "type": "u64" }, { "name": "price_adjust_pending_den", "docs": [ "Denominator of the pending pair. See `price_adjust_pending_num`." ], "type": "u64" }, { "name": "price_adjust_effective_ts", "docs": [ "Unix ts from which the pending pair applies. 0 = nothing pending.", "", "Set it to the ex-date OPEN, the first instant a venue quotes the", "post-action price. Misalignment is bounded and self-correcting for", "ratios above ~1.333: a print on the wrong side of the boundary is", "REJECTED by the 25% guard, not absorbed, so an early or late `ts` costs", "rejected pushes rather than a mispriced book. Below ~1.333 nothing", "rejects it and the alignment is the only control." ], "type": "i64" }, { "name": "price_adjust_last_effective_ts", "docs": [ "Most recent activated units boundary, retained after promotion and rescheduling." ], "type": "i64" } ] } }, { "name": "MarketFundsMoved", "type": { "kind": "struct", "fields": [ { "name": "owner", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "mint", "type": "pubkey" }, { "name": "amount", "type": "u64" }, { "name": "deposit", "type": "bool" } ] } }, { "name": "OracleType", "type": { "kind": "enum", "variants": [ { "name": "Pyth" }, { "name": "Switchboard" }, { "name": "Continuum" } ] } }, { "name": "OrdersParams", "type": { "kind": "struct", "fields": [ { "name": "cancels", "type": { "vec": { "defined": { "name": "CancelOrder" } } } }, { "name": "orders", "type": { "vec": { "defined": { "name": "PlaceOrder" } } } }, { "name": "fill_or_kill", "docs": [ "With one immediate-or-cancel order and no cancels: revert unless it", "fills in full. A market order that must not fill in part." ], "type": "bool" } ] } }, { "name": "OrdersPlaced", "type": { "kind": "struct", "fields": [ { "name": "owner", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "cancels", "type": "u8" }, { "name": "orders", "type": "u8" }, { "name": "session", "type": "bool" } ] } }, { "name": "PlaceOrder", "docs": [ "Borsh-identical to Manifest's `PlaceOrderParams` (order_type is its enum's", "one-byte discriminant)." ], "type": { "kind": "struct", "fields": [ { "name": "base_atoms", "type": "u64" }, { "name": "price_mantissa", "type": "u32" }, { "name": "price_exponent", "type": "i8" }, { "name": "is_bid", "type": "bool" }, { "name": "last_valid_slot", "type": "u32" }, { "name": "order_type", "type": "u8" } ] } }, { "name": "Pool", "docs": [ "v2 native DISCRETE-BIN quote book for ONE synth side (long or short) vs", "cUSDC. `asks`/`bids` are per-bin reserves around `base_price_1e6` (≈ side", "NAV), priced at `base·r^±k` with `r = 1 + step_bps/1e4`. Swaps walk the bins", "(real slippage); the keeper repositions to NAV with a skewed shape via", "`set_pool_shape`. See `clmm.rs`.", "", "NAMING: despite the `CLMM_*` env vars and the `clmm.rs` filename, this is", "NOT a Uniswap-v3-style concentrated-liquidity AMM. There is no continuous", "`x·y=k` curve and no permissionless LPs: each bin holds a fixed reserve at a", "fixed price (constant-sum within a bin), and the ladder is POSTED by the", "keeper rather than emerging from deposits. It is a discrete-bin liquidity", "book (the Trader Joe \"Liquidity Book\" family), with a single quoter. The", "old names are kept for config compatibility; docs say \"bin book\"." ], "type": { "kind": "struct", "fields": [ { "name": "authority", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "side", "type": "u8" }, { "name": "synth_mint", "type": "pubkey" }, { "name": "usdc_mint", "type": "pubkey" }, { "name": "base_price_1e6", "type": "u64" }, { "name": "step_bps", "type": "u32" }, { "name": "num_bins", "type": "u8" }, { "name": "asks", "type": { "array": [ "u64", 16 ] } }, { "name": "bids", "type": { "array": [ "u64", 16 ] } }, { "name": "enabled", "type": "bool" }, { "name": "frozen", "type": "bool" }, { "name": "shape_updated_at", "type": "i64" }, { "name": "bump", "type": "u8" }, { "name": "wing_step_bps", "type": "u32" }, { "name": "core_bins", "type": "u8" } ] } }, { "name": "PoolSwapArgs", "docs": [ "A swap on the CLP's bin book for one side of a market." ], "type": { "kind": "struct", "fields": [ { "name": "direction", "docs": [ "0 buys the token with cUSDC, 1 sells it for cUSDC." ], "type": "u8" }, { "name": "amount_in", "type": "u64" }, { "name": "min_out", "type": "u64" } ] } }, { "name": "PoolTraded", "type": { "kind": "struct", "fields": [ { "name": "owner", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "side", "type": "u8" }, { "name": "direction", "type": "u8" }, { "name": "quote", "docs": [ "cUSDC atoms paid (buy) or received (sell)." ], "type": "u64" }, { "name": "base", "docs": [ "Token atoms received (buy) or paid (sell)." ], "type": "u64" }, { "name": "session", "type": "bool" } ] } }, { "name": "RebateClaimed", "type": { "kind": "struct", "fields": [ { "name": "owner", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "amount", "type": "u64" } ] } }, { "name": "RebateFunded", "type": { "kind": "struct", "fields": [ { "name": "market", "type": "pubkey" }, { "name": "amount", "type": "u64" }, { "name": "funded_total", "type": "u64" } ] } }, { "name": "RebateMarket", "type": { "kind": "struct", "fields": [ { "name": "market", "docs": [ "The mint-redeem market." ], "type": "pubkey" }, { "name": "short_mint", "type": "pubkey" }, { "name": "pot", "docs": [ "cUSDC account owned by this PDA (seeds `rebate_pot`, market)." ], "type": "pubkey" }, { "name": "acc_per_unit", "docs": [ "cUSDC atoms per staked S atom, × ACC_SCALE, cumulative." ], "type": "u128" }, { "name": "accrued_until", "docs": [ "The index is accrued up to here." ], "type": "i64" }, { "name": "rate_bps", "docs": [ "Annual rate on the staked S's value, bps (cap × ramp), from the last refresh." ], "type": "u32" }, { "name": "cap_bps", "docs": [ "Twice the realised collateral yield, bps a year." ], "type": "u32" }, { "name": "yield_bps", "docs": [ "Realised collateral yield, bps a year." ], "type": "u32" }, { "name": "yield_mark_ts", "type": "i64" }, { "name": "yield_mark_total", "docs": [ "`total_yield_harvested` at `yield_mark_ts`." ], "type": "u64" }, { "name": "ema_x", "docs": [ "14-day average of E / oi_cap, × 1e6." ], "type": "i64" }, { "name": "ema_ts", "type": "i64" }, { "name": "total_units", "docs": [ "Staked S across all positions." ], "type": "u64" }, { "name": "funded_total", "docs": [ "cUSDC put into the pot, cumulative. Never above what the market has", "harvested since the rebate opened." ], "type": "u64" }, { "name": "harvested_base", "docs": [ "`total_yield_harvested` when the rebate opened." ], "type": "u64" }, { "name": "allocated_total", "docs": [ "cUSDC committed to the index, cumulative. Never above `funded_total`." ], "type": "u64" }, { "name": "claimed_total", "docs": [ "cUSDC paid out, cumulative." ], "type": "u64" }, { "name": "bump", "type": "u8" }, { "name": "pot_bump", "type": "u8" }, { "name": "reserved", "type": { "array": [ "u8", 64 ] } } ] } }, { "name": "RebateMarketOpened", "type": { "kind": "struct", "fields": [ { "name": "market", "type": "pubkey" }, { "name": "pot", "type": "pubkey" } ] } }, { "name": "RebatePosition", "type": { "kind": "struct", "fields": [ { "name": "market", "type": "pubkey" }, { "name": "trader", "docs": [ "The trading account's trader PDA." ], "type": "pubkey" }, { "name": "units", "docs": [ "S staked in the vault (seeds `rebate_vault`, market, trader)." ], "type": "u64" }, { "name": "debt", "docs": [ "`acc_per_unit` when `pending` was last brought up to date." ], "type": "u128" }, { "name": "pending", "docs": [ "Earned, not yet claimed (cUSDC atoms)." ], "type": "u64" }, { "name": "bump", "type": "u8" }, { "name": "vault_bump", "type": "u8" }, { "name": "reserved", "type": { "array": [ "u8", 32 ] } } ] } }, { "name": "RebateRefreshed", "type": { "kind": "struct", "fields": [ { "name": "market", "type": "pubkey" }, { "name": "exposure", "docs": [ "Traders' net position E, cUSDC atoms (0 while uncapped)." ], "type": "i64" }, { "name": "cap", "type": "u64" }, { "name": "ema_x", "type": "i64" }, { "name": "yield_bps", "type": "u32" }, { "name": "cap_bps", "type": "u32" }, { "name": "rate_bps", "type": "u32" }, { "name": "total_units", "type": "u64" }, { "name": "pot_free", "docs": [ "Pot cUSDC not yet committed to the index." ], "type": "u64" } ] } }, { "name": "RebateStaked", "type": { "kind": "struct", "fields": [ { "name": "owner", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "amount", "type": "u64" }, { "name": "units", "type": "u64" } ] } }, { "name": "RebateUnstaked", "type": { "kind": "struct", "fields": [ { "name": "owner", "type": "pubkey" }, { "name": "market", "type": "pubkey" }, { "name": "amount", "type": "u64" }, { "name": "units", "type": "u64" } ] } }, { "name": "RiskFeeConfig", "docs": [ "Configuration for risk-based fee adjustments" ], "type": { "kind": "struct", "fields": [ { "name": "proxy_fee_multiplier", "docs": [ "Fee multiplier for Proxy Mode (100 = 1x, 200 = 2x)" ], "type": "u16" }, { "name": "stress_fee_multiplier", "docs": [ "Fee multiplier for Stress mode (100 = 1x, 300 = 3x)", "Also the starting point for Recovery Dutch auction (decays to 1.0x over 1 hour)" ], "type": "u16" }, { "name": "stress_mint_cap", "docs": [ "Mint cap per transaction in Stress mode (0 = disabled)" ], "type": "u64" }, { "name": "allow_mint_in_stress", "docs": [ "Whether to allow new mints in Stress mode" ], "type": "bool" }, { "name": "allow_redeem_in_stress", "docs": [ "Whether to allow redeems in Stress mode" ], "type": "bool" } ] } }, { "name": "RiskState", "docs": [ "Risk state for graduated oracle gating (mirrors oracle program)" ], "type": { "kind": "enum", "variants": [ { "name": "Normal" }, { "name": "ProxyMode" }, { "name": "Stress" }, { "name": "Recovery" } ] } }, { "name": "SessionParams", "type": { "kind": "struct", "fields": [ { "name": "key", "type": "pubkey" }, { "name": "expires_at", "type": "i64" }, { "name": "max_order_quote", "type": "u64" }, { "name": "max_session_quote", "docs": [ "The session's total budget in quote atoms: 0 for DEFAULT_SESSION_BUDGET,", "u64::MAX for none." ], "type": "u64" } ] } }, { "name": "SessionRevoked", "type": { "kind": "struct", "fields": [ { "name": "owner", "type": "pubkey" }, { "name": "key", "type": "pubkey" } ] } }, { "name": "SessionSet", "type": { "kind": "struct", "fields": [ { "name": "owner", "type": "pubkey" }, { "name": "key", "type": "pubkey" }, { "name": "expires_at", "type": "i64" }, { "name": "max_order_quote", "type": "u64" }, { "name": "max_session_quote", "type": "u64" } ] } }, { "name": "SwapGuardsState", "docs": [ "v2 native oracle-pegged swap guards (persisted on `Clp`). Mirrors the pure", "`swap::SwapGuards` used by the math/breaker logic; `to_guards()` converts.", "All-zero default (`enabled=false`) keeps swaps OFF until `configure_swap` is", "called — safe for accounts realloc'd into the new layout." ], "type": { "kind": "struct", "fields": [ { "name": "enabled", "docs": [ "Master on/off for the native swap path." ], "type": "bool" }, { "name": "frozen", "docs": [ "Hard kill switch (admin or auto-set on oracle degradation)." ], "type": "bool" }, { "name": "spread_bps", "docs": [ "LP edge applied to NAV, bps." ], "type": "u16" }, { "name": "max_staleness_secs", "docs": [ "Reject if the NAV/TWAP is older than this many seconds." ], "type": "i64" }, { "name": "max_confidence_bps", "docs": [ "Reject if oracle confidence exceeds this (bps of price)." ], "type": "u16" }, { "name": "max_deviation_bps", "docs": [ "Reject if NAV moved more than this vs the last accepted price (bps)." ], "type": "u16" }, { "name": "window_cap_usd", "docs": [ "Rolling-window notional cap (cUSDC, 6-dec); 0 = uncapped." ], "type": "u64" }, { "name": "window_secs", "docs": [ "Rolling-window length (seconds)." ], "type": "i64" }, { "name": "collateral_floor_bps", "docs": [ "Minimum collateralization (bps) that must hold AFTER a swap." ], "type": "u16" } ] } }, { "name": "TradingRules", "docs": [ "One per owner wallet. Holds the trading rules; the funds sit with `trader`,", "a data-less PDA that is the Manifest trader (it owns the token accounts and", "the seats, and pays seat rent from SOL the owner sends it)." ], "type": { "kind": "struct", "fields": [ { "name": "owner", "docs": [ "The main wallet: the only signer that can withdraw (and only to itself)", "or change the session." ], "type": "pubkey" }, { "name": "trader", "type": "pubkey" }, { "name": "session_key", "docs": [ "A key that can trade but never withdraw. `Pubkey::default()` when none." ], "type": "pubkey" }, { "name": "session_expires_at", "type": "i64" }, { "name": "max_order_quote", "docs": [ "The most quote (cUSDC atoms) one session-signed order may commit." ], "type": "u64" }, { "name": "bump", "type": "u8" }, { "name": "trader_bump", "type": "u8" }, { "name": "max_session_quote", "docs": [ "The most quote (cUSDC atoms) all session-signed placements together may", "commit until the owner grants the session again. 0 means", "DEFAULT_SESSION_BUDGET; UNLIMITED_SESSION_BUDGET means no limit.", "(Taken from the reserved bytes: the account did not grow.)" ], "type": "u64" }, { "name": "session_spent_quote", "docs": [ "What session-signed placements have committed since set_session: buys at", "the quote they may pay, sells at the NAV of what they sell. Cancels and", "fills refund nothing." ], "type": "u64" }, { "name": "reserved", "type": { "array": [ "u8", 48 ] } } ] } }, { "name": "Withdrawn", "type": { "kind": "struct", "fields": [ { "name": "owner", "type": "pubkey" }, { "name": "mint", "type": "pubkey" }, { "name": "amount", "type": "u64" } ] } }, { "name": "WorstCaseQuotingConfig", "docs": [ "Configuration for worst-case quoting", "Protects protocol from informed traders exploiting confidence interval edges" ], "type": { "kind": "struct", "fields": [ { "name": "enabled", "docs": [ "Whether worst-case quoting is enabled" ], "type": "bool" }, { "name": "normal_confidence_multiplier", "docs": [ "Confidence multiplier in Normal state (100 = 1x, 150 = 1.5x)" ], "type": "u16" }, { "name": "proxy_confidence_multiplier", "docs": [ "Confidence multiplier in Proxy state" ], "type": "u16" }, { "name": "stress_confidence_multiplier", "docs": [ "Confidence multiplier in Stress state (also the starting point for Recovery Dutch auction)" ], "type": "u16" } ] } }, { "name": "YieldDeployment", "docs": [ "Yield deployment to a specific protocol" ], "type": { "kind": "struct", "fields": [ { "name": "protocol", "docs": [ "Protocol where yield is deployed" ], "type": { "defined": { "name": "YieldProtocol" } } }, { "name": "amount_deployed", "docs": [ "Amount deployed" ], "type": "u64" }, { "name": "deployed_at", "docs": [ "Timestamp of deployment" ], "type": "i64" }, { "name": "last_harvest", "docs": [ "Last yield harvest time" ], "type": "i64" }, { "name": "total_yield_earned", "docs": [ "Total yield earned from this deployment" ], "type": "u64" }, { "name": "is_active", "docs": [ "Whether this deployment is active" ], "type": "bool" } ] } }, { "name": "YieldProtocol", "docs": [ "Yield protocol identifier", "", "Tag only — the on-chain CLP program treats every variant identically", "(just records the deployment in `yield_deployments[]`). The actual", "deposit/withdraw CPI is composed off-chain by the keeper, which means", "adding a new venue here does NOT require any further program changes,", "only a keeper-side adapter. Append-only for backwards-compat with", "existing on-chain `YieldDeployment` records that store the discriminant", "byte: never reorder." ], "type": { "kind": "enum", "variants": [ { "name": "Kamino" }, { "name": "MarginFi" }, { "name": "Other" }, { "name": "Solend" }, { "name": "JupiterLend" } ] } }, { "name": "YieldStrategyConfig", "docs": [ "Yield strategy configuration" ], "type": { "kind": "struct", "fields": [ { "name": "normal_deployment_bps", "docs": [ "Maximum % of idle collateral to deploy for yield (basis points)", "Dynamic based on risk state" ], "type": "u16" }, { "name": "proxy_deployment_bps", "type": "u16" }, { "name": "stress_deployment_bps", "type": "u16" }, { "name": "recovery_deployment_bps", "type": "u16" }, { "name": "min_liquid_reserve", "docs": [ "Absolute minimum reserve to keep liquid (in USDC, 6 decimals)" ], "type": "u64" }, { "name": "min_liquid_reserve_bps", "docs": [ "Target liquid reserve as a share of TVL" ], "type": "u16" }, { "name": "oi_liquidity_buffer_bps", "docs": [ "Extra reserve linked to live open interest" ], "type": "u16" }, { "name": "enabled", "docs": [ "Whether yield strategy is enabled" ], "type": "bool" } ] } } ] }