Contract e5f5f3a0e803f9535e8dab91c1cd1f29e40dc02afa211b8ef766cee6d43528d5

← Back to Index 📥 Download WASM

Meta

rssdkver 23.0.3#6aa930b08eabfd578b7824a0d5de473cbd958282
rsver 1.89.0

Instances

  • CBGUSBIE5QCY6FMJOFW7XB6AGFSYNTPF7H2M2W5U7NLLO3OCYJN567HF

Interface

Main entry point for executing arbitrage with flash loan

Flow:

  1. Stores invocations and parameters in temporary storage
  2. Calls Blend pool's flash_loan function
  3. Blend transfers loan_asset to this contract
  4. Blend calls back to exec_op()
  5. exec_op() executes the stored invocations
  6. Blend pulls back the loan amount (automatic)
  7. Validates profitability and returns net profit

Arguments

  • caller - Address initiating the arbitrage (must authorize)
  • blend_pool - Blend pool contract address for flash loan
  • loan_asset - Token address to borrow
  • loan_amount - Amount to borrow (in token base units)
  • invocations - Vector of (contract_address, function_name, args) for DEX swaps
  • min_profit - Minimum profit threshold (reverts if not met)

Returns

Net profit amount (total received - loan amount)

Errors

  • Unauthorized - If caller doesn't authorize
  • InvalidInvocations - If invocations vector is empty or exceeds max
  • InsufficientProfit - If final profit < min_profit
fn pwnd_arb(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    blend_pool: soroban_sdk::Address,
    loan_asset: soroban_sdk::Address,
    loan_amount: i128,
    invocations: soroban_sdk::Vec<
        (soroban_sdk::Address, soroban_sdk::Symbol, soroban_sdk::Vec),
    >,
    min_profit: i128,
) -> Result

Blend flash loan callback (moderc3156 interface)

Called by Blend pool after flash loan is issued. Executes stored invocations and ensures loan is repaid.

Arguments

  • caller - Original user who requested flash loan
  • token - Flash loaned asset address
  • amount - Flash loan amount
  • fee - Flash loan fee (currently 0 on Blend)
fn exec_op(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    token: soroban_sdk::Address,
    amount: i128,
    fee: i128,
) -> Result<(), ArbitrageError>
fn pwnd_exec(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    invocations: soroban_sdk::Vec<
        (
            soroban_sdk::Address,
            soroban_sdk::Symbol,
            soroban_sdk::Vec,
            bool,
        ),
    >,
) -> soroban_sdk::Vec

Imports

WebAssembly Text (WAT) ▶