Skip to main content

Config Types

DAMM v2 pools are created from a config account that pre-defines pool parameters. Two config types exist:
Parameters are fixed when the config is created. All pools created from a static config inherit the same:
  • Fee structure (base fee mode, dynamic fee, protocol fee %)
  • collect_fee_mode (BothToken / OnlyB / Compounding)
  • activation_type (slot or timestamp)
  • Price range (sqrt_min_price, sqrt_max_price)
Best for: Launchpads and protocols that want uniform pool settings across all their pools.

Activation Types

Each pool can gate trading behind an activation point:
activation_typeValueDescription
Slot0Trading opens at a specific Solana slot number
Timestamp1Trading opens at a specific Unix timestamp
Before the activation point, swaps are disabled. Only whitelisted vault programs (Alpha Vault) can trade.
Setting activation_point: null (or 0) opens the pool for trading immediately.

Price Range

Every pool has a configured price range defined by:
ParameterTypeDescription
sqrtMinPriceu128Lower bound of the price range (as √price × 2^64)
sqrtMaxPriceu128Upper bound of the price range (as √price × 2^64)
initSqrtPriceu128Starting price at pool creation

Full Range vs Concentrated

ModesqrtMinPricesqrtMaxPrice
Full range (x·y=k)MIN_SQRT_PRICEMAX_SQRT_PRICE
ConcentratedCustom lowerCustom upper
CollectFeeMode.Compounding (mode 2) requires full range. The SDK enforces MIN_SQRT_PRICE / MAX_SQRT_PRICE for compounding pools.

Converting Price to √Price

sqrtPrice = √(tokenB_per_tokenA) × 2^64
The TypeScript SDK provides getSqrtPriceFromPrice(price, decimalsA, decimalsB) for this conversion.

Pool Creation Parameters

When calling createCustomPool, the key parameters are:
ParameterTypeDescription
tokenAMintPublicKeyBase token mint
tokenBMintPublicKeyQuote token mint (must be SOL or USDC for public configs)
tokenAAmountBNInitial base token deposit
tokenBAmountBNInitial quote token deposit (0 for one-sided)
sqrtMinPriceBNLower price bound
sqrtMaxPriceBNUpper price bound
initSqrtPriceBNInitial pool price
liquidityDeltaBNInitial liquidity (calculated from amounts)
collectFeeModeCollectFeeMode0 = BothToken, 1 = OnlyB, 2 = Compounding
activationTypeActivationType0 = Slot, 1 = Timestamp
activationPointBN | nullWhen trading opens (null = immediate)
hasAlphaVaultbooleanWhether an alpha vault is associated
poolFeesPoolFeesParamsFull fee configuration

Pool State

On-chain, a pool account stores:
FieldTypeDescription
liquidityu128Current total liquidity in the active range
sqrtPriceu128Current √price
sqrtMinPriceu128Pool price range lower bound
sqrtMaxPriceu128Pool price range upper bound
tokenAAmountu64Token A reserves
tokenBAmountu64Token B reserves
collectFeeModeu8Fee collection mode
activationPointu64Trading activation point
poolStatusu8Pool enabled/disabled status
poolTypeu80 = SPL Token, 1 = Token 2022
feeAPerTokenStored[u8; 32]Cumulative fee A per unit liquidity (U256)
feeBPerTokenStored[u8; 32]Cumulative fee B per unit liquidity (U256)
rewardInfos[RewardInfo; 2]Farming reward state (2 slots)
metricsPoolMetricsCumulative swap/liquidity stats

Token 2022 Support

DAMM v2 supports Token 2022 mints. When creating a pool with Token 2022 tokens, the program automatically detects and handles:
  • Transfer fee extension — Fee amounts are accounted for in transfer_fee_included / transfer_fee_excluded fields
  • Interest-bearing — Scaled amounts handled correctly
  • Other extensions — Compatible with all standard Token 2022 extensions
Native mint (So11111111111111111111111111111111111111112) with Token 2022 is not supported (UnsupportNativeMintToken2022 error).
The token_a_flag and token_b_flag on pool state indicate which token program each mint uses.