Contract dfe6958b221cd42be23fe44a90cab8a0a24a69de5b52ad3096ecd88e072d3513

← Back to Index 📥 Download WASM

Meta

rssdkver 23.2.1#ab415a33cc1f6bdce20ac4a12f0ddbe41a648949
rsver 1.92.0

Instances

  • CDW43DYWJ3WHPOBXABH6MC3TKAM765UPT6BSL2LDQ5CHN3NQXMPSA677

Interface

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), takes a single affiliate fee at fee_position, and finally transfers the router's output_token balance to user.

fee_position semantics:

  • 0 — fee is taken from input_token before any step runs (basis: input_amount).
  • i ∈ 1..=n — fee is taken from steps[i-1].output_token after that step returns (basis: router's balance of that token at that moment). steps[i-1].output_token MUST be Some.
  • Any value > n is an InvalidFeePosition error.

When the fee is taken on a step's output_token, returns[i-1] is refreshed to the post-fee router balance so any later step's arg_refs thread the actually available amount.

Returns: the user's final received amount of output_token.

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: u32,
) -> 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) ▶