Contract 4edd745f5fbf4d103edb55041efb8e6c399f66d43c0b6d38b781e63c432b6c8d

← Back to Index 📥 Download WASM

Meta

rssdkver 23.0.2#a97daf8b07cdf24e9bd45e344db51a21b9ea77d3
rsver 1.88.0

Instances

  • CDMIM23WOUL5CZBKX3GOA3V5R5AMVIMTCP52KCDQORWELAPLJ27WZCHL

Interface

Initialize the router with factory and XLM addresses Following Uniswap V3's permissionless design

fn init_router(
    env: soroban_sdk::Env,
    factory: soroban_sdk::Address,
    xlm: soroban_sdk::Address,
) -> Result<(), SwapRouterError>

Swap exact amount of input tokens for as many output tokens as possible Single hop version

Uses Soroban's authorization framework - no pre-approval needed! The user's signature authorizes both the router call and the pool's token transfers.

fn swap_exact_input_single(
    env: soroban_sdk::Env,
    params: ExactInputSingleParams,
) -> Result

Swap exact input single-hop using caller-provided oracle hints.

fn swap_exact_input_single_hints(
    env: soroban_sdk::Env,
    params: ExactInputSingleParams,
    hints: OracleHints,
) -> Result

Swap exact amount of input tokens for as many output tokens as possible Multi-hop version (e.g., Token A → B → C in single transaction)

Uses Soroban's authorization framework for atomic multi-hop swaps. First hop: Pool pulls from user. Subsequent hops: Pools use prefunded tokens.

fn swap_exact_input(
    env: soroban_sdk::Env,
    params: ExactInputParams,
) -> Result

Swap exact input multi-hop using caller-provided oracle hints (one per hop).

fn swap_exact_input_hints(
    env: soroban_sdk::Env,
    params: ExactInputParams,
    hints_by_hop: soroban_sdk::Vec,
) -> Result

Swap as few input tokens as possible for exact amount of output tokens Not implemented (requires reverse-path coordination and token custody).

fn swap_exact_output_single(
    env: soroban_sdk::Env,
    params: ExactOutputSingleParams,
) -> Result
fn swap_exact_output(
    env: soroban_sdk::Env,
    params: ExactOutputParams,
) -> Result

Quote exact input multi-hop swap without execution Returns the expected output amount

fn quote_exact_input(
    env: soroban_sdk::Env,
    params: ExactInputParams,
) -> Result

Quote exact output multi-hop swap without execution Returns the required input amount

fn quote_exact_output(
    env: soroban_sdk::Env,
    params: ExactOutputParams,
) -> Result

Quote single exact input swap without execution

fn quote_exact_input_single(
    env: soroban_sdk::Env,
    params: ExactInputSingleParams,
) -> Result

Quote single exact output swap without execution NOTE: Not supported in this implementation

fn quote_exact_output_single(
    env: soroban_sdk::Env,
    params: ExactOutputSingleParams,
) -> Result

Imports

WebAssembly Text (WAT) ▶