Skip to main content

One-paragraph summary

Stable AMM is a standalone Raydium program — its own deployment, not a mode of AMM v4 — that trades a curve formula for a pre-populated lookup table. Instead of using x·y=k, the pool stores a sparse array of (x, y, price) points and uses binary search + linear interpolation to quote prices. This design excels at stablecoin pairs and other assets with known price relationships: swaps between 1-to-1 pegged tokens have near-zero slippage. It is a pure AMM: all liquidity sits in the pool’s own vaults. (It carried an OpenBook market-making path early in its life, but that path has been dormant for years; the 2026-06-22 upgrade finally removed the dead market code.) Liquidity is currently thin; most integrators reach Stable pools through the AMM Routing program.

Why a lookup table instead of xy=k

Constant-product AMMs incur high slippage on pairs with tight price bands. A USDC-USDT swap should cost almost nothing; on a constant-product pool, k=x·y forces a price move even for tiny volume. A lookup table lets the pool admin express the actual price relationship:
  • For stablecoins: density the table around 1:1 so micro-swaps cost ~0 slippage.
  • For collateralized pairs: encode the target ratio and let the grid shape the fee/incentive surface.
The table is now fixed — it was populated historically via the UpdateModelData instruction, which has since been removed, so existing pools keep their tables as-is. The on-chain cost is just interpolation search — much cheaper than recomputing a formula.

How it works: the model-data account

The pool holds a ModelDataInfo account — a 50,000-element array of DataElement structs. Each element holds:
DataElement {
  x: u64,           // table X coordinate
  y: u64,           // table Y coordinate
  price: u64,       // price at (x, y)
}
Only the first valid_data_count elements are populated; the rest are zeroed. On swap, the program:
  1. Computes a ratio from the current pool reserves and uses binary search to find which two table elements bracket that ratio.
  2. Interpolates linearly between the two bracketing points to get the quote price.
  3. Applies fees (same 0.25% as AMM v4) and returns the result to the user.
The multiplier field on the table accounts for the possibility that x and y are stored at a reduced scale (e.g., with 6 decimals instead of 18). Price discovery rescales accordingly.

Comparison: Stable AMM vs. AMM v4 vs. CPMM

DimensionStable AMMAMM v4CPMM
CurveLookup table + interpolationConstant product (xy=k)Constant product
Primary use caseStablecoins, pegged pairsGeneral pairs, legacy deep liquidityGeneral pairs, new deployments
OpenBook dependencyNo (market path long dormant; dead code removed 2026-06)YesNo
Token-2022NoNoYes
Slippage profileMinimal at 1:1High at tight ratiosModerate across range
Admin-tunable curveNo longer (UpdateModelData removed; tables now fixed)No (SetParams only)No
Table size~50k elements × 24 bytesN/AN/A
Compute per swap~5k–15k CU (binary search + interpolation)~150k–200k CU~60k–100k CU
Account count per swap9 (new layout; 18 old-compat)~18 (AMM + OpenBook)~11

Mental model

A Stable AMM pool is an interpolated lookup-table AMM that holds all of its liquidity in its own vaults. The key difference from a constant-product pool is that the price-discovery curve is not hardcoded — it is a sparse array baked into the pool’s ModelDataInfo account. The currently callable operations are direct swap (user ↔ pool), deposit / withdraw (LP ops), and WithdrawPnl (admin fee sweep). The OpenBook crank (MonitorStep) — long dormant since the pool stopped posting orders — and the pool-setup/admin instructions have been removed.

When Stable AMM is the right choice

  • You operate a stablecoin or other correlated-asset pair and want tight, predictable pricing.
  • You have deep knowledge of your pair’s price relationship and want to encode it directly as a curve.
  • You already have integrations for AMM v4 and simply need a different curve flavor.
For a fresh, general-purpose pool with no tight-correlation requirement, CPMM is the simpler and more liquid default.

Where to go next

  • AccountsAmmInfo, ModelDataInfo, DataElement field reference.
  • Math — binary search, interpolation, and fee application.
  • Instructions — the callable set (swap, deposit, withdraw, WithdrawPnl) and the removed instructions.
  • Fees — the 0.25% split (identical to AMM v4).
  • Code demos — routing and direct integration.
Sources: