Contract 4b023f8de341bb5a89a3cfd92e32779b79616984ab9659d334a08451534de73c

← Back to Index 📥 Download WASM

Meta

cliver 26.0.0#60f7458e7ecffddf2f2d91dc6d0d2db4fab03ecc
rssdkver 22.0.11#34f7f53ae31e0fd02aab436a9872e79fa671ca02
rsver 1.94.1

Instances

  • CCB6KZZ6TFAQCIWUO3C7IHTA554WKP4XBBB3SFR5APP4BE5JTROEPGTN
  • CCYMGI5VYZ625TNLLLBMX2IIQHRXXXUFUKMJCRLVPRG3IQDYTWV4SUI7

Interface

Swap within the Phoenix pool on behalf of vault.

asset_in/asset_out must match the pool's registered assets. sell_a is derived from which asset is asset_in.

fn swap(
    env: soroban_sdk::Env,
    vault: soroban_sdk::Address,
    pool: soroban_sdk::Address,
    asset_in: soroban_sdk::Address,
    asset_out: soroban_sdk::Address,
    amount_in: i128,
    min_out: i128,
)
fn get_name(env: soroban_sdk::Env) -> soroban_sdk::String

Withdraw share_amount from pool, sending tokens to to.

fn withdraw(
    env: soroban_sdk::Env,
    share_amount: i128,
    min_a: i128,
    min_b: i128,
    pool: soroban_sdk::Address,
    from: soroban_sdk::Address,
    to: soroban_sdk::Address,
) -> (i128, i128)

Alias for get_total_value (backwards-compatible single-vault call).

fn get_value(env: soroban_sdk::Env, vault: soroban_sdk::Address) -> i128

Initialize the strategy for a vault.

No pool-specific arguments — pools are registered dynamically on first add_liquidity call.

fn initialize(
    env: soroban_sdk::Env,
    vault: soroban_sdk::Address,
    name: soroban_sdk::String,
)

Return true if any active position involves asset.

fn asset_in_use(
    env: soroban_sdk::Env,
    vault: soroban_sdk::Address,
    asset: soroban_sdk::Address,
) -> bool

Add liquidity to the Phoenix pool.

On first call for a given pool, pool.query_share_token_address() is called once and cached; subsequent calls use the cache.

fn add_liquidity(
    env: soroban_sdk::Env,
    vault: soroban_sdk::Address,
    pool: soroban_sdk::Address,
    asset_a: soroban_sdk::Address,
    asset_b: soroban_sdk::Address,
    amount_a: i128,
    amount_b: i128,
    min_a: i128,
    min_b: i128,
)

Return the total base-asset value of all LP positions for vault.

Budget: 1 get_reserves + 1 total_supply per active pool, plus ONE get_prices batch call for all unique assets.

fn get_total_value(env: soroban_sdk::Env, vault: soroban_sdk::Address) -> i128

Remove share_amount from the Phoenix pool and send tokens to vault.

Returns (amount_a, amount_b) received from the pool so the vault can compute post-operation value without a redundant deep LP re-valuation.

fn remove_liquidity(
    env: soroban_sdk::Env,
    vault: soroban_sdk::Address,
    pool: soroban_sdk::Address,
    asset_a: soroban_sdk::Address,
    asset_b: soroban_sdk::Address,
    share_amount: i128,
    min_a: i128,
    min_b: i128,
) -> (i128, i128)

Provide liquidity to pool on behalf of from (vault). Pulls tokens from from via token.transfer.

fn deposit_liquidity(
    env: soroban_sdk::Env,
    amount_a: i128,
    amount_b: i128,
    min_a: i128,
    min_b: i128,
    pool: soroban_sdk::Address,
    asset_a: soroban_sdk::Address,
    asset_b: soroban_sdk::Address,
    from: soroban_sdk::Address,
) -> i128

Return the number of active LP positions (consistent with other strategies).

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

Proportionally withdraw numerator/denominator of every active pool and send underlying tokens to to.

fn withdraw_fraction(
    env: soroban_sdk::Env,
    vault: soroban_sdk::Address,
    numerator: i128,
    denominator: i128,
    to: soroban_sdk::Address,
)

Return all pool addresses with a non-zero share balance.

fn get_active_positions(
    env: soroban_sdk::Env,
) -> soroban_sdk::Vec
fn refresh_asset_handler(env: soroban_sdk::Env)

Return underlying token balances across all active Phoenix LP positions.

For each active pool: computes amount = shares * reserve / total_shares and sums per asset. The vault uses this to batch-price all assets without nesting factory + oracle calls inside the strategy.

fn get_underlying_asset_balances(
    env: soroban_sdk::Env,
    vault: soroban_sdk::Address,
) -> soroban_sdk::Map

Imports

WebAssembly Text (WAT) ▶