Contract 526fd7def0137169da39528ef0584d802b9db9880378aa61357ee7add022d6b3

← Back to Index 📥 Download WASM

Meta

rssdkver 27.0.5#ea54f95d3f2f49e0487b29fd1a9f469638f09aba
rsver 1.95.0

Instances

  • CD4EKANBDBF5NNV6BNJVPIHGZLLUKEXBB3QXZ3QWPOX5LNCEFPOJ2J6I

Interface

Simple single-venue swap. Backend picks the best venue.

fn swap(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    token_in: soroban_sdk::Address,
    token_out: soroban_sdk::Address,
    amount_in: i128,
    min_amount_out: i128,
    venue_id: u32,
) -> Result

Get the contract address for a venue.

fn get_venue(
    env: soroban_sdk::Env,
    venue_id: u32,
) -> Result

Get all registered venue IDs.

fn get_venues(env: soroban_sdk::Env) -> soroban_sdk::Vec

Remove a venue. Admin only.

fn remove_venue(env: soroban_sdk::Env, venue_id: u32) -> Result<(), RouterError>

Deploy-time constructor — atomic with deployment, cannot be front-run.

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

Execute a multi-venue routed swap for user.

Verifies: segments are positive and sum to total_amount_in; every venue exists; net output (after the 0.5 bps protocol fee on the TOTAL output) meets min_total_out — otherwise the whole tx reverts.

fn execute_route(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    token_in: soroban_sdk::Address,
    token_out: soroban_sdk::Address,
    total_amount_in: i128,
    min_total_out: i128,
    segments: soroban_sdk::Vec,
) -> Result

Register a new DEX venue adapter. Admin only.

fn register_venue(
    env: soroban_sdk::Env,
    venue_id: u32,
    contract_address: soroban_sdk::Address,
) -> Result<(), RouterError>

PERMISSIONLESS keeper entry point: route a timer-expired SwapBook order through DEX venues and settle the maker — all in one invocation.

  1. Claims the order from SwapBook (escrow moves to this contract; SwapBook authorizes us via invoker auth and returns the maker's on-chain price floor min_out).
  2. Executes the provided route segments.
  3. Deducts the protocol fee, enforces net proceeds >= min_out, and pays the maker.

Anyone may call this — a caller gains nothing (proceeds always go to the maker) and a bad route simply reverts, leaving the order claimable again... (revert restores the order's Open state too).

fn route_expired_order(
    env: soroban_sdk::Env,
    order_id: u64,
    segments: soroban_sdk::Vec,
) -> Result

Imports

WebAssembly Text (WAT) ▶