Stores the orchestrator ("executor") address. The receiver trusts exactly
this address to arm/disarm it and to appear as caller in exec_op.
Wired post-deploy from the executor side via set_receiver (circular dep).
fn __constructor(env: soroban_sdk::Env, executor: soroban_sdk::Address)
Executor-only: stage the flight for the imminent flash loan. This is a
sub-call from executor.execute that RETURNS before pool.flash_loan is
invoked, so the receiver is off the call stack when the pool later calls
exec_op — the whole point of the two-contract split (no re-entry).
fn arm(
env: soroban_sdk::Env,
token: soroban_sdk::Address,
amount: i128,
legs: soroban_sdk::Vec,
)
Blend flash-loan callback (moderc3156 shape). Legal ONLY inside an armed,
unconsumed flight whose caller/token/amount match. Runs the legs and
sweeps the full loan-asset balance (repayment + profit) back to the executor.
fn exec_op(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
token: soroban_sdk::Address,
amount: i128,
_fee: i128,
)
Executor-only: close out the flight. Panics unless exec_op consumed it —
this is the guard that proves the pool actually ran the callback. A pool
that skipped exec_op (e.g. to repay itself from the executor's prior
profits) leaves the flight unconsumed, so disarm reverts the whole tx.
fn disarm(env: soroban_sdk::Env)
Executor-only: run an owned-funds cycle. The executor has already
transferred amount of token here; run the legs and sweep the entire
token balance back. No flight staging: unlike the flash path there is
no external callback (executor -> receiver is a plain sub-call), so
arm/disarm's callback-proof machinery does not apply.
fn exec_owned(
env: soroban_sdk::Env,
token: soroban_sdk::Address,
amount: i128,
legs: soroban_sdk::Vec,
)
Upgrade the receiver wasm. Authorized by the stored executor address (the
receiver's admin proxy). In practice a receiver is replaced by deploying a
new one and calling executor.set_receiver; this exists for in-place upgrades
driven through the executor's admin. See docs/modules/executor.md.
fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)