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:
Arguments:
fn exec_op(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
token: soroban_sdk::Address,
amount: i128,
fee: 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
Initialize the contract with admin and pool addresses
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
pool: soroban_sdk::Address,
) -> Result<(), MarginManagerError>
Helper to create a SwapHop for use in swap_chain
fn make_swap_hop(
env: soroban_sdk::Env,
tokens_in_pool: soroban_sdk::Vec,
pool_index: soroban_sdk::BytesN<32>,
token_out: soroban_sdk::Address,
) -> SwapHop
Get the Aquarius router address
fn get_aqua_router(env: soroban_sdk::Env) -> Option
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
Arguments:
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,
swap_chain: soroban_sdk::Vec,
)
Helper to create default pool index (32 zero bytes)
fn default_pool_index(env: soroban_sdk::Env) -> soroban_sdk::BytesN<32>
Create a repay request
fn make_repay_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 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
Create a supply collateral request
fn make_supply_collateral_request(
env: soroban_sdk::Env,
asset: soroban_sdk::Address,
amount: i128,
) -> Request
Set swap config for strict-receive mode. In this mode, swap_chained_strict_receive is called:
fn set_swap_config_strict_receive(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
token_out: soroban_sdk::Address,
desired_amount_out: i128,
swap_chain: soroban_sdk::Vec,
)
Create a withdraw collateral request
fn make_withdraw_collateral_request(
env: soroban_sdk::Env,
asset: soroban_sdk::Address,
amount: i128,
) -> Request