Skip to content

[Feature] Flash Loan Implementation with 0.05% Fee Model #172

Description

@AlAfiz

Description: Introduce flash loan capabilities to the TradeFlow liquidity pools. Users should be able to borrow arbitrary amounts of an asset in a single transaction, provided the borrowed amount plus a 0.05% protocol fee is returned by the end of the invocation.
Context / Motivation: Flash loans increase capital efficiency, empower arbitrageurs to keep TradeFlow prices aligned with the broader Stellar ecosystem, and generate additional passive yield for our Liquidity Providers.
Acceptance Criteria: - [ ] Create a flash_loan function that accepts a receiver contract address, asset, and amount.

  • Utilize a cross-contract call to the receiver's execute_operation function.
  • Assert that the pool balance post-execution is initial_balance + fee.
  • Implement reentrancy protection to prevent the receiver from draining the pool during the callback.
    Technical Pointers: Leverage Soroban's temporary storage for the reentrancy guard. The receiver contract must implement a specific interface trait to handle the callback; define this interface clearly in the project's interfaces/ module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaign

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions