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.
What it is
CPMM is Raydium’s standard constant-product AMM. It is the successor to AMM v4 and has no OpenBook dependency, lower gas, first-class Token-2022 support (including transfer-fee tokens), and a cleaner account layout. Program ID: see reference/program-addresses. Token-2022: supported, including transfer-fee, permanent delegate, and default-account-state extensions. See algorithms/token-2022-transfer-fees for how transfer fees affect swap math.Chapter contents
Overview
What CPMM is, why it was built, and how it differs from AMM v4.
Accounts
PoolState, AmmConfig, LP mint, token vaults, observation (oracle) account. Seeds, field layouts.
Math
xy=k invariant, SwapBaseIn vs. SwapBaseOut math, oracle observation update rule, transfer-fee adjustment.
Instructions
Initialize, Deposit, Withdraw, SwapBaseInput, SwapBaseOutput, CollectFundFee, CollectProtocolFee, UpdatePoolStatus.
Fees
LP fee, protocol fee, fund fee, creator fee; how fees are collected and withdrawn.
Code demos
Create pool, deposit, withdraw, swap — in TypeScript (raydium-sdk-v2) and Rust CPI.
When to read this
- You are creating a new constant-product pool.
- You need an AMM that supports Token-2022 tokens.
- You are routing and want to include CPMM liquidity.


