Skip to content

[Feature] Dynamic Swap Fees Based on Pool Volatility #176

Description

@AlAfiz

Description: Upgrade the AMM logic from a fixed 0.3% swap fee to a dynamic fee model that increases during times of high market volatility and decreases during stable periods.
Context / Motivation: Fixed fees often fail to compensate LPs adequately during high-volatility events, leading to impermanent loss. A dynamic fee curve protects LPs and optimizes volume during calm periods.
Acceptance Criteria: - [ ] Implement a volatility oracle based on recent trade sizes and price impacts over the last N ledgers.

  • Create a fee calculation function that scales between MIN_FEE (0.1%) and MAX_FEE (1.0%) based on the volatility metric.
  • Integrate this calculation securely into the main swap entrypoint.
    Technical Pointers: You will need to maintain a moving average of recent price shifts in instance or persistent storage. Keep the math lightweight to avoid exceeding Soroban's instruction limits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaignhelp wantedExtra attention is needed

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions