Contract a895bd9e243e36433b740360f2491005e06954641e2508ea8c2c9083ad446411

← Back to Index 📥 Download WASM

Meta

cliver 27.1.0#8e402ea28202950b272fbabc34caad4d2f64fe87
rssdkver 21.7.7#5da789c50b18a4c2be53394138212fed56f0dfc4
rsver 1.95.0

Instances

  • CAW2DRMOI3CCJWKVMEUWYJUEQHXB4S4DR72HNL2DWQCMQQUH3LFFVLHV

Interface

fn vault(env: soroban_sdk::Env) -> soroban_sdk::Address

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

Point the pool at the vault, once. Only needed to migrate a pool deployed before the seed-ratio check existed.

fn set_vault(env: soroban_sdk::Env, vault: 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,
    vault: soroban_sdk::Address,
)

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

Returns protocol fee in basis points.

fn protocol_fee_bps(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

Set protocol fee in basis points (portion of LP fee taken for protocol).

fn set_protocol_fee_bps(env: soroban_sdk::Env, bps: u32)

Returns accrued protocol fees in XLM stroops.

fn accrued_protocol_fees(env: soroban_sdk::Env) -> i128

Collect accrued protocol fees. Admin-only. Transfers XLM to admin and resets counter. Sweep accrued protocol fees.

The vault's share is transferred to it directly — the vault derives its assets from its own balance, so XLM arriving raises the exchange rate for every sXLM holder without a call. The remainder goes to the admin as protocol revenue.

Callable by anyone: it only moves fees to their two fixed destinations.

fn collect_protocol_fees(env: soroban_sdk::Env) -> i128

Imports

WebAssembly Text (WAT) ▶