Main entry point for executing arbitrage with flash loan
Flow:
caller - Address initiating the arbitrage (must authorize)blend_pool - Blend pool contract address for flash loanloan_asset - Token address to borrowloan_amount - Amount to borrow (in token base units)invocations - Vector of (contract_address, function_name, args) for DEX swapsmin_profit - Minimum profit threshold (reverts if not met)Net profit amount (total received - loan amount)
Unauthorized - If caller doesn't authorizeInvalidInvocations - If invocations vector is empty or exceeds maxInsufficientProfit - If final profit < min_profitfn 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.
caller - Original user who requested flash loantoken - Flash loaned asset addressamount - Flash loan amountfee - 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