Reference
API reference
All amounts are raw base units. All per-asset vectors follow the pool's asset order, quote mint (USDC) first.
| Instruction | Arguments | Signer | Does |
|---|---|---|---|
publish | PublishArgs { id, weights_bps, gamma_bps, covenant, glide } | author | creates the pool, its LP mint and vaults; status OPENING |
seed | amounts: Vec<u64> | author | first liquidity, each amount at least 1,000; locks 1,000 shares; status ACTIVE |
deposit | shares, max_amounts | holder | pays ceil(x_i * shares / S) of every asset, mints shares |
withdraw | shares, min_amounts | holder | burns shares, pays floor(x_i * shares / S) of every asset |
withdraw_deferring | shares, min_amounts, skip_mask | holder | as withdraw, leaving masked assets as a DeferredClaim |
claim_deferred | index: u8 | holder | collects one deferred asset once it can move |
update | deltas: Vec<i64> | trader | the trade; accepted only if Definition 3 holds |
revise | to_bps, end, gamma_bps | author | new target inside the covenant, glided to by end; fee step inside bounds |
claim_royalty | none | author | mints the author's owed shares |
claim_protocol | none | anyone | mints the treasury's owed shares to the configured treasury |
Types
pub struct Covenant {
pub caps_bps: Vec<u16>, // one per asset, 100..=10000
pub cash_floor_bps: u16, // minimum weight of the quote asset, <= its cap
pub gamma_min_bps: u16, // fee bounds, inside 10..=2000
pub gamma_max_bps: u16,
pub royalty_bps: u16, // <= 2000, share of fee growth
}
pub struct Glide { pub to_bps: Vec<u16>, pub start: i64, pub end: i64 }
Constants
| Name | Value | Meaning |
|---|---|---|
MAX_ASSETS / MIN_ASSETS | 8 / 2 | assets per fund |
MIN_WEIGHT_BPS | 100 | 1% floor on any weight |
GAMMA_FLOOR_BPS / GAMMA_CEIL_BPS | 10 / 2,000 | program-wide fee bounds |
MAX_GAMMA_STEP_BPS | 25 | largest fee change per revision |
GAMMA_STEP_COOLDOWN | 86,400 s | between fee changes |
MAX_ROYALTY_BPS | 2,000 | royalty ceiling |
PROTOCOL_FEE_BPS | 1,000 | protocol share of fee growth |
MAX_DRIFT_WAD_PER_DAY | 0.02 WAD | 2 points a day |
INDEX_EMA_SECONDS | 86,400 | index smoothing |
LOCKED_SHARES | 1,000 | shares locked at seed |
INVARIANT_MARGIN | 1e-14 (in WAD) | margin every update must clear |