Skip to content

[Feature] Impermanent Loss (IL) Protection for Long-Term LPs #179

Description

@AlAfiz

Description: Design a mechanism that tracks how long a user has provided liquidity and guarantees them a minimum return (offsetting impermanent loss) if they stay in the pool longer than 90 days.
Context / Motivation: Impermanent loss is the biggest deterrent to DeFi liquidity. By utilizing a protocol treasury to insure long-term LPs, TradeFlow can capture "sticky" liquidity that won't flee during market downturns.
Acceptance Criteria: - [ ] Record the precise ledger timestamp and asset ratio upon LP deposit.

  • Calculate the divergence loss upon withdrawal.
  • If the deposit age > 90 days, calculate the IL and mint/transfer compensation from the protocol treasury.
  • Cap the maximum IL compensation to protect protocol solvency.
    Technical Pointers: The math for IL requires calculating square roots. You may need to implement a basic Babylonian square root algorithm in Rust, as Soroban does not have native floating-point math.

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