-
Notifications
You must be signed in to change notification settings - Fork 34
feat: Implement dynamic fee logic scaffolding based on pool volatility #76
Copy link
Copy link
Open
Description
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
- Create a helper function
calculate_volatility_fee_multiplier(trade_size, pool_reserve). - If the trade size is less than 1% of the reserve, return a multiplier of
1.0(standard 0.3% fee). - If the trade size exceeds 5% of the reserve, return a multiplier of
1.5(effectively a 0.45% fee). - Add detailed inline documentation explaining how this protects LPs during extreme market events.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels