Skip to main content
The damm-v1-sdk repository includes Rust crates for quote computation, PDA derivation, account construction, and CLI workflows. These are useful for routers, backends, indexers, and programs that need deterministic DAMM v1 account planning.

Crates

Versions

Quote Library

dynamic_amm_quote::compute_quote computes an exact-in swap quote from fully fetched account data.
QuoteData must include the pool, both Dynamic Vault accounts, the pool’s vault LP token accounts, both vault LP mints, both vault token accounts, the clock sysvar, and any stake/depeg account data required by the curve. compute_quote validates pool status and activation state, updates depeg virtual price, computes the pool’s underlying token A/B amounts through Dynamic Vault shares, applies trade and protocol fees, runs the curve calculation, and returns the quoted output amount and fee.

Pool Token Computation

Use compute_pool_tokens when an indexer or backend needs the underlying token balances represented by the pool’s Dynamic Vault LP shares.

PDA Helpers

The common::dynamic_amm::pda module mirrors the TypeScript PDA helpers. The helper sorts mints before deriving permissionless and config-based pool addresses.

Instruction Account Builder

common::dynamic_amm::ix_account_builder::IxAccountBuilder builds account structs for common pool initialization paths. The builder derives Dynamic Vault keys, vault token accounts, vault LP mints, pool LP mint, protocol fee accounts, vault LP token accounts, LP metadata, and payer ATAs.

CLI Examples

The cli crate demonstrates off-chain instruction construction.
Create a constant-product pool:
Allowed constant-product trade fee bps in the CLI example are 25, 100, 400, and 600.

Commands

Integration Notes