Key data retrieved from the pool state

DataDescription
lp_mintLP mint of the pool
token_a_mintPool token A mint. Eg: USDC mint
token_b_mintPool token B mint. Eg: USDT mint
a_vaultThe vault to store pool token A
b_vaultThe vault to store pool token B
a_vault_lpThe LP of the vault to store pool token A
b_vault_lpThe LP of the vault to store pool token B
a_vault_lp_bumpThe nonce used to create signer seed
enabledFlag to determine whether the pool is enabled or disabled. If disabled, user couldn’t add liquidity, remove liquidity in imbalance ratio or swap at the given pool
admin_token_a_feeUsed to collect swap fee
admin_token_b_feeUsed to collect swap fee
adminThe admin of the pool
feesThe fee parameter of the pool. It will affect the fee charged during the swap process
paddingReserved space for future use
curve_typeThe curve of the pool. Example: Constant product, stable

Pool Fees

DataDescription
trade_fee_numeratorNumerator for trading fee
trade_fee_denominatorDenominator for trading fee
owner_trade_fee_numeratorNumerator for owner trading fee
owner_trade_fee_denominatorDenominator for owner trading fee

Padding

DataDescription
padding512 bytes reserved for future use

Curve Type

DataDescription
ConstantProductIndicate the pool is constant product pool
StableIndicate the pool is stable swap pool

Token Multiplier

Because there are tokens with different decimals, the precision factor has been added to normalize the value to support tokens with different decimals in stable swap calculation.

DataDescription
token_a_multiplierMultiplier for token A. Used to make sure that token A will have the same precision as token B
token_b_multiplierMultiplier for token B. Used to make sure that token A will have the same precision as token A
precision_factorThe precision of token A and B of the pool

Depeg

Store the information about the depeg stable swap pool.

DataDescription
base_virtual_priceStore the virtual price of the staking/interest-bearing token. Used to calculate the native token amount
base_cache_updatedStore the last timestamp the base_virtual_price was updated
depeg_typeIndicate the type of the depeg pool supported. If the pool is a depeg pool, token_b of the pool will always be to depeg token

Depeg Type

DataDescription
NoneIndicate that the pool does not support staking / interest bearing token
MarinadeThe pool supports marinade token (mSOL)
LidoThe pool supports solido token (stSOL)
spl-stakeThe pool supports more LSTs like jitoSOL, bSOL, and more

User Functions

FunctionDescription
add_balance_liquidityUser have to deposit a balanced ratio into the pool. The amount of token A/B to deposit will be calculated based on the number of lp token user wish to receive. The pool itself does not hold token A/B. The pool will deposit the user deposited token A, and B to the vault, and hold the minted vault LP. Supported by stable swap, and constant product.
add_imbalance_liquidityUser can deposit both tokens, or only single token into the token without any ratio restrictions. The amount of lp token to be minted will be calculated based on the token A/B user is depositing. The pool itself does not hold token A/B. The pool will deposit the user deposited token A, and B to the vault, and hold the minted vault LP. Trading fee will be charged. Supported only by stable swap.
remove_balance_liquidityUser will get token A and token B based on the current pool ratio by burning the lp token. The process will fail when the vault does not have enough liquidity.
remove_liquidity_single_sideUser can choose to withdraw only token A, or token B by burning the lp token. Trading fee will be charged. The process will fail when the vault does not have enough liquidity.
swapUser can exchange token B by deposit token A or vice versa. Swap fee will be charged based on the PoolFee parameter stored in the pool account. If the host fee account was passed as the remaining account during the swap, 20% of the admin trading fee will be taken by the host. Admin trading fee will be transferred to admin_token_a_fee or admin_token_b_fee based on the deposit mint token. The pool will deposit the user deposited token to the respective vault, and hold the minted vault LP. Meanwhile, the pool will burn the correct amount of vault LP by using vault SDK and transfer the token to the user. The process will fail when the vault does not have enough liquidity.
get_pool_infoUser can query the pool metric information, such as total token A amount, total token B amount, virtual price, and pool APY.
initialize_permissionless_poolCreates a new permissionless pool by depositing tokens A and B as bootstrap liquidity.