Contract 6b68231953c2bf31ad8ea880abf1cbcbcf6ca0224a6b30cab85306b6cf44a26a

← Back to Index 📥 Download WASM

Meta

cliver 26.0.0#60f7458e7ecffddf2f2d91dc6d0d2db4fab03ecc
rssdk_spec_shaking 2
rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.93.0-nightly

Instances

  • CAJ5BOSJFEIO6UO644ZTSGNEZULRJS4ZTMNIMLUU2IPVEMAKBF5MH4XA

Interface

Execute a swap plan — one or more parallel routes that each consume their own amount_in of the shared input token and converge on the shared output token. The Router pulls the total input once (or unwraps it out of the caller's position via pre_hook), threads each route's amount through its legs, measures the combined output as its own balance delta, requires it to be ≥ min_out, and delivers it to to — either directly or, via post_hook, by wrapping exactly min_out into a position for to and paying the surplus to caller as the underlying. Reverts (atomically) if the deadline has passed, the plan is malformed, to is the Router, a venue is unregistered, any leg fails, a hook misbehaves, or the combined output falls short. A non-split swap is a 1-element plan.

fn swap(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    pre_hook: Option,
    plan: soroban_sdk::Vec,
    post_hook: Option,
    min_out: i128,
    to: soroban_sdk::Address,
    deadline: u64,
) -> i128

Expected combined output for a plan. No auth, no transfers. Sums each route's chained quote_leg; the API simulates this to certify the number it returns. Each route is quoted against the current state, so a plan whose routes share a pool quotes optimistically — execution is sequential and later routes see earlier routes' price impact.

fn quote(env: soroban_sdk::Env, plan: soroban_sdk::Vec) -> i128

Current admin (registry owner), or None if ownership was renounced.

fn get_admin(env: soroban_sdk::Env) -> Option

Expected position shares for wrapping amount through hook — proxies the wrap adapter's quote_wrap. No auth, no transfers; the API simulates this to price a post-hook (amount = min_out).

fn quote_hook(env: soroban_sdk::Env, hook: Hook, amount: i128) -> i128

Adapter registered for venue_id, or None.

fn get_adapter(env: soroban_sdk::Env, venue_id: u32) -> Option

Accept a pending admin transfer (proposed admin's auth required).

fn accept_admin(env: soroban_sdk::Env)

Deploy-time setup (atomic with deployment — there is no window in which an unowned Router exists). admin owns the adapter registry.

fn __constructor(env: soroban_sdk::Env, admin: soroban_sdk::Address)

Begin a two-step admin transfer. live_until_ledger = 0 cancels.

fn propose_admin(
    env: soroban_sdk::Env,
    new_admin: soroban_sdk::Address,
    live_until_ledger: u32,
)

Register (or replace) the adapter for venue_id. Admin-only — this is the allowlist that bounds which contracts the Router will ever call. venue_id 0 is reserved (it means "no hook" in RouteSwap events).

fn register_adapter(
    env: soroban_sdk::Env,
    venue_id: u32,
    adapter: soroban_sdk::Address,
)

Remove the adapter for venue_id; subsequent plans naming it revert with VenueNotRegistered. Admin-only. The explicit kill switch for a compromised or retired venue.

fn unregister_adapter(env: soroban_sdk::Env, venue_id: u32)

Imports

WebAssembly Text (WAT) ▶