Contract 2e6e3d1948035714d38189a5047116d5ab93cbc574c9f727d30ef88b5540b1fb

← Back to Index 📥 Download WASM

Meta

binver 2.0.0
cliver 26.0.0#60f7458e7ecffddf2f2d91dc6d0d2db4fab03ecc
rssdkver 25.3.1#e50d95af029c83196dd122f0154bac3f1302394b
rsver 1.93.0

Instances

  • CDNEHK24GNC3GPNZ7CUIQODRY75YQD3AULM77ZUYIZDYCJRTKS74OJKY

Interface

Swap token_in for token_out using constant-product AMM (x*y=k). Treasury Siphon: can only swap OUT ecosystem tokens (KPOP/KOL/ESP/PSY). Counter-assets (XLM/USDC/AQUA) can ONLY be withdrawn via shares.

fn swap(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    token_in: soroban_sdk::Address,
    token_out: soroban_sdk::Address,
    amount_in: i128,
)

Deposit tokens into the vault. Mints shares proportional to deposit.

fn deposit(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    token: soroban_sdk::Address,
    amount: i128,
)

MANDATORY: CoreTX upgrade pattern

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

Withdraw by burning shares. User chooses which token to receive.

fn withdraw(
    env: soroban_sdk::Env,
    from: soroban_sdk::Address,
    token: soroban_sdk::Address,
    shares: i128,
)

MANDATORY: CoreTX admin transfer

fn set_admin(
    env: soroban_sdk::Env,
    current_admin: soroban_sdk::Address,
    new_admin: soroban_sdk::Address,
)

MANDATORY: Public TTL extend

fn extend_ttl(env: soroban_sdk::Env)

Get a user's share balance

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

Legacy init (tests / pre-Protocol-22 compat)

fn initialize(env: soroban_sdk::Env, admin: soroban_sdk::Address)

Protocol 22+ constructor — called once on deploy

fn __constructor(env: soroban_sdk::Env, admin: soroban_sdk::Address)

Check the per-ledger cap for a token

fn get_token_cap(env: soroban_sdk::Env, token: soroban_sdk::Address) -> i128

Whitelist a token, set per-ledger cap, and mark ecosystem status. is_ecosystem = true for KPOP/KOL/ESP/PSY (can be swapped out) is_ecosystem = false for XLM/USDC/AQUA (Treasury Siphon: withdraw-only)

fn whitelist_token(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
    token: soroban_sdk::Address,
    cap: i128,
    is_ecosystem: bool,
)

Get total shares issued

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

Get internal accounting balance for a token

fn get_managed_asset(env: soroban_sdk::Env, token: soroban_sdk::Address) -> i128

Check if a token is an ecosystem token (can be swapped out)

fn is_ecosystem_token(env: soroban_sdk::Env, token: soroban_sdk::Address) -> bool

Imports

WebAssembly Text (WAT) ▶