Dynamic Fees
A key innovation of Magma Finance's ALMM is the dynamic fee mechanism. This system adjusts the trading fees based on market volatility, providing better protection for liquidity providers (LPs) against impermanent loss and allowing them to capitalize on market fluctuations.
How Dynamic Fees Work
The total swap fee in an ALMM pool is composed of two parts:
Base Fee: This is a fixed fee component determined by the pool's bin step and a base factor. It provides a consistent baseline of earnings for LPs.
Variable Fee: This is the dynamic component. The variable fee increases in real-time as the market experiences higher volatility. Volatility is measured by factors such as the frequency of swaps and the number of price bins crossed in a short period.
When the market is calm, fees are lower, encouraging more trading activity. When the market becomes volatile, fees automatically increase. This has two main benefits:
Compensating LPs: The higher fees help to compensate LPs for the increased risk of impermanent loss that comes with high volatility.
Deterring Sniper Bots: In situations like new token launches, high initial volatility can lead to sniper bots extracting value from the pool. The dynamic fees act as a form of "surge pricing," which can mitigate this and capture more value for the LPs and the token project.
Fee Distribution
Fees are calculated and distributed on a per-bin basis. When a swap crosses a liquidity bin, the fees generated from that part of the trade are allocated to the LPs who have provided liquidity in that specific bin. This ensures a fair and granular distribution of rewards.
LPs can claim their accumulated fees at any time from their position management page. The dynamic fee system is a powerful tool that aligns the interests of LPs with the market conditions, making the ALMM a more robust and sustainable liquidity protocol.
Details
Volatility-Based Adjustment:
ALMM uses a fee scheduler that monitors the price volatility of the token pair, typically measured over a short time window (e.g., recent price movements or oracle data).
Volatility is assessed using metrics like price range fluctuations or standard deviation of price changes within the pool.
When volatility is high, fees increase to compensate LPs for higher IL risk.
When volatility is low, fees decrease to attract more trading volume.
Fee Application:
Fees are charged on each trade within the active bin, where trades occur at a fixed price with zero slippage.
Fees are auto-compounded into the bin, increasing the LP’s position value without requiring manual reinvestment.
Base fees (e.g., 0.3%) are fixed, but dynamic fees scale with volatility—say, 0.5% to 1.5%—measured by bin crossings or trade frequency.
Example: During a 10% SUI price surge, fees might spike to 1%, offsetting impermanent loss (IL) and boosting LP revenue.
Fee Range:
The fee range is set by the pool creator and can vary based on the token pair and market conditions.
Typical ranges: 0.1% to 1%, with stable pairs (e.g., USDC/USDT) starting at lower fees (e.g., 0.1%) and volatile pairs (e.g., SUI/USDC) at higher fees (e.g., 0.3% or more).
The fee scheduler adjusts within this range dynamically.
Last updated