Contract fa36076e2213145f9e0882ebf543bef9883e55405be5da7cd68e4af06317d120

← Back to Index 📥 Download WASM

Meta

rssdkver 23.2.1#ab415a33cc1f6bdce20ac4a12f0ddbe41a648949
rsver 1.92.0

Instances

  • CBD3MJKDDZ5I3CKIWOUMR2TX745KGDFAABBGJLTQR3DFYFOLBAPYXRMF

Interface

v2 — CUSTODIAL routing. The router pulls input_amount of input_token from user, runs each step on the held funds (using authorize_as_current_contract to authorize what each target pulls from the router), optionally takes intermediate fees from any token the router holds mid-route, and finally sends the residual output_token (and any remaining input_token) to user.

Returns: the user's final received amount of output_token, NET of any output-side fee.

Use this entry point when:

  • Another contract is calling the router (source-account auth doesn't apply; the calling contract authorizes only the initial pull).
  • You need a fee from an intermediate token (e.g. swap A→B, fee in B, bridge B).
  • Sponsored / fee-bumped flows where user is not the tx source.
fn route(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    swap_id: soroban_sdk::BytesN<16>,
    input_token: soroban_sdk::Address,
    input_amount: u128,
    output_token: soroban_sdk::Address,
    steps: soroban_sdk::Vec,
    affiliate_fees: soroban_sdk::Vec,
    fee_position: FeePosition,
    intermediate_fees: soroban_sdk::Vec,
) -> u128

Aggregate multiple contract calls in a single tx, with affiliate fees taken either from the input token (before instructions) or from the output token (after instructions), per fee_position.

Returns the user's actual output_token amount NET of any output-side fee.

Permissionless: there is no allowlist of targets. The user signs a tx that contains the exact instructions vector being authorized; their signature is the authorization. The router does not custody funds and cannot move tokens beyond what the user has signed for (directly or via source-account auth).

fn execute(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    swap_id: soroban_sdk::BytesN<16>,
    input_token: soroban_sdk::Address,
    input_amount: u128,
    output_token: soroban_sdk::Address,
    instructions: soroban_sdk::Vec,
    affiliate_fees: soroban_sdk::Vec,
    fee_position: FeePosition,
) -> u128

Permissionless TTL keep-alive. Anyone can call to keep the contract's instance entry alive during cold periods.

fn bump_ttl(env: soroban_sdk::Env)

Imports

WebAssembly Text (WAT) ▶