Documentation Index
Fetch the complete documentation index at: https://docs.raydium.io/llms.txt
Use this file to discover all available pages before exploring further.
Stable AMM shares the pool-side account structure of AMM v4 (AmmInfo, vaults, authority) and additionally requires a
ModelDataInfo account that stores the lookup table. This page covers both.Inventory
A Stable AMM pool binds to exactly one OpenBook market. The full inventory mirrors AMM v4 closely:| Category | Account | Owner | Role |
|---|---|---|---|
| Pool | AmmInfo | Stable program | Pool state, references to vaults, OpenBook, and model-data account. |
| Pool | amm_authority | Stable program | Program-owned PDA that signs vault moves. Shared across all Stable AMM pools. |
| Pool | amm_open_orders | OpenBook | The pool’s OpenBook OpenOrders account. |
| Pool | amm_target_orders | Stable program | Pool-side grid for limit orders. |
| Pool | pool_coin_token_account | SPL Token | Pool’s coin-side vault. |
| Pool | pool_pc_token_account | SPL Token | Pool’s pc-side vault. |
| Pool | lp_mint | SPL Token | Fungible LP mint. |
| Model | model_data_account | Stable program | The lookup table: 50,000 × DataElement. |
| Market | serum_market | OpenBook | OpenBook market. |
| Market | serum_bids, serum_asks | OpenBook | Bid/ask queues. |
| Market | serum_event_queue | OpenBook | Event queue. |
| Market | serum_coin_vault, serum_pc_vault | SPL Token | OpenBook market-level vaults. |
| Market | serum_vault_signer | OpenBook | Market-level vault signer. |
AmmInfo
Root state account. Layout is nearly identical to AMM v4 — pool params, decimals, fees, vault/mint references — with one addition: a model_data_key field pointing to the lookup table.
model_data_key— the address of the lookup table. Must be passed to every instruction.fees— identical structure to AMM v4. Defaults to 0.25% trade fee, 0.22% LP / 0.03% protocol split.coin_vault,pc_vault— the pools’ vaults.status— bitmask gating swap/deposit/withdraw/crank.out_put.need_take_pnl_*— swept byWithdrawPnl.
ModelDataInfo
The lookup table. A large sparse array of price/quantity points.
InitModelDatacreates the account and setsstatus = Initialized,multiplier = <admin-provided>,valid_data_count = 0.UpdateModelData(invoked up to 5 times per transaction) populates elements via:- Input: array of
(index: u64, DataElement)pairs. - Writes each to
elements[index]. - Increments
valid_data_countifindex >= valid_data_count.
- Input: array of
- Swap/deposit/withdraw call lookup functions that binary-search and interpolate within
elements[0..valid_data_count].
DataElement
The atomic entry in the table. Must be sorted (x ascending, y descending, price ascending) for binary search to work.
Authority and vaults
Same as AMM v4:amm_authorityis a single program-wide PDA derived with seed["amm authority"]. It owns all pool vaults and signs their moves.- Vaults are SPL Token accounts whose owner is
amm_authority, not ATAs.
Status bitmask
Identical to AMM v4. Controls whether swap/deposit/withdraw/crank are enabled.Fee and PnL tracking
Same as AMM v4. Theout_put struct tracks:
need_take_pnl_coin,need_take_pnl_pc— protocol fees accrued but not yet swept.WithdrawPnlmoves these out.swap_coin_in_amount,swap_pc_in_amount, etc. — analytics counters.
Account size
TheModelDataInfo is large (~1.2 MB, since 50,000 elements × 24 bytes per element). This is why creating a Stable pool requires explicit rent and account pre-allocation. The Raydium SDK and tools handle this transparently; integrators rarely need to manually allocate.
Deriving accounts from scratch
Like AMM v4, Stable AMM uses seeded keys (not pure PDAs). The canonical pool identity is derived via:What to read where
- Instruction account lists:
products/stable/instructions. - How interpolation uses the table:
products/stable/math. - Fee structure and WithdrawPnl:
products/stable/fees. - OpenBook account derivation: OpenBook program docs.


