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.
min_out).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