Stable AMM is an independent program with its own program ID. It is not a mode of the AMM v4 program, and it is not traded “through” AMM v4 — it is deployed, upgraded, and called separately. It resembles AMM v4 only in fee and account-layout conventions.
Instruction inventory
Callable
Removed (no longer callable)
These were removed in the 2026-06-22 upgrade and can no longer be invoked. See Removed instructions.Deposit
Add liquidity, receive LP tokens.
Arguments
W, signer S)
Compatibility:
amm_open_orders (old #3) and serum_market (old #9) are removed. When 14 accounts are passed, the instruction is parsed with the old 14-account layout; the Serum accounts are ignored.
Math — standard pro-rata using the lookup table to compute the ratio. The SDK computes coin/pc pair for the desired LP amount and checks against max caps.
Withdraw
Burn LP, receive both sides pro-rata.
Arguments
W, signer S)
Compatibility: nine Serum accounts (
amm_open_orders, serum_program, serum_market, serum_coin_vault, serum_pc_vault, serum_vault_signer, serum_event_q, serum_bids, serum_asks) are removed. The old 21- or 22-account layouts are still accepted. Note, however, that the referral-fee logic for the 22nd optional referrer_pc_wallet account has been removed — it can still be passed but no longer takes effect.
Preconditions
user_source_lpholds at leastamount.
amountLP tokens are burned.- User receives coin and pc amounts according to the current pro-rata, adjusted for accrued fees.
SwapBaseIn
Exact-input swap using the lookup table for pricing.
Arguments
W, signer S)
Compatibility: the nine OpenBook accounts (
amm_open_orders, serum_program, serum_market, serum_bids, serum_asks, serum_event_queue, serum_coin_vault, serum_pc_vault, serum_vault_signer) are removed. If the number of accounts passed is not 9, the instruction is parsed with the old 18-account layout; the Serum accounts must still occupy their positions, but their contents are no longer validated or used.
Preconditions
amm.statusallows swap.user_source_tokenholds ≥amount_in.
- User loses
amount_in, gainsamount_out ≥ minimum_amount_out. - Pool fees increment
need_take_pnl_*counters.
products/stable/math.
SwapBaseOut
Exact-output swap (inverse of SwapBaseIn). Same 9-account layout, different math direction.
Arguments
WithdrawPnl
Admin-only. Sweep accrued protocol fees from need_take_pnl_* into designated PnL accounts.
Arguments — none (state-driven).
Accounts — new layout, fixed 10 accounts, admin only (writable W, signer S)
Logic change: when the pool’s available funds are insufficient to withdraw the accrued PnL, the pool is no longer put into
CancelAllOrdersState / Disabled; the instruction returns TakePnlError directly. The optional referrer_pc_wallet has also been removed.
Preconditions
amm_adminmust be authorized.
need_take_pnl_coinandneed_take_pnl_pcare transferred to the admin’s accounts.- Counters are zeroed.
Removed instructions
The following instructions were removed in the 2026-06-22 upgrade and can no longer be called. They are documented here only so integrators recognize them in historical transactions and SDKs.Initialize— formerly bootstrapped a new Stable AMM pool. Removed.PreInitialize— legacy pre-allocation helper. Removed.InitModelData— formerly created and initialized theModelDataInfolookup table. Removed.UpdateModelData— formerly populated up to 5 lookup-table elements per call. Removed.MonitorStep— the OpenBook crank that settled fills and reposted the order grid. Already long-dormant after the pool stopped posting to OpenBook; now removed.SetParams— admin parameter changes (status, fees, owner, model-data key, etc.). Removed.WithdrawSrm— swept SRM fee-discount rebates from early Serum-era pools. Removed.SimulateInfo— read-only quote helper. Removed; use the SDK’s off-chain stable-curve helpers for quoting (see Code demos).
Where to go next
- Accounts — for account field layouts and sizes.
- Math — for the lookup-table interpolation logic.
- Code demos — to see how to call these from the SDK.
raydium-stable/program/src/instruction.rs(enum and pack/unpack)raydium-stable/program/src/processor.rs(execution logic)

