Skip to main content
DAMM v1 can be invoked from Anchor programs through the dynamic-amm program crate included in damm-v1-sdk/programs/dynamic-amm. CPI builders must pass the same pool, Dynamic Vault, token, mint, and remaining accounts required by the on-chain instruction.
Prefer the TypeScript SDK or Rust off-chain helpers for ordinary app transactions. Use CPI only when another on-chain program must compose directly with DAMM v1.

Dependency Setup

The local program crate exposes CPI types through its default cpi feature.
For a published or vendored integration, pin the exact source revision that matches the deployed DAMM v1 IDL you build against.

Source Examples

Public CPI Examples

Meteora’s public CPI examples include DAMM v1 swap, pool initialization, config-based initialization, lock liquidity, claim fee, and tests.
The local damm-v1-sdk/common crate also contains account builders that are useful when preparing CPI or off-chain instruction account sets.

Account Planning

Every DAMM v1 CPI has two account layers: Use common::dynamic_amm::pda and common::dynamic_vault::pda helpers to derive canonical addresses.

Swap CPI

swap takes in_amount and minimum_out_amount.
Quote off-chain immediately before invoking CPI. Use the quoted minimum output as minimum_out_amount.

Liquidity CPI

Liquidity instructions need pool LP mint, user token accounts, user pool LP account, both Dynamic Vault accounts, vault token accounts, vault LP mints, and pool-held vault LP token accounts.

Lock CPI

Lock fee accounting depends on current pool virtual price. Pass fresh vault and LP account data so the instruction can compute the correct fee.

Pool Creation CPI

Pool creation CPI is possible but account-heavy because it initializes the pool, LP mint, pool-held vault LP accounts, protocol fee accounts, payer LP ATA, and LP metadata. For most CPI use cases, initialize pools off-chain first and CPI only into swap, liquidity, or lock flows.

Unsupported Or Restricted CPI Paths

Common CPI Errors

Checklist