Contract 272253de67fe19e0601d2c597d5f0f29e07dcbacd556528a1ed546165657ea89

← Back to Index 📥 Download WASM

Meta

rssdkver 23.0.2#a97daf8b07cdf24e9bd45e344db51a21b9ea77d3
rsver 1.89.0

Instances

  • CDKKPFBNNQETVN4Y2CIU6CQMWCPIZDXDZE76IDSTF7HLQT6Q573PCDTH

Interface

Execute flash loan with custom flash strategy

This is the safe entry point for all flash loans. The FlashExecutor:

  1. Validates the user authorized this transaction (user.require_auth)
  2. Calls flash_begin() as the initiator (only FlashExecutor is authorized)
  3. Invokes the user's FlashStrategy contract with borrowed tokens
  4. Always calls flash_end() to verify repayment

Arguments

  • pool - Pool address to borrow from
  • strategy - User's strategy contract address
  • user - Address of user initiating the flash loan (must sign transaction)
  • amount0 - Amount of token0 to borrow
  • amount1 - Amount of token1 to borrow
  • data - Arbitrary data passed to strategy

Strategy Access Control

Strategies receive user in FlashStrategyParams and can:

  • Ignore it for permissionless execution (default)
  • Check against allowlist for restricted access
  • Implement custom authorization logic

Returns

  • Ok(()) - Flash loan executed successfully
  • Err(Error) - Flash loan failed (insufficient repayment, strat
fn execute_flash_loan(
    env: soroban_sdk::Env,
    pool: soroban_sdk::Address,
    strategy: soroban_sdk::Address,
    user: soroban_sdk::Address,
    amount0: u128,
    amount1: u128,
    data: soroban_sdk::Bytes,
) -> Result<(), soroban_sdk::Error>

Imports

WebAssembly Text (WAT) ▶