Contract a3d42a7a2c0bd49cd9cededab38a4a15fb2c0e76211f1d6f12a12531f8d13f95

← Back to Index 📥 Download WASM

Meta

cliver 25.1.0#a048a57a75762458b487052e0021ea704a926bee
rssdkver 21.7.7#5da789c50b18a4c2be53394138212fed56f0dfc4
rsver 1.93.0

Instances

  • CASHMLU3J4G7KURKMKWIS2EO7IYWOP3OSM2NFRGNI7Y6WO2FR5L3KG2I
  • CAW2DRMOI3CCJWKVMEUWYJUEQHXB4S4DR72HNL2DWQCMQQUH3LFFVLHV

Interface

fn admin(env: soroban_sdk::Env) -> soroban_sdk::Address
fn pause(env: soroban_sdk::Env)
fn unpause(env: soroban_sdk::Env)

Upgrade the contract WASM. Only callable by admin.

fn upgrade(env: soroban_sdk::Env, new_wasm_hash: soroban_sdk::BytesN<32>)

Returns price of sXLM in XLM (scaled by 1e7).

fn get_price(env: soroban_sdk::Env) -> i128
fn is_paused(env: soroban_sdk::Env) -> bool
fn set_admin(env: soroban_sdk::Env, new_admin: soroban_sdk::Address)

Initialize the LP pool.

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    sxlm_token: soroban_sdk::Address,
    native_token: soroban_sdk::Address,
    fee_bps: u32,
)
fn get_fee_bps(env: soroban_sdk::Env) -> i128

Returns (reserve_xlm, reserve_sxlm).

fn get_reserves(env: soroban_sdk::Env) -> (i128, i128)

Add liquidity to the pool. Returns LP tokens minted. Only transfers the proportional amounts needed; excess stays with the user.

fn add_liquidity(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    xlm_amount: i128,
    sxlm_amount: i128,
) -> i128

Bump instance TTL — can be called by anyone to keep contract alive.

fn bump_instance(env: soroban_sdk::Env)
fn get_lp_balance(env: soroban_sdk::Env, user: soroban_sdk::Address) -> i128
fn total_lp_supply(env: soroban_sdk::Env) -> i128

Remove liquidity from the pool. Returns (xlm_out, sxlm_out).

fn remove_liquidity(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    lp_amount: i128,
) -> (i128, i128)

Swap sXLM for XLM. Returns XLM received. min_out provides slippage protection.

fn swap_sxlm_to_xlm(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    sxlm_amount: i128,
    min_out: i128,
) -> i128

Swap XLM for sXLM. Returns sXLM received. min_out provides slippage protection.

fn swap_xlm_to_sxlm(
    env: soroban_sdk::Env,
    user: soroban_sdk::Address,
    xlm_amount: i128,
    min_out: i128,
) -> i128

Imports

WebAssembly Text (WAT) ▶