collectFeeMode:
- BothToken (0) — fees claimable in both base and quote tokens
- OnlyB (1) — fees claimable in quote token only
- Compounding (2) — a configurable percentage of fees is automatically reinvested back into the pool reserves; the remainder is claimable
In BothToken and OnlyB modes, fees are not compounded into pool liquidity and can be claimed separately. In Compounding mode, a portion of fees is automatically reinvested — see Compounding Fee Mode below.
Total Trading Fee
The total swap fee () will have two components:- A base fee ()
- A variable fee ()
Base Fee
The base fee of a pool can be configured by the pool creator in the following ways:- Fixed Base Fee: A fixed fee that is applied to the swap amount.
- Fee Time Scheduler: A fee decay mechanism that decays the fee from a high starting fee to an ending fixed base fee over a period of time.
- Fee Market Cap Scheduler: A fee decay mechanism that decays the fee based on price movement rather than time.
- Rate Limiter: A fee slope mechanism that increases the fee based on trade size.
You can only choose one of the four options for the base fee.
Fixed Base Fee
Fixed base fee is a fixed fee that is applied to the swap amount. The fee can range from 0.01% to 50%. It is specified in the config key used for the pool creation.Fee Time Scheduler
Fee Time Scheduler is a fee decay mechanism that decays the fee from a high starting fee to an ending base fee over time. The fee math calculation for the scheduler can be found here.Fee Market Cap Scheduler
Fee Market Cap Scheduler is a fee decay mechanism that decays the fee based on price movement (market cap growth) rather than time. Fees reduce progressively as the token price increases from its starting point. The fee math calculation for the scheduler can be found here.Rate Limiter
Rate Limiter is a fee slope mechanism that starts at a fixed base fee and increases the fee based on trade size. This helps deter large trades from manipulating the market during launch. The fee math calculation for the rate limiter can be found here.Dynamic Fee (Variable Fee)
The variable fee is the core of the dynamic fee mechanism. It increases with market volatility. where:- Volatility Accumulator (): A measure of recent price volatility
- Bin Step (): A parameter that defines the price granularity for measuring volatility
- Variable Fee Control (): A parameter to control the magnitude of the variable fee
Volatility Accumulator
The Volatility Accumulator tracks price movements. It’s updated with every swap. where:- Max Volatility Accumulator (): A cap on the volatility measure to prevent fees from becoming excessively high
- Volatility Reference (): A decayed value of the volatility accumulator
- Price Change (): The price change since the last reference update, measured in “bins”
Price Change
The price change is calculated based on the change in the square root of the price. where is current price and is reference price.Volatility Reference
To ensure that the dynamic fee reflects recent volatility, the Volatility Reference decays over time. The decay mechanism is based on the time elapsed since the last significant trade:- If elapsed time < filter period: No change. This ignores very high-frequency trades.
- If filter period ≤ elapsed time < decay period: The volatility reference is reduced.
- If elapsed time ≥ decay period: The volatility reference is reset to 0. This happens if there are no significant trades for an extended period.
Max Dynamic Fee on DAMM v2
If you set theuseDynamicFee to true in the config key when you deploy via DAMM v2 Launch Pool, the max dynamic fee on DAMM v2 will be less than or equals to 20% of the Base Fee. You can also choose to configure the dynamic fee manually based on the math formula above.
Example:
- Base Fee = 1%
- Dynamic Fee = 0.2%
- Total Trading/LP Fee = 1.2%
Compounding Fee Mode
Compounding Fee Mode is a third fee collection option (collect_fee_mode = 2) where a configurable percentage of trading fees is automatically reinvested into the pool reserves, instead of being held for LP claiming. The rest of the fee is still claimable by LPs as normal.
This mode is configured using the compounding_fee_bps parameter, which defines how many basis points of the LP fee are compounded. For example, a value of 5000 means 50% of the trading fee auto-compounds, and the remaining 50% is claimable.
Pools using Compounding Fee Mode operate as a standard constant-product AMM with no concentrated price range. See DAMM v2 Formulas for details.
Fee Split
The protocol fee is first subtracted from the total trading fee. The compounding/claiming split then applies to the remaining LP fee: So: Example:- Total trading fee () = 1%
- Protocol fee = 10% of total → 0.1%
- LP fee = 0.9%
compounding_fee_bps= 3000 (30%)- Compounding fee = 0.27% (auto-reinvested into pool reserves)
- Claiming fee = 0.63% (claimable by LPs)

