Contract 6d6567610a6e51124707b379b7dbe14f2a60fb81669321272a203140dc4674ec

← Back to Index 📥 Download WASM

Meta

cliver 25.2.0#28484880988199233a7e8e87c97cb12dac323cb3
rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.94.1

Instances

  • CDL35ZAOYVDBMSTIKOF4HJKXA7MWHF5ZJNZKES6EAZAOOHLXURSGSYAJ

Interface

Get swap quote from Soroswap (for view functions)

Arguments

  • from_token - Token to swap from
  • to_token - Token to swap to
  • amount_in - Amount to get quote for

Returns

  • Expected output amount
fn get_quote(
    env: soroban_sdk::Env,
    from_token: soroban_sdk::Address,
    to_token: soroban_sdk::Address,
    amount_in: u128,
) -> Result

Get current Soroswap router address

fn get_router(
    env: soroban_sdk::Env,
) -> Result

Initialize adapter with Soroswap router and factory addresses

Arguments

  • admin - Admin address (can update router/factory)
  • router - Soroswap router contract address
  • factory - Soroswap factory contract address (optional, for direct swaps)
fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    router: soroban_sdk::Address,
    factory: Option,
) -> Result<(), soroban_sdk::Error>

Update Soroswap router address (admin only)

fn set_router(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    router: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Update Soroswap factory address (admin only)

fn set_factory(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    factory: Option,
) -> Result<(), soroban_sdk::Error>

Execute swap via Soroswap (K2 standard interface)

This is called by K2 contracts. It swaps via Soroswap router or direct pair.

Arguments

  • from_token - Token to swap from
  • to_token - Token to swap to
  • amount_in - Amount to swap
  • min_amount_out - Minimum acceptable output (slippage protection)
  • recipient - Address to receive output tokens

Returns

  • Actual amount of tokens received
fn execute_swap(
    env: soroban_sdk::Env,
    from_token: soroban_sdk::Address,
    to_token: soroban_sdk::Address,
    amount_in: u128,
    min_amount_out: u128,
    recipient: soroban_sdk::Address,
) -> Result

Get the contract address allowed to execute swaps.

fn get_trusted_caller(
    env: soroban_sdk::Env,
) -> Result

Update the contract address allowed to execute swaps (admin only).

fn set_trusted_caller(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    trusted_caller: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Imports

WebAssembly Text (WAT) ▶