Total Trading Fee
Liquidity Providers (LPs) earn trading fees from each swap. The total swap fee (f_s) consists of two parts:
f_b: Base Fee (fixed)f_v: Variable Fee (dynamic)
Fees are calculated per bin and distributed proportionally to LPs in each
bin.
Base Fee
The base fee is the minimum fee charged on every swap.Formula
B: Base factor (set by pool creator)s: Bin step
A higher base fee earns more per volume but may reduce trade volume. Lower
base fees give room for dynamic fees to optimize based on market volatility.
Variable Fee (Dynamic)
The variable fee accounts for real-time market volatility.Formula (per bin k)
A: Variable fee control parameters: Bin stepv_a(k): Volatility accumulator for bink
Variable Fee Characteristics
Variable fees are:- Higher for volatile markets
- Calculated per bin crossed in large swaps
- Distributed to LPs of each crossed bin
Volatility Accumulator (v_a)
The volatility accumulator tracks real-time market activity.
Formula
v_r: Volatility reference (based on time since last swap)i_r: Index referenceactiveID: ID of the active bin before the swapk: Relative bin index crossed during the swap
The more bins crossed or the more frequent the swaps, the higher the
volatility and fee.
Volatility Reference (v_r)
Volatility decays over time:
t: Time since last transactiont_f: Filter period (e.g., 1s)t_d: Decay period (e.g., 5s)R: Decay multiplier
Index Reference (i_r)
i_r ensures fees cannot be gamed by frequent low-impact swaps.Fee Distribution Per Bin
Each bin crossed in a swap contributes to total fee:Example: Volatility in Action
| Swap Action | Time | Bins Crossed | v_a (max) |
|---|---|---|---|
| #1 | Initial | +3 bins (100 → 103) | 3 |
| #2 | 4s later | +5 bins (103 → 108) | 6.5 |
| #3 | 0.3s later | -2 bins (108 → 106) | 4.5 |
Volatility builds with activity and decays over time, making fees adaptive
and manipulation-resistant.
DLMM Protocol Fee
The protocol takes a portion of the dynamic fee (not just base).| Pool Type | Protocol Fee |
|---|---|
| Standard DLMM Pool | 5% of f_s |
| DLMM Launch Pools | 20% of f_s |
Key Benefits
For Liquidity Providers
- Higher returns during volatility - Dynamic fees increase when markets are active
- Protection during quiet periods - Base fees ensure minimum earnings
- Fair distribution - Fees go to bins that actually facilitate trades
For Traders
- Predictable base costs - Minimum fee is always known
- Fair pricing during volatility - Higher fees during high-impact trades protect LP capital
- Manipulation resistance - Time-based decay prevents fee gaming
Understanding Fee Impact
Low Volatility Scenarios
- Fees remain close to base fee
- Suitable for stable trading environments
- Lower cost for routine swaps
High Volatility Scenarios
- Variable fees increase significantly
- Compensates LPs for impermanent loss risk
- Encourages liquidity provision during volatile periods