- Linear (Mode 3)
- Exponential (Mode 4)
Math Formula
Step 1: Calculate Passed Periods
The number of periods passed is determined by how much the sqrt price has increased from the initial price:
Where:
current_sqrt_price: The current sqrt price of the poolinitial_sqrt_price: The initial sqrt price when the pool was createdsqrt_price_step_bps: The sqrt price increase (in bps) required to advance one period
Step 2: Calculate Current Fee
There are two modes for fee calculation:Linear Fee Market Cap Scheduler (Mode 3)
The fee decreases by a constant amount (
reduction_factor) for each period passed.
Exponential Fee Market Cap Scheduler (Mode 4)
The fee decreases by a percentage of the current fee for each period passed.
Scheduler Expiration
The scheduler has an expiration mechanism to ensure fees eventually reach the minimum:- If
current_point > expiration_point, the scheduler expires - When expired, the fee defaults to the minimum fee (fee calculated at
number_of_period) - This prevents fees from staying high indefinitely if the price doesn’t increase
Edge Cases
| Condition | Behavior |
|---|---|
current_sqrt_price <= init_sqrt_price | passed_period = 0 (fee stays at cliff fee) |
passed_period > number_of_period | passed_period = number_of_period (fee at minimum) |
| Scheduler expired | Fee defaults to minimum fee |
| Alpha Vault buying (before activation) | Fee at minimum fee |
Example Calculations
Linear Mode Example
Given:cliff_fee_numerator: 500,000,000 (50% fee)number_of_period: 100sqrt_price_step_bps: 100 (1% sqrt price step)reduction_factor: 4,950,000init_sqrt_price: 1,000,000current_sqrt_price: 1,050,000 (5% increase)
Exponential Mode Example
Given:cliff_fee_numerator: 500,000,000 (50% fee)number_of_period: 100sqrt_price_step_bps: 100 (1% sqrt price step)reduction_factor: 390 (3.9% reduction per period)init_sqrt_price: 1,000,000current_sqrt_price: 1,050,000 (5% increase)
Fee Numerator Conversion
To convert fee numerator to percentage:- 500,000,000 = 50% fee
- 10,000,000 = 1% fee
- 100,000,000 = 10% fee

