Contract 7bc43d8486dfdcbee15979a288bd850cce12fb8b2aa1a5b088afbf7457bad3a6

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.95.0

Instances

  • CC6QAV7JEG5MYRSPO5Z65E5G2M4ZB64BEG2ZXIZXL55TQT35JDI2LC6K

Interface

Execute a swap atomically (single-path or split-order).

sub_routes is always a list of legs; a simple swap is one entry with the full amount_in and its hop steps. Split execution uses multiple entries.

Flow:

  1. Pull total input from user (sum of sub-route amounts)
  2. For each sub-route: execute its path with its allocated amount
  3. Sum outputs (all must produce the same token_out)
  4. Verify total output >= min_amount_out
  5. Transfer total output to user
fn swap(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    token_in: soroban_sdk::Address,
    token_out: soroban_sdk::Address,
    sub_routes: soroban_sdk::Vec,
    min_amount_out: i128,
) -> i128

Get the admin address.

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

Upgrade the contract WASM code. Only admin can call.

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

Initialize the contract with an admin address. Must be called once after deployment.

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

Imports

WebAssembly Text (WAT) ▶