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:
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)