Contract 075d05e805432fe18a7d1ae5b76040d3317d2f737dba788ed1e6fe3704affc49

← Back to Index 📥 Download WASM

Meta

rssdkver 23.2.1#ab415a33cc1f6bdce20ac4a12f0ddbe41a648949
rsver 1.92.0

Instances

  • CASCX6HLJAFU6LQ6VYMFI3FIMUIEVOQQ6QRNRTSGEXYNEMWVSSIAYLPE

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.

receiver is the optional Stellar address that the final output_token balance is delivered to. None (default) sends it back to user. Some(addr) re

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