What it is
AMM v4 is Raydium’s first-generation pool. It maintains a constant-product invariant (xy=k). The pool was originally designed as a hybrid AMM: alongside the curve, it posted a Fibonacci-spaced grid of limit orders onto a bound OpenBook market so that pool liquidity was visible to orderbook takers. That OpenBook integration has since been removed from the program (see warning above); AMM v4 today is a pure constant-product AMM. On-chainAmmInfo accounts retain their market / open_orders reference fields for layout compatibility, but the program no longer reads or acts on them.
It is still the highest-liquidity product on Raydium for many legacy pairs but is no longer recommended for new pools — see CPMM for new deployments.
Program ID: see reference/program-addresses.
Token-2022: not supported. AMM v4 pools only accept classic SPL tokens.
Chapter contents
Overview
Conceptual model: how AMM v4 couples a constant-product curve to an OpenBook market, and why the design exists.
Accounts
AmmInfo, TargetOrders, OpenOrders, LP mint, token vaults, market vault signer. Seeds, field layouts, invariants.
Math
xy=k invariant, price calculation. The reserve formula is now vault-only; the OpenBook limit-order grid math is retained as historical context.
Instructions
Initialize2, Deposit, Withdraw, SwapBaseIn / V2, SwapBaseOut / V2, SetParams, WithdrawPnl. (Order-book instructions such as MonitorStep are removed.)
Fees
LP fee, protocol fee, trade fee split. Historical PnL handling for orderbook fills (retired).
Code demos
TypeScript (raydium-sdk-v2) and Rust CPI examples for deposit, withdraw, and swap.
When to read this
- You are auditing or integrating against existing AMM v4 pools.
- You are building a router that must support v4 liquidity.
- You are planning a migration from v4 to CPMM — see also user-flows/migrate-amm-v4-to-cpmm.

