fn owner(env: soroban_sdk::Env) -> soroban_sdk::Address
Blend's flash-loan callback (moderc3156::FlashLoan). Called by the pool
after it has transferred the loan here and before it settles requests.
Runs the armed plan, then hands everything we hold of token back to
caller, whose Repay request the pool collects next. Anything above the
loan is profit and lands with the initiator too.
fn exec_op(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
token: soroban_sdk::Address,
amount: i128,
fee: i128,
)
Run a plan against funds this contract already holds. Owner only.
Cross-venue arbitrage without a flash loan, and the unwind path for a liquidation position.
fn execute(
env: soroban_sdk::Env,
steps: soroban_sdk::Vec,
) -> soroban_sdk::Vec
Arm the plan that the next exec_op will run, and record who the loan's
from will be. Owner only, single-use.
Callable by an initiator contract (owner == initiator, in one transaction) or by a wallet that owns this receiver directly and starts the flash loan itself in a following transaction -- Blend's canonical pattern, at the cost of a second ledger.
fn set_plan(
env: soroban_sdk::Env,
initiator: soroban_sdk::Address,
steps: soroban_sdk::Vec,
)
Sweep funds out. Owner only.
fn withdraw(
env: soroban_sdk::Env,
token: soroban_sdk::Address,
amount: i128,
to: soroban_sdk::Address,
)
fn set_owner(env: soroban_sdk::Env, new_owner: soroban_sdk::Address)
owner is the only address that can arm a plan, start a flash loan, run
a plan from held funds, or withdraw.
fn __constructor(env: soroban_sdk::Env, owner: soroban_sdk::Address)
Borrow amount of asset from pool, have receiver run steps with
it, then let the pool settle requests against us. Owner only.
For a pure arbitrage, requests is a single Repay of amount plus a
hair (dToken rounding at non-unit rates; Blend caps repayment at the
outstanding debt, so over-asking is safe). For a liquidation it is the
auction fill plus repayment of the liquidated debt, and we exit holding a
healthy position to unwind later.
Returns the change in our asset balance: realised profit.
fn flash_execute(
env: soroban_sdk::Env,
pool: soroban_sdk::Address,
receiver: soroban_sdk::Address,
asset: soroban_sdk::Address,
amount: i128,
steps: soroban_sdk::Vec,
requests: soroban_sdk::Vec,
) -> i128