Contract 143def7c77379046976608f3976a10143be98d5773f3dc0c7f4a2915331d54e3

← Back to Index 📥 Download WASM

Meta

cliver 25.2.0#
rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.95.0

Instances

  • CDKZWJ4AXU2RLZRTIPTS6HIQ4UBLEQLDE3XA7RR4IEW5QE7OUOJ6PKVQ

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)

Round-trip swap: base → bridge (split OK) → base (split OK) in one atomic invocation.

Funds are pulled from user and the final base_token balance is returned to user. The contract does not retain funds after execution.

  • leg_out: sub-routes from base_token to bridge_token; amount_in must sum to amount_in
  • leg_back: sub-routes from bridge_token to base_token; amount_in must sum to leg_out output
  • min_amount_out: minimum total base_token returned (principal + profit floor)
fn round_trip_swap(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    base_token: soroban_sdk::Address,
    bridge_token: soroban_sdk::Address,
    amount_in: i128,
    leg_out: soroban_sdk::Vec,
    leg_back: soroban_sdk::Vec,
    min_amount_out: i128,
) -> i128
fn admin(env: soroban_sdk::Env) -> soroban_sdk::Address

Pull tokens from from into the vault (any account may fund the vault).

fn deposit(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    token: soroban_sdk::Address,
    amount: i128,
)
fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)
fn is_caller(env: soroban_sdk::Env, caller: soroban_sdk::Address) -> bool
fn add_caller(env: soroban_sdk::Env, caller: soroban_sdk::Address)
fn initialize(env: soroban_sdk::Env, admin: soroban_sdk::Address)
fn remove_caller(env: soroban_sdk::Env, caller: soroban_sdk::Address)

Admin emergency withdrawal from vault balances.

fn admin_withdraw(
    env: soroban_sdk::Env,
    token: soroban_sdk::Address,
    to: soroban_sdk::Address,
    amount: i128,
)

Authorized caller executes a round-trip arb atomically: vault → caller → aggregator → caller → vault.

fn execute_round_trip(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    aggregator: soroban_sdk::Address,
    base_token: soroban_sdk::Address,
    bridge_token: soroban_sdk::Address,
    amount_in: i128,
    leg_out: soroban_sdk::Vec,
    leg_back: soroban_sdk::Vec,
    min_amount_out: i128,
) -> i128

Imports

WebAssembly Text (WAT) ▶