From 3a20f3681174ed69609810571e76fa3f0d986d4d Mon Sep 17 00:00:00 2001 From: Vivian-04 Date: Sat, 28 Mar 2026 07:34:01 +0100 Subject: [PATCH] feat: implement flash loan provider (resolved) --- Cargo.toml | 20 +++++++++++++++++++- pull_request.md | 22 ++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 pull_request.md diff --git a/Cargo.toml b/Cargo.toml index 4e4d6d4..a11eca5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,25 @@ [workspace] -members = ["src/upgradeable", "src/flash_loan"] +members = [ + "src/upgradeable", + "src/token", + "src/escrow_multisig", + "src/governance", + "src/flash_loan" +] resolver = "2" +[package] +name = "anchorpoint" +version = "0.1.0" +edition = "2021" + +[lib] +path = "src/vesting/lib.rs" + +[[test]] +name = "vesting" +path = "src/vesting/lib.rs" + [profile.release] opt-level = "z" overflow-checks = true diff --git a/pull_request.md b/pull_request.md new file mode 100644 index 0000000..058e586 --- /dev/null +++ b/pull_request.md @@ -0,0 +1,22 @@ +# Pull Request: Soroban Flash Loan Provider Implementation + +## Description +This PR implements a basic **Flash Loan Provider** smart contract for Soroban tokens, as requested in issue #22. + +The contract allows borrowers to take out instantaneous loans of any supported Soroban token, provided they return the principal plus a fixed fee within the same transaction. + +## Key Features +- **Flash Loan Mechanism**: Implements `flash_loan(receiver, token, amount)` which handles the funds transfer and external contract invocation. +- **Repayment Enforcement**: Atomic balance verification ensures that the contract's balance is restored with the required fee (0.05%) by the end of the execution logic. +- **Event Emission**: Publishes a `flash_ln` event upon every successful loan execution for transparency and tracking. +- **Unit Testing**: Includes a comprehensive test suite (`tests.rs`) with mock receivers to validate both successful repayments and failed (reverted) loans. + +## Implementation Details +- **Location**: `src/flash_loan/` +- **Fee Structure**: Fixed at 5 basis points (0.05%). +- **Receiver Interface**: Borrowers must implement the `FlashLoanReceiver` trait's `execute_loan` method. + +## Verification +I have manually verified the implementation logic against Soroban SDK standards and existing patterns in the `AnchorPoint` repository. The code structures and dependency management match the project's architecture. + +Fixes #22