Overview
Every DAMM v2 pool has acollectFeeMode that determines how trading fees flow to LPs. This is set at pool creation and cannot be changed.
| Mode | Value | Fee Token(s) | Single-Sided | Price Range |
|---|---|---|---|---|
BothToken | 0 | Token A + Token B | ✅ | Any |
OnlyB | 1 | Token B only | ✅ | Any |
Compounding | 2 | Token B (auto-reinvested) | ❌ | Full range only |
BothToken (mode 0)
Fees accumulate in whichever token the LP provided. When a trader swaps A→B, the fee is taken in token A. When they swap B→A, the fee is taken in token B. LP fee claim: SeparateclaimPositionFee instruction. Both fee_a_pending and fee_b_pending on the position are claimable.
Use when: You want LPs to accumulate fees in both tokens — typical for symmetric liquidity provision.
OnlyB (mode 1)
All fees are collected in token B (the quote token), regardless of swap direction. Fees for A→B swaps are still taken from the input (token A) but immediately converted to the quote token equivalent. LP fee claim: Onlyfee_b_pending accumulates. fee_a_pending is always 0.
Use when: LPs prefer a single, predictable fee token. Common for one-sided launches where token A is the new token and token B is SOL/USDC.
Compounding (mode 2)
The most distinctive mode. A configurable percentage of each trade’s LP fee (compoundingFeeBps) is automatically reinvested back into the pool’s reserves as token B rather than being held for claiming. The remainder is still claimable.
How it works
compoundingFeeBps is a u16 (0–10000). E.g., 5000 = 50% of LP fees compound, 50% claimable.
Constraints
Swap result fields
In compounding mode, the swap result exposes two separate fee fields:| Field | Description |
|---|---|
claimingFee | Portion the LP can claim later |
compoundingFee | Portion reinvested into pool reserves |
compoundingFee = 0 and claimingFee = tradingFee.
Reading from events
TheEvtSwap2 event emits collect_fee_mode on every swap, so you can filter events by mode to track fee behaviour.
Choosing a Mode
I'm doing a token launch and want simplicity
I'm doing a token launch and want simplicity
Use OnlyB (mode 1). Fees accumulate in your quote token (SOL/USDC), LPs get a clean single-token yield, and it works with one-sided deposits for a bootstrap launch.
I want LPs to earn fees in both my token and SOL/USDC
I want LPs to earn fees in both my token and SOL/USDC
Use BothToken (mode 0). LPs benefit from fee accumulation in the base token if it appreciates.
I want liquidity to grow automatically over time
I want liquidity to grow automatically over time
Use Compounding (mode 2). Pool depth increases with every trade. Best for mature, full-range pools with long-term LPs who prefer position growth over regular fee claims.

