fn owner(env: soroban_sdk::Env) -> soroban_sdk::Address
Drain stranded balances (incl. accumulated, not-yet-converted fees).
amount = 0 sweeps the full balance.
fn sweep(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
asset: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
) -> Result
fn fee_to(env: soroban_sdk::Env) -> Option
fn fee_ppm(env: soroban_sdk::Env) -> u32
Registry lookups (used by the backend to encode compact routes).
fn pool_id(env: soroban_sdk::Env, pool: soroban_sdk::Address) -> Option
fn set_fee(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
fee_ppm: u32,
) -> Result<(), SwapError>
fn upgrade(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
new_wasm_hash: soroban_sdk::BytesN<32>,
) -> Result<(), SwapError>
fn version(env: soroban_sdk::Env) -> u32
fn token_id(env: soroban_sdk::Env, token: soroban_sdk::Address) -> Option
fn pool_addr(env: soroban_sdk::Env, id: u32) -> Option
Legacy ā toggle the pre-registry (target, fn) allowlist. Kept only so
the owner can clear stale pre-registry entries (allowed = false);
run_step no longer consults it (the registry is the allowlist).
fn allow_pool(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
target: soroban_sdk::Address,
fns: soroban_sdk::Vec,
allowed: bool,
) -> Result<(), SwapError>
Aggregated, atomic swap with a platform-fee skim.
user: the trader and transaction source (single signature).asset_in / total_amount_in: pulled from user into the contract.asset_out / min_total_out: revert unless the contract nets at least
min_total_out of asset_out across all routes.routes: the split ā each route is (amount_in, path): amount_in of
asset_in through its own path. sum(amount_in) must equal
total_amount_in - fee. A path of more than one Step is a chained
multi-hop (AāCāB): each hop after the first swaps exactly what the
previous hop deposited into the router (its Step.amount_in is advisory
only), so the intermediate amount never has to be predicted at signing time.Steps reference pools/tokens by registry id (compact payload); the ids
are resolved to Addresses on-chain. asset_in/asset_out/user stay full
Addresses so the submit-side fact derivation + event need no registry.
swap_split_trust is the identical operation that additio
fn swap_split(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
asset_in: soroban_sdk::Address,
total_amount_in: i128,
asset_out: soroban_sdk::Address,
min_total_out: i128,
routes: soroban_sdk::Vec,
fee_ppm_override: Option,
) -> Result
fn token_addr(env: soroban_sdk::Env, id: u32) -> Option
fn account_fee(env: soroban_sdk::Env, account: soroban_sdk::Address) -> Option
fn update_owner(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
new_owner: soroban_sdk::Address,
) -> Result<(), SwapError>
fn __constructor(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
fee_ppm: u32,
fee_to: soroban_sdk::Address,
fee_asset: soroban_sdk::Address,
)
Backward-compatible view ā a registered pool is callable with its venue's
fixed function, so this mirrors is_target_allowed regardless of fn_name.
fn is_fn_allowed(
env: soroban_sdk::Env,
target: soroban_sdk::Address,
fn_name: soroban_sdk::Symbol,
) -> bool
Register a swap-target pool, returning its registry id. Idempotent ā a
pool already registered returns its existing id. Registration IS the
allowlist: run_step will only route through a registered pool.
fn register_pool(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
pool: soroban_sdk::Address,
) -> Result
fn set_fee_token(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
fee_asset: soroban_sdk::Address,
) -> Result<(), SwapError>
fn fee_authorizer(env: soroban_sdk::Env) -> Option
Batch-register pools (the discovery backfill / sync), returning their ids.
fn register_pools(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
pools: soroban_sdk::Vec,
) -> Result, SwapError>
Register a token (SAC), returning its registry id. Idempotent.
fn register_token(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
token: soroban_sdk::Address,
) -> Result
Batch-register tokens, returning their ids.
fn register_tokens(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
tokens: soroban_sdk::Vec,
) -> Result, SwapError>
Set a per-account fee override in ppm (e.g. 0 for an internal service
account that should swap fee-free). Applies automatically on every swap by
account, ahead of the default fee and any per-swap voucher.
fn set_account_fee(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
account: soroban_sdk::Address,
fee_ppm: u32,
) -> Result<(), SwapError>
Identical to swap_split in args and economics, but FIRST establishes the user's
asset_out trustline in this same transaction (CAP-73 SAC trust) so a swap into a
fresh CLASSIC asset settles without a separate ChangeTrust tx. The backend calls this
in place of swap_split ONLY when the output is a classic-asset SAC the user does not
yet trust ā never for Soroban-native tokens (no trustline / no trust fn). The trust
call is a no-op if the trustline already exists, and its user.require_auth() is
covered by the user's existing source-account signature (no extra signature).
fn swap_split_trust(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
asset_in: soroban_sdk::Address,
total_amount_in: i128,
asset_out: soroban_sdk::Address,
min_total_out: i128,
routes: soroban_sdk::Vec,
fee_ppm_override: Option,
) -> Result
Remove an account's fee override (it reverts to the default fee).
fn clear_account_fee(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
account: soroban_sdk::Address,
) -> Result<(), SwapError>
A target is "allowed" iff it is registered (the registry is the allowlist). Backward-compatible view name for the discovery/reconcile tooling.
fn is_target_allowed(env: soroban_sdk::Env, target: soroban_sdk::Address) -> bool
fn set_fee_recipient(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
fee_to: soroban_sdk::Address,
) -> Result<(), SwapError>
Identical to swap_split in args and economics, but delivers each route's FINAL hop
output DIRECTLY to user instead of holding it in the router first. This is how a swap
into a RECIPIENT-AUTH token (whose transfer calls to.require_auth(), e.g. some RWA
tokens) settles: the output goes straight to the user, whose source-account signature
satisfies that recipient auth ā the router can't, since it can't pre-authorize an
unknown (pool-computed) amount. Every final hop MUST be a venue that can pay a separate
recipient (Sushi/Soroswap); run_step rejects others with RecipientNotSupported.
min_total_out is enforced from the user's output-balance delta. The backend calls this
in place of swap_split when every route's final hop is Sushi/Soroswap.
fn swap_split_direct(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
asset_in: soroban_sdk::Address,
total_amount_in: i128,
asset_out: soroban_sdk::Address,
min_total_out: i128,
routes: soroban_sdk::Vec,
fee_ppm_override: Option,
) -> Result
Register the address whose signature authorizes per-swap fee overrides (the backend's referral-discount signer).
fn set_fee_authorizer(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
authorizer: soroban_sdk::Address,
) -> Result<(), SwapError>