Description
A static 0.3% fee is great, but next-generation DEXs adjust their fees dynamically based on market volatility.
If a pool is experiencing massive, unbalanced trades, the fee should temporarily increase to protect Liquidity Providers from impermanent loss.
We need to scaffold a function that calculates a "Volatility Multiplier" based on the ratio of recent trade sizes to total reserves.
For now, we will document the logic and return a mock multiplier so the core swap math can integrate it later.
Requirements
Description
A static 0.3% fee is great, but next-generation DEXs adjust their fees dynamically based on market volatility.
If a pool is experiencing massive, unbalanced trades, the fee should temporarily increase to protect Liquidity Providers from impermanent loss.
We need to scaffold a function that calculates a "Volatility Multiplier" based on the ratio of recent trade sizes to total reserves.
For now, we will document the logic and return a mock multiplier so the core swap math can integrate it later.
Requirements
calculate_volatility_fee_multiplier(trade_size, pool_reserve).1.0(standard 0.3% fee).1.5(effectively a 0.45% fee).