Contract ab753755bebe2636e65b78daf07b905f6c267f494ae5eb5d189ac5d0a8fd68ea

← Back to Index 📥 Download WASM

Meta

rssdkver 23.2.1#ab415a33cc1f6bdce20ac4a12f0ddbe41a648949
rsver 1.90.0

Instances

  • CA5IIXUZPLUSMDIFQDPT54LBWK56Q2X37YUV4IL5RWVTAF7VMEGAERNZ
  • CDSIKBW2TXQRCHIWIYMYFGML4L5ADTE33W2JAYVC7W2EKDD4EWPDF4L6

Interface

Initialize the contract with admin and pool addresses

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    pool: soroban_sdk::Address,
) -> Result<(), MarginManagerError>

Set the Aquarius AMM router address

fn set_aqua_router(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    router: soroban_sdk::Address,
) -> Result<(), MarginManagerError>

Set the swap configuration for the next operation This should be called before initiating a flash loan Note: No auth required as this is a temporary config cleared after exec_op

fn set_swap_config(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    token_out: soroban_sdk::Address,
    min_amount_out: i128,
)

Get the pool address

fn get_pool(env: soroban_sdk::Env) -> soroban_sdk::Address

Get the admin address

fn get_admin(env: soroban_sdk::Env) -> soroban_sdk::Address

Get the Aquarius router address

fn get_aqua_router(env: soroban_sdk::Env) -> Option

exec_op - The callback function called by Blend Pool during flash loan

This is the Modified ERC-3156 interface that Blend uses. The pool calls this function after transferring the flash loan tokens.

Behavior:

  1. Receives flash loaned tokens
  2. If swap config is set, swaps tokens via Aquarius AMM
  3. Transfers output tokens to the caller (user)

Arguments:

  • caller: The address that initiated the flash loan
  • token: The token address being flash loaned (token_in for swap)
  • amount: The amount of tokens received
  • fee: The fee for the flash loan (currently 0 in Blend)
fn exec_op(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    token: soroban_sdk::Address,
    amount: i128,
    fee: i128,
)

Create a supply collateral request

fn make_supply_collateral_request(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    amount: i128,
) -> Request

Create a borrow request

fn make_borrow_request(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    amount: i128,
) -> Request

Create a repay request

fn make_repay_request(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    amount: i128,
) -> Request

Create a withdraw collateral request

fn make_withdraw_collateral_request(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    amount: i128,
) -> Request

Create a supply request

fn make_supply_request(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    amount: i128,
) -> Request

Create a withdraw request

fn make_withdraw_request(
    env: soroban_sdk::Env,
    asset: soroban_sdk::Address,
    amount: i128,
) -> Request

Imports

WebAssembly Text (WAT) ▶