Current amplification A (human units).
fn a(env: soroban_sdk::Env) -> Result
Base swap fee over FEE_DENOMINATOR.
fn fee(env: soroban_sdk::Env) -> Result
fn name(env: soroban_sdk::Env) -> soroban_sdk::String
SAC address of coin i.
fn coins(
env: soroban_sdk::Env,
i: u32,
) -> Result
Instantaneous price of coin i vs coin 0.
fn get_p(env: soroban_sdk::Env, i: u32) -> Result
Pool config: tokens, curve params, and per-coin rates.
fn config(env: soroban_sdk::Env) -> Result
Amount of coin i required to receive dy of coin j.
fn get_dx(
env: soroban_sdk::Env,
i: u32,
j: u32,
dy: i128,
) -> Result
Amount of coin j received for dx of coin i, net of fees.
fn get_dy(
env: soroban_sdk::Env,
i: u32,
j: u32,
dx: i128,
) -> Result
Begin linearly ramping A to human amplification future_a (NOT pre-scaled) by ledger time
future_time. caller must be the admin. See amp::ramp for the timing/change bounds.
fn ramp_a(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
future_a: i128,
future_time: u64,
) -> Result<(), soroban_sdk::Error>
fn symbol(env: soroban_sdk::Env) -> soroban_sdk::String
fn approve(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
spender: soroban_sdk::Address,
amount: i128,
live_until_ledger: u32,
)
fn balance(env: soroban_sdk::Env, account: soroban_sdk::Address) -> i128
Active reserve of coin i.
fn balances(env: soroban_sdk::Env, i: u32) -> Result
Moving-average oracle of the invariant D.
fn d_oracle(env: soroban_sdk::Env) -> Result
fn decimals(env: soroban_sdk::Env) -> u32
Swap dx of coin i → coin j. Returns dy.
caller: authorizes and pays dx inmin_dy: slippage floor on the coins outreceiver: paid the dy outfn exchange(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
i: u32,
j: u32,
dx: i128,
min_dy: i128,
receiver: soroban_sdk::Address,
) -> Result
Active + admin reserves, per coin.
fn reserves(env: soroban_sdk::Env) -> Result
fn transfer(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
to: soroban_sdk::MuxedAddress,
amount: i128,
)
Current amplification scaled by A_PRECISION.
fn a_precise(env: soroban_sdk::Env) -> Result
Admin's share of the fee over FEE_DENOMINATOR.
fn admin_fee(env: soroban_sdk::Env) -> Result
fn allowance(
env: soroban_sdk::Env,
owner: soroban_sdk::Address,
spender: soroban_sdk::Address,
) -> i128
EMA (moving-average) price of coin i vs coin 0.
fn ema_price(env: soroban_sdk::Env, i: u32) -> Result
One-time pool setup (idempotent — errors if already initialized). Zeroes reserves and registers this contract as its own SEP-41 LP token.
admin: owner authorized for the admin-gated entrypoints (fee/ramp changes, fee sweeps)tokens: one SAC per coin (2..=MAX_COINS); each rate is derived from the SAC decimalsamplification: pre-scaled A * A_PRECISION (the pool starts static at this value)fee / admin_fee / offpeg_fee_multiplier: over FEE_DENOMINATORfn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
tokens: soroban_sdk::Vec,
amplification: i128,
fee: i128,
admin_fee: i128,
offpeg_fee_multiplier: i128,
) -> Result<(), soroban_sdk::Error>
Last spot price of coin i vs coin 0.
fn last_price(env: soroban_sdk::Env, i: u32) -> Result
Dynamic (off-peg) fee for the i → j direction.
fn dynamic_fee(
env: soroban_sdk::Env,
i: u32,
j: u32,
) -> Result
Set the base fee and off-peg fee multiplier. caller must be the admin. The new values are
validated exactly as at initialize (fee < FEE_DENOMINATOR, offpeg ≥ FEE_DENOMINATOR).
fn set_new_fee(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
new_fee: i128,
new_offpeg_fee_multiplier: i128,
) -> Result<(), soroban_sdk::Error>
Halt an in-progress A ramp, pinning A at its current value. caller must be the admin.
fn stop_ramp_a(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
All active reserves.
fn get_balances(
env: soroban_sdk::Env,
) -> Result, soroban_sdk::Error>
Moving-average price oracle for coin i.
fn price_oracle(env: soroban_sdk::Env, i: u32) -> Result
Per-coin rate multipliers bridging native decimals to xp.
fn stored_rates(
env: soroban_sdk::Env,
) -> Result, soroban_sdk::Error>
fn total_supply(env: soroban_sdk::Env) -> i128
Deposit amounts. Returns the LP minted (first deposit: all coins nonzero, mint = D).
caller: authorizes and pays the coins inmin_mint: slippage floor on the LP mintedreceiver: credited the minted LPfn add_liquidity(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
amounts: soroban_sdk::Vec,
min_mint: i128,
receiver: soroban_sdk::Address,
) -> Result
fn transfer_from(
env: soroban_sdk::Env,
spender: soroban_sdk::Address,
from: soroban_sdk::Address,
to: soroban_sdk::Address,
amount: i128,
)
Accumulated admin balance of coin i (protocol's uncollected cut).
fn admin_balances(env: soroban_sdk::Env, i: u32) -> Result
Set the moving-average window for the price oracle (ma_exp_time) and D
oracle (d_ma_time).
fn set_ma_exp_time(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
ma_exp_time: u64,
d_ma_time: u64,
) -> Result<(), soroban_sdk::Error>
Burn burn_amount LP for a proportional, fee-free payout of every coin (always able to fully
exit, unlike remove_liquidity_imbalance). Returns the amounts paid to receiver.
caller: authorizes and is charged the burnmin_amounts[i]: slippage floor per coinclaim_admin_fees: must be false — true errors [Error::NotImplemented] (sweep not shipped)fn remove_liquidity(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
burn_amount: i128,
min_amounts: soroban_sdk::Vec,
receiver: soroban_sdk::Address,
claim_admin_fees: bool,
) -> Result, soroban_sdk::Error>
LP minted (deposit) or burned (withdrawal) for amounts, per is_deposit.
fn calc_token_amount(
env: soroban_sdk::Env,
amounts: soroban_sdk::Vec,
is_deposit: bool,
) -> Result
Like exchange, but the pool credits dx from the increase in its own coin-i
balance (tokens sent directly beforehand) rather than pulling from caller.
Returns dy.
fn exchange_received(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
i: u32,
j: u32,
dx: i128,
min_dy: i128,
receiver: soroban_sdk::Address,
) -> Result
Invariant D per unit of LP supply (18-decimal fixed point).
fn get_virtual_price(env: soroban_sdk::Env) -> Result
Sweep accumulated admin_balances out to the protocol fee receiver.
caller must be the admin.
fn withdraw_admin_fees(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>
Off-peg fee multiplier over FEE_DENOMINATOR.
fn offpeg_fee_multiplier(env: soroban_sdk::Env) -> Result
Coin i received for burning burn_amount LP in a one-coin withdrawal.
fn calc_withdraw_one_coin(
env: soroban_sdk::Env,
burn_amount: i128,
i: u32,
) -> Result
Withdraw a single coin i by burning burn_amount LP, receiving at least
min_received. Returns the coin amount paid to receiver.
fn remove_liquidity_one_coin(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
burn_amount: i128,
i: u32,
min_received: i128,
receiver: soroban_sdk::Address,
) -> Result
Withdraw an explicit, possibly imbalanced amounts. Returns the LP actually burned.
caller: authorizes and is charged the LP burnmax_burn: slippage cap on the LP burnedreceiver: paid the coinsfn remove_liquidity_imbalance(
env: soroban_sdk::Env,
caller: soroban_sdk::Address,
amounts: soroban_sdk::Vec,
max_burn: i128,
receiver: soroban_sdk::Address,
) -> Result