Contract c29e487b724e6cb48c4a0ee9f31476febedfcf25cbb61182dc694d99b617814b

← Back to Index 📥 Download WASM

Meta

cliver 25.2.0#28484880988199233a7e8e87c97cb12dac323cb3
rssdkver 25.3.2#076083c6fe32ab89660da9eb90f34445eea46079
rsver 1.91.1

Instances

  • CB63TRIMR33V5P6YZCV6IQLLIVESGQMMVZBBWP2MD2KFN4CME7XWZOPZ
  • CDY2LPIUG3WWRD2I6WK6VO42IP73P5NOHLIKTDKC3WDOPLOP4MFROKY5

Interface

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

Pull a balance off a receiver this contract owns, back here. Owner only.

A receiver's owner is a contract, and a contract cannot sign, so without this any token that ever landed on a receiver -- a mistaken transfer, a plan cut short -- would have no way out. This contract is the receiver's owner and its direct invoker here, so the receiver's owner check is met by invoker authorization; withdraw then sweeps it the rest of the way to the account.

fn sweep(
    env: soroban_sdk::Env,
    receiver: soroban_sdk::Address,
    token: soroban_sdk::Address,
    amount: i128,
)

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

Replace this contract's code in place. Owner only.

Storage -- the owner and any held balances -- survives, so a fix ships without redeploying, re-funding and re-pointing the bot.

fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)

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

Imports

WebAssembly Text (WAT) ▶