> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt
> Use this file to discover all available pages before exploring further.

# DAMM v2 Program Accounts

> Understand DAMM v2 cp-amm accounts, including configs, pools, positions, rewards, vesting, token badges, enums, and PDA seeds.

<Note>
  This page summarizes the `cp-amm` account model. For exact layouts, use the published IDL and generated TypeScript types exported by `@meteora-ag/cp-amm-sdk`.
</Note>

## PDA Map

Pool and customizable pool PDAs sort the two mint public keys lexicographically in the seed list.

| Account                    | SDK helper                                              | Seeds                                     |
| -------------------------- | ------------------------------------------------------- | ----------------------------------------- |
| Pool authority             | `derivePoolAuthority()`                                 | `pool_authority`                          |
| Static or dynamic config   | `deriveConfigAddress(index)`                            | `config`, little-endian `u64` index       |
| Config-based pool          | `derivePoolAddress(config, tokenAMint, tokenBMint)`     | `pool`, config, sorted mints              |
| Customizable pool          | `deriveCustomizablePoolAddress(tokenAMint, tokenBMint)` | `cpool`, sorted mints                     |
| Position                   | `derivePositionAddress(positionNft)`                    | `position`, position NFT mint             |
| Token vault                | `deriveTokenVaultAddress(tokenMint, pool)`              | `token_vault`, mint, pool                 |
| Reward vault               | `deriveRewardVaultAddress(pool, rewardIndex)`           | `reward_vault`, pool, reward index        |
| Token badge                | `deriveTokenBadgeAddress(tokenMint)`                    | `token_badge`, mint                       |
| Position NFT token account | `derivePositionNftAccount(positionNftMint)`             | `position_nft_account`, position NFT mint |
| Claim fee operator         | `deriveClaimFeeOperatorAddress(operator)`               | `cf_operator`, operator                   |
| Operator                   | `deriveOperatorAddress(whitelistedAddress)`             | `operator`, whitelisted address           |
| Event authority            | generated clients                                       | `__event_authority`                       |

## Constants

| Constant                     | Value                           | Use                                          |
| ---------------------------- | ------------------------------- | -------------------------------------------- |
| `MIN_SQRT_PRICE`             | `4295048016`                    | Lower square-root price bound.               |
| `MAX_SQRT_PRICE`             | `79226673521066979257578248091` | Upper square-root price bound.               |
| `NUM_REWARDS`                | `2`                             | Reward slots per pool and position.          |
| `FEE_DENOMINATOR`            | `1_000_000_000`                 | Fee numerator denominator.                   |
| `MAX_FEE_BPS_V0`             | `5000`                          | Legacy pool-version max fee, 50%.            |
| `MAX_FEE_BPS_V1`             | `9900`                          | Current pool-version max fee, 99%.           |
| `CURRENT_POOL_VERSION`       | `1`                             | Current fee version for new pools.           |
| `SPLIT_POSITION_DENOMINATOR` | `1_000_000_000`                 | Numerator denominator for `split_position2`. |
| `MIN_REWARD_DURATION`        | `86400`                         | Minimum reward campaign duration, 1 day.     |
| `MAX_REWARD_DURATION`        | `31536000`                      | Maximum reward campaign duration, 1 year.    |

## Enums

| Enum                 | Values                                                                                                                         |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `CollectFeeMode`     | `0` BothToken, `1` OnlyB, `2` Compounding                                                                                      |
| `PoolStatus`         | `0` Enable, `1` Disable                                                                                                        |
| `PoolType`           | `0` Permissionless, `1` Customizable                                                                                           |
| `LayoutVersion`      | `0` V0, `1` V1                                                                                                                 |
| `ActivationType`     | `0` Slot, `1` Timestamp                                                                                                        |
| `BaseFeeMode`        | Time scheduler linear, time scheduler exponential, rate limiter, market-cap scheduler linear, market-cap scheduler exponential |
| `SwapMode`           | `0` ExactIn, `1` PartialFill, `2` ExactOut                                                                                     |
| `OperatorPermission` | Config, token badge, pool status, reward, pool fee, protocol fee, zap, and layout-fix permissions                              |

## Config

| Field                              | Meaning                                                                           |
| ---------------------------------- | --------------------------------------------------------------------------------- |
| `vault_config_key`                 | Alpha-vault key that may buy before activation when configured                    |
| `pool_creator_authority`           | If non-default, only this authority can create pools with the config              |
| `pool_fees`                        | Base fee, dynamic fee config, protocol/referral fee percents, compounding fee bps |
| `activation_type`                  | `0` slot, `1` timestamp                                                           |
| `collect_fee_mode`                 | `0` BothToken, `1` OnlyB, `2` Compounding                                         |
| `config_type`                      | `0` static, `1` dynamic                                                           |
| `index`                            | Config index used in PDA derivation                                               |
| `sqrt_min_price`, `sqrt_max_price` | Price bounds for concentrated modes                                               |

Use `fetchConfigState`, `getStaticConfigs`, or `getAllConfigs` to read configs from TypeScript.

### PoolFeesConfig

| Field                  | Meaning                                                      |
| ---------------------- | ------------------------------------------------------------ |
| `base_fee`             | Encoded base fee mode and mode-specific parameters           |
| `dynamic_fee`          | Optional volatility-responsive fee config                    |
| `protocol_fee_percent` | Protocol share of trading fees                               |
| `referral_fee_percent` | Referral share of protocol fee when referral is present      |
| `compounding_fee_bps`  | Fee share that compounds into reserves for compounding pools |

## Pool

| Field                                            | Meaning                                                 |
| ------------------------------------------------ | ------------------------------------------------------- |
| `pool_fees`                                      | Runtime fee state, including base and dynamic fee state |
| `token_a_mint`, `token_b_mint`                   | Pool mints                                              |
| `token_a_vault`, `token_b_vault`                 | Vault token accounts                                    |
| `whitelisted_vault`                              | Pre-activation alpha-vault access                       |
| `liquidity`                                      | Total active liquidity                                  |
| `protocol_a_fee`, `protocol_b_fee`               | Accrued protocol fees                                   |
| `sqrt_min_price`, `sqrt_max_price`, `sqrt_price` | Price bounds and current square-root price              |
| `activation_point`, `activation_type`            | Launch activation point and unit                        |
| `pool_status`                                    | `0` enabled, `1` disabled                               |
| `token_a_flag`, `token_b_flag`                   | Token program/extension flags                           |
| `collect_fee_mode`                               | Liquidity and fee mode                                  |
| `pool_type`                                      | Permissionless or customizable                          |
| `fee_version`                                    | `0` caps max fee at 50%; `1` caps max fee at 99%        |
| `fee_a_per_liquidity`, `fee_b_per_liquidity`     | Fee growth checkpoints as little-endian `U256` bytes    |
| `permanent_lock_liquidity`                       | Total permanently locked pool liquidity                 |
| `creator`                                        | Pool creator                                            |
| `token_a_amount`, `token_b_amount`               | Tracked reserves for layout version `V1`                |
| `layout_version`                                 | `V1` pools track token reserve amounts directly         |
| `reward_infos`                                   | Two pool reward slots                                   |

Use `fetchPoolState` for state and `fetchPoolFees` when you need decoded pool fee bytes.

### PoolMetrics

| Field                                          | Meaning                                                                               |
| ---------------------------------------------- | ------------------------------------------------------------------------------------- |
| `total_lp_a_fee`, `total_lp_b_fee`             | Lifetime LP fees accumulated by token side                                            |
| `total_protocol_a_fee`, `total_protocol_b_fee` | Lifetime protocol fees accumulated by token side                                      |
| `total_position`                               | Count of created positions, updated when position accounts are initialized or reduced |

### RewardInfo

| Field                                            | Meaning                                                               |
| ------------------------------------------------ | --------------------------------------------------------------------- |
| `initialized`                                    | Non-zero when a reward slot is initialized                            |
| `reward_token_flag`                              | Token program flag for the reward mint                                |
| `mint`, `vault`, `funder`                        | Reward mint, reward vault, and funder authority                       |
| `reward_duration`, `reward_duration_end`         | Campaign duration and end timestamp                                   |
| `reward_rate`                                    | Emission rate in Q64-scaled reward units                              |
| `reward_per_token_stored`                        | Cumulative reward growth checkpoint as little-endian `U256` bytes     |
| `last_update_time`                               | Last pool reward update timestamp                                     |
| `cumulative_seconds_with_empty_liquidity_reward` | Carry-forward accounting when rewards accrue while liquidity is empty |

## Position

| Field                                                      | Meaning                                                          |
| ---------------------------------------------------------- | ---------------------------------------------------------------- |
| `pool`                                                     | Pool address                                                     |
| `nft_mint`                                                 | Position NFT mint                                                |
| `fee_a_per_token_checkpoint`, `fee_b_per_token_checkpoint` | Fee checkpoints as little-endian `U256` bytes                    |
| `fee_a_pending`, `fee_b_pending`                           | Claimable pending fees                                           |
| `unlocked_liquidity`                                       | Withdrawable liquidity                                           |
| `vested_liquidity`                                         | Liquidity locked by vesting                                      |
| `permanent_locked_liquidity`                               | Liquidity that cannot be withdrawn                               |
| `reward_infos`                                             | User reward checkpoints and pending rewards for two reward slots |
| `inner_vesting`                                            | Embedded vesting schedule used by newer lock flows               |

The position NFT is the ownership handle. A position operation that changes liquidity or claims fees verifies the owner through the NFT token account.

### PositionMetrics

| Field                                        | Meaning                                        |
| -------------------------------------------- | ---------------------------------------------- |
| `total_claimed_a_fee`, `total_claimed_b_fee` | Lifetime claimed fee counters for the position |

### UserRewardInfo

| Field                         | Meaning                                      |
| ----------------------------- | -------------------------------------------- |
| `reward_per_token_checkpoint` | Last synced pool reward growth checkpoint    |
| `reward_pendings`             | Claimable pending reward amount              |
| `total_claimed_rewards`       | Lifetime claimed rewards for the reward slot |

### InnerVesting

| Field                      | Meaning                                            |
| -------------------------- | -------------------------------------------------- |
| `cliff_point`              | Slot or timestamp when cliff unlock begins         |
| `period_frequency`         | Slot or timestamp interval between unlock periods  |
| `cliff_unlock_liquidity`   | Liquidity released at the cliff                    |
| `liquidity_per_period`     | Liquidity released per period after the cliff      |
| `total_released_liquidity` | Liquidity already released into unlocked liquidity |
| `number_of_period`         | Number of post-cliff unlock periods                |

## Rewards And Vesting

Each pool has up to two `RewardInfo` slots. Once initialized, a reward slot remains initialized. Each position has matching `UserRewardInfo` checkpoints.

External `Vesting` accounts are still supported and are `176` byte zero-copy accounts keyed by `position`. `inner_vesting` stores one vesting schedule inside the `Position` account and lets integrations lock liquidity without creating a separate vesting account. Use the SDK lock and refresh helpers unless you are building low-level instructions.

## Token Badges

`TokenBadge` is a `160` byte account that records the mint for Token 2022 mints requiring review. See [Token 2022 support](/core-products/damm-v2/token-2022-support) for product behavior and supported extension categories.
