Skip to main content
The amm IDL exposes many instructions. Integrators can choose to either use the TypeScript SDK for transaction construction or build through CPI.

Pool Creation

Pool initialization creates or initializes the pool, LP mint, pool-owned Dynamic Vault LP token accounts, protocol fee token accounts, initial liquidity, and LP mint metadata. The two Dynamic Vault accounts and their token vaults must exist or be created as part of the setup flow.

Pool PDA Variants

Use the SDK or Rust helper derivations instead of rebuilding seeds manually.

Swaps

swap validates pool enablement and launch activation, updates depeg virtual price when required, deposits input through one Dynamic Vault, computes trade, protocol, partner, and optional host fees, then withdraws output through the opposite vault.

Liquidity

Add, remove, lock, claim_fee, and get_pool_info price pool LP with pool.lp_mint_supply. Permissionless pool creation sets that field to the LP minted during initialization. initialize_permissioned_pool leaves it at 0 until bootstrap_liquidity. bootstrap_liquidity requires the field to be 0, then adds the LP it mints. Add liquidity increases it. Remove liquidity and claim_fee decrease it by the LP burned. If lp_mint_supply is below lp_mint.supply, those reads return LpMintSupplyAccountingNotPatched (6063). remove_balance_liquidity and remove_liquidity_single_side return InvalidLpOwner (6064) when the LP token account is not owned by user. An SPL delegate cannot burn that LP. Vault share conversion uses vault.total_lp_supply on a version 1 vault and the vault LP mint supply on a version 0 vault. Balanced operations are the normal constant-product path. Stable pools additionally support imbalanced deposits and single-sided withdrawals.

LP Locks

Lock fee accounting is LP-denominated internally. Claiming converts claimable LP value into token A/B by using the pool’s balanced withdrawal logic.

Configs And Activation

Config-created pools inherit pool_fees, activation_duration, vault_config_key, pool_creator_authority, activation_type, and partner_fee_numerator. If pool_creator_authority is not the default pubkey, that authority must sign pool creation from the config.

Pool Controls And Fees

trade_fee_numerator, protocol_trade_fee_numerator, host fee, and partner fee values use FEE_DENOMINATOR = 100_000, not direct basis points.

Operator And Admin Instructions

Operator permissions are stored as a bitmap. Bit 0 allows protocol fee claiming, and bit 1 allows protocol fee zapping.

Validation