Execute a swap: transfer token_out from router reserves to recipient.
The caller must have already transferred amount_in of token_in to
this contract before calling swap (the pool contract does this).
fn swap(
env: soroban_sdk::Env,
token_in: soroban_sdk::Address,
token_out: soroban_sdk::Address,
amount_in: i128,
min_amount_out: i128,
recipient: soroban_sdk::Address,
) -> i128
Set the exchange rate for a token pair.
rate_bps is in basis points: 10000 = 1:1, 1200 = 0.12:1.
fn set_rate(
env: soroban_sdk::Env,
token_in: soroban_sdk::Address,
token_out: soroban_sdk::Address,
rate_bps: i128,
)
Initialize the swap router with an admin address.
fn initialize(env: soroban_sdk::Env, admin: soroban_sdk::Address)
Calculate the output amount for a given input.
fn get_amount_out(
env: soroban_sdk::Env,
token_in: soroban_sdk::Address,
token_out: soroban_sdk::Address,
amount_in: i128,
) -> i128