Skip to main content

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.

Router fee

The AMM Routing program charges no fee of its own. It is a pure orchestrator. All fees are paid directly to the pools you route through:
  • Each AMM v4 hop pays the AMM v4 fee (0.25% split).
  • Each CPMM hop pays the CPMM fee (configurable, typically 0.25% split).
  • Each CLMM hop pays the CLMM fee (configurable per pool).
  • Each stable hop pays the stable-swap fee (like AMM v4, typically 0.25% split).

Total effective fees on a route

If you route through N pools, your total fee is the sum of all N hops’ fees, compounded. Example: Route: USDC → SOL (0.25% fee) → STEP (0.25% fee)
Input: 1000 USDC

Hop 1 (USDC/SOL): 0.25% fee
  Fee: 2.5 USDC
  Output to hop 2: ~997.5 USDC of buying power

Hop 2 (SOL/STEP): 0.25% fee
  Fee: ~2.49 STEP-worth
  Output: ~995 STEP-worth

Total cost: ~0.5% (not exactly 0.5%, since fees compound)
See the respective pool’s fee documentation for exact splits:

Compute cost

The router’s compute cost is linear in the number of hops:
  • Fixed overhead: ~5k CU for the router’s dispatch logic and account validation.
  • Per-hop cost: ~10k–50k CU depending on the pool type and complexity:
    • CPMM: ~20k–30k CU
    • AMM v4: ~40k–60k CU (includes OpenBook validation)
    • CLMM: ~50k–100k CU (tick-math heavy)
    • Stable: ~30k–40k CU
  • Total transaction budget: 1.4M CU on mainnet. A route with 10 CPMM hops would cost ~305k CU, leaving room for other operations.
See the individual pool’s documentation for exact CU costs.

Account initialization overhead

Every enabled swap variant routes intermediate tokens through user-controlled ATAs. On each intermediate hop, you must pre-create and provide a user-owned ATA:
  • If the ATA doesn’t exist: ATA program init costs ~5k CU + ~0.00203928 SOL rent per ATA. Initialize it with the SPL Associated Token Account program (or, for wSOL, with CreateSyncNative tag 5).
  • If the ATA already exists: no extra overhead.
For a 5-hop route with 4 intermediate tokens, you would need 4 new ATAs if starting fresh = ~20k CU + ~0.00816 SOL. You can recover the rent of any temporary ATA — most commonly a wSOL ATA used for a single route — by closing it with CloseTokenAccount (tag 6) once it has zero balance.

Where to go next