Dynamic Fee
Bean's DLMM introduces a Dynamic Fee system — a smart, self-adjusting mechanism that tunes trading fees in real-time, based on volatility, price movement, and deposit behavior. The goal is simple: reward LPs fairly during volatile periods, keep costs low for traders during calm times, and make the protocol sustainable long-term.
Core Objectives
Liquidity Providers (LPs)
✅ Volatility-adjusted returns
✅ Minimum guaranteed base fees
✅ Protection against toxic/imbalanced flow
Traders
✅ Lower fees during stable periods
✅ Predictable and transparent pricing
✅ Fair cost during volatility
Protocol
✅ Consistent revenue share
✅ Adaptive market efficiency
✅ Built-in risk controls
1. Fee Architecture
Bean calculates the total trading fee as:
All calculations utilize 9-decimal precision (1,000,000,000 = 100%)
System safeguards:
Max Total Fee: 10%
Max Protocol Share: 25% of total fees
Base Fee:
Provides a fixed floor to reward LPs even in calm markets.
Think of this as your guaranteed minimum paycheck.
Variable Fee:
Encourages LPs to stay in volatile markets by rewarding them with higher fees.
The more the price jumps around, the more LPs earn.
Worked Example:
Given:
Base Factor = 100
Bin Step = 5
Volatility Accumulator = 50,000
Control = 2,500
Results:
2. Volatility Management System
To avoid manipulation and overreaction to short-term noise, Ferra introduces a decay-based tracking system.
Accumulator Formula:
Tracks how far price has moved from its last "anchor" bin.
Time-Weighted Decay Logic:
Δt < t_f (Filter)
No update — blocks spam/MEV
t_f ≤ Δt < t_d (Decay)
Volatility decays by reduction factor
Δt ≥ t_d (Reset)
Full reset of volatility tracker
Think of it like a memory that forgets old volatility if things calm down.
Worked Example:
3. Specialized Fee Types
Composition Fee:
Prevents LP manipulation from imbalanced deposits (e.g., only one token).
Triggered when a deposit skews the ideal token ratio.
Applies only in active bins.
Flash Loan Fee:
Charged on flash loans independently of volatility.
Max Fee: 10%
Flat Rate: Does not vary with volatility
Worked Example:
Given:
Excess deposit: 300 USDC
Total fee: 1%
Results:
4. Fee Distribution Logic
Fees are distributed proportionally based on LP contribution per bin.
Bin-Level Fee Growth:
LP Earnings Formula:
Ensures long-term LPs earn more if they stay in active bins.
Worked Example:
Given:
Total Fee: 100 USDC
Protocol Share: 20%
Results:
5. Configuration Parameters
Static (Set on Pool Init)
Base Factor, Variable Fee Control, Protocol Share, Max Volatility, t_f, t_d, Reduction Factor
Dynamic (Updated with Trades)
Volatility Accumulator, Reference Bin, Last Update Timestamp
Last updated