API reference

Program: Anchor 0.31. Seeds are byte strings; band is one byte.

init_config

Once, signed by the program's upgrade authority.

AccountNotes
authoritysigner, must be the upgrade authority
configinit, seeds ["config"]
orbit_mintthe DOME mint
burn_poolRaydium CP-Swap pool of DOME against the burn coin
program, program_dataprove the upgrade authority

create_pool(mint_set: [u8; 32])

AccountNotes
payersigner
poolinit, seeds ["pool", mint_set]
remaining2 to 16 mints, strictly ascending

Errors: AssetCount, MintOrder, MintSetMismatch, DecimalsMismatch, MintProgram, MintExtension.

open_position(band: u8)

AccountNotes
ownersigner, pays rent
pool
positioninit, seeds ["position", pool, owner, band]

band is 0 to 7 (see Overview). Error: BandIndex.

add_liquidity(radius: u128, max_amounts: Vec<u64>)

Accounts: owner (signer), pool, position, token_program; remaining accounts, for every coin in order: mint, the pool's vault, the owner's token account.

Pays the band's share of every coin for radius, rounded up, at most max_amounts[k] of coin k. Errors: AmountCount, Slippage, CapExceeded, Insolvent.

remove_liquidity(radius: u128, min_amounts: Vec<u64>)

Same accounts. Pays the share of every coin, rounded down, at least min_amounts[k]. Fees stay in the position. Errors: PositionTooSmall, Slippage.

collect_fees(coin: u8)

Accounts: owner, pool, position, mint, vault, owner_account, token_program. Error: NothingToCollect.

close_position

Returns rent once the position holds no radius and no fees. Error: PositionNotEmpty.

swap(coin_in: u8, coin_out: u8, amount_in: u64, min_out: u64)

See Integration for the account list. Errors: CoinIndex, ZeroAmount, CoinAccount, Slippage, ZeroOutput, ExceedsLiquidity, NegativePrice, TooManySegments, NoInteriorLiquidity, Insolvent.

convert_fees(coin: u8, amount: u64)

Anyone. Trades up to amount of the protocol fees in coin into the burn coin inside the pool; must return at least 99.5%. Errors: QuoteNotInPool, ConvertPriceGuard.

buy_and_burn(amount: u64)

Anyone. Spends up to amount of protocol fees in the burn coin buying DOME on the configured Raydium CP-Swap pool and burns all of it. Errors: BurnPoolInvalid, BurnTwapUnavailable, BurnAmountInvalid.

State layouts

Pool (zero-copy): mints[16], vaults[16], mint_set, reserves[16], protocol_fees[16], lp_fees_pending[16], tau, bands[8], bump, n, decimals.

Band: beta, gamma, mu, sigma, radius (each a u128 stored as two u64 words), fee_growth[16], boundary.

Position: pool, owner, band, bump, radius, fee_checkpoint[16], fees_owed[16].

Next: Error reference