Contract 79948997fe8f21c040cf46a0af478c3c05b6367a2ccbed7ae98a9209ba5ee925

← Back to Index 📥 Download WASM

Meta

cliver 26.0.0#60f7458e7ecffddf2f2d91dc6d0d2db4fab03ecc
rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.95.0

Instances

  • CBQMMHWFU6S7UFWHDFM7S6QUFV7SJHCIZG355AD5P26F73R2XDRFHFSX

Interface

One Aquarius swap through the router's swap_chained.

pool_tokens — the pool's ordered token vector (canonical, by contract-id). For USDC/AQUA: [AQUA_SAC, USDC_SAC]. pool_index — the pool hash (BytesN<32>) from get_pools. pool — the pool contract address (the router pulls token_in into it; used for the auth subtree). token_in/out — SAC contract ids.

swap_chained(user, swaps_chain, token_in, in_amount, out_min): swaps_chain = [ (pool_tokens, pool_index, token_out) ] (single hop)

Returns the amount of token_out delivered (u128 -> i128).

fn swap_aqua(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    aqua_router: soroban_sdk::Address,
    pool: soroban_sdk::Address,
    pool_tokens: soroban_sdk::Vec,
    pool_index: soroban_sdk::BytesN<32>,
    token_in: soroban_sdk::Address,
    token_out: soroban_sdk::Address,
    amount_in: i128,
    amount_out_min: i128,
) -> i128

One Soroswap swap along path. (S1 — proven on mainnet.)

fn swap_soroswap(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    soroswap_router: soroban_sdk::Address,
    pool: soroban_sdk::Address,
    token_in: soroban_sdk::Address,
    token_out: soroban_sdk::Address,
    amount_in: i128,
    amount_out_min: i128,
    path: soroban_sdk::Vec,
    deadline: u64,
) -> i128

CROSS-PROTOCOL chain in ONE call (S3): leg 1 Aquarius, leg 2 Soroswap. token_in --[aqua]--> mid_token --[soroswap]--> token_out.

The contract holds the intermediate (mid_token) and feeds its ACTUAL balance into leg 2 — the exact mechanic the parts splitter (S4) generalizes. Soroswap's own aggregator cannot do this: one DexDistribution path is single-protocol.

Auth targets are the ones proven on mainnet:

  • Aquarius pulls token_in to the ROUTER (swap_aqua / S2)
  • Soroswap pulls mid_token to the POOL (swap_soroswap / S1)
fn swap_aqua_then_soroswap(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    aqua_router: soroban_sdk::Address,
    aqua_pool_tokens: soroban_sdk::Vec,
    aqua_pool_index: soroban_sdk::BytesN<32>,
    token_in: soroban_sdk::Address,
    mid_token: soroban_sdk::Address,
    soroswap_router: soroban_sdk::Address,
    soroswap_pool: soroban_sdk::Address,
    soroswap_path: soroban_sdk::Vec,
    token_out: soroban_sdk::Address,
    amount_in: i128,
    amount_out_min: i128,
    deadline: u64,
) -> i128

Imports

WebAssembly Text (WAT) ▶