This guide explains how CPMM fee configs work and how to fetch existing configs from on-chain.
Each CPMM pool is assigned a fee configuration at creation. Fee configurations are stored on-chain as AmmConfig accounts — each one defines a fee tier that any pool can use.
Fee configurations
Every pool references a single AmmConfig that determines how fees are collected and distributed on each swap. To view all available configurations, use the script below to query the on-chain accounts. You can also view public config IDs at this endpoint (https://api-v3.raydium.io/main/cpmm-config) – note this endpoint excludes certain custom config IDs.
To request a custom fee configuration, contact the Raydium team.
Example output
--- Config index: 0 ---
Address: D4FPEruKEHrG5TenZ2mpDGEfu1iUvTiqBxvpU8HLBvC2
Trade Fee Rate: 2500 (0.25%)
Protocol Fee Rate: 120000 (12% of trade fee)
Fund Fee Rate: 40000 (4% of trade fee)
Creator Fee Rate: 500 (0.05%)
Create Pool Fee: 150000000 lamports (0.15 SOL)
How fees are distributed
Using Config 0 as an example, here's how fees flow on a 1,000,000 token swap.
1. Fees are deducted from the input
The trade_fee_rate and creator_fee_rate are each applied to the swap input amount:
The remaining 997,000 tokens enter the constant-product swap to determine the output.
2. The trade fee is split between protocol, treasury, and LPs
protocol_fee_rate and fund_fee_rate are percentages of the trade fee, not the swap amount:
The LP fee remains in the pool vaults, increasing the value of LP positions.
3. Summary
Recipient
Amount
Calculation
LPs
2,100 tokens
trade_fee - protocol - fund
Raydium protocol
300 tokens
12% of trade fee
Raydium treasury
100 tokens
4% of trade fee
Pool creator
500 tokens
0.05% of swap input
Total fees
3,000 tokens
0.30% of swap input
Protocol and treasury fees accumulate in the pool vaults and are collected separately by the protocol_owner and fund_owner addresses.
AmmConfig fields
Field
Description
trade_fee_rate
Fee taken from the swap input, in units of 1e-6. 2500 = 0.25%.
protocol_fee_rate
Share of the trade fee sent to Raydium protocol, in units of 1e-6. 120000 = 12%.
fund_fee_rate
Share of the trade fee sent to Raydium treasury, in units of 1e-6. 40000 = 4%.
creator_fee_rate
Additional fee taken from the swap input, sent to the pool creator. 500 = 0.05%.
create_pool_fee
One-time fee in lamports to create a pool with this config. 150000000 = 0.15 SOL.
disable_create_pool
When true, new pool creation is disabled for this config. Existing pools are unaffected.
protocol_owner
Address that collects accumulated protocol fees.
fund_owner
Address that collects accumulated treasury fees.
All rate fields use a denominator of 1,000,000. For example, a value of 2500 means 2500/1000000 = 0.25%.
Fetch all configurations
The following script queries all AmmConfig accounts from mainnet: