Contract 707e03a868d58d2494b38ab43980d4184ed31fc2de9d8843862f09404b8d653d

← Back to Index 📥 Download WASM

Meta

rssdkver 26.1.0#175aa41306f383057a8cdfc84b68d931664fc34e
rsver 1.96.0

Instances

  • CAQGO4PCSSI3SBOP7773CEOGOSLY2YATFWUVCOHCGSUAIDRVAN4TQQJI

Interface

Current admin (read-only).

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

Execute a multi-hop atomic arb.

Flow:

  1. caller authorises this invocation (must include token transfer auth).
  2. Contract pulls amount_in of token_in from caller.
  3. Each hop executes a cross-contract DEX swap.
  4. Final balance is verified against min_final_out; panics if below.
  5. Final tokens are returned to caller.

For cyclic arbs, token_in equals the last hop's output token. Returns the final output amount.

fn execute(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    token_in: soroban_sdk::Address,
    amount_in: i128,
    min_final_out: i128,
    hops: soroban_sdk::Vec,
) -> i128

Replace this contract's WASM with the code identified by new_wasm_hash (which must already be installed on-chain). Admin-gated; instance storage (the admin) is preserved across the upgrade. Takes effect for invocations after this transaction.

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

On-chain code version. Bump on each upgrade so callers can detect which WASM is live.

fn version(env: soroban_sdk::Env) -> u32

Rotate the upgrade admin. Admin-gated by the current admin.

fn set_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)

Execute a multi-hop atomic swap along an OPEN path (token_in need NOT equal the final output token).

Identical to [Self::execute] except it drops the NotCyclic invariant: the route is a leg token_in → … → token_out, not a closed cycle. min_final_out is denominated in the route's FINAL output token, and those final tokens are returned to caller. Returns the final amount.

This is the Soroban segment primitive for the mixed (native↔soroban) lane: a mixed cycle crosses the lane boundary and so executes as a sequence of single-lane txs, and every such Soroban segment is an open leg (e.g. M→XLM), never a self-contained cycle. The per-hop and final amount_out_min/min_final_out guards still make a decayed leg revert atomically — what they CANNOT do is unwind an already-completed earlier segment in a different tx; that inventory risk is the multi-tx caller's to manage, not the contract's.

fn execute_open(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    token_in: soroban_sdk::Address,
    amount_in: i128,
    min_final_out: i128,
    hops: soroban_sdk::Vec,
) -> i128

Set the upgrade admin at deploy time. Runs exactly once, atomically with deployment, so the contract is never live without an admin. admin is the only address that can later call [Self::upgrade] or [Self::set_admin].

fn __constructor(env: soroban_sdk::Env, admin: soroban_sdk::Address)

Imports

WebAssembly Text (WAT) ▶