bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 22쪽
rtualPriceRaw`. |
| `LockEscrow` | `address`, `amount`, claimed token A/B fees, unclaimed LP/token A/token B fees. |
## Deep PDA And Utility Helpers
These helpers exist in `src/amm/utils.ts`. Import paths can vary between CJS and ESM builds, so prefer top-level exports where available.
| Helper | Use |
| - | - |
| `derivePoolAddress(...)` | Derive permissionless pool PDA for stable or constant-product pools. Top-level export. |
| `derivePoolAddressWithConfig(tokenA, tokenB, config, programId)` | Derive config-based constant-product pool PDA. |
| `deriveCustomizablePermissionlessConstantProductPoolAddress(tokenA, tokenB, programId)` | Derive customizable constant-product pool PDA. |
| `deriveConfigPda(index, programId)` | Derive config PDA from an index. |
| `deriveProtocolTokenFee(poolAddress, tokenMint, programId)` | Derive protocol fee token account PDA. |
| `deriveLockEscrowPda(pool, owner, programId)` | Derive a lock escrow PDA. |
| `deriveMintMetadata(lpMint)` | Derive the Metaplex metadata PDA for an LP mint. |
| `getAssociatedTokenAccount(tokenMint, owner)` | Return the canonical SPL associated token account. |
| `calculateSwapQuote(...)` | Lower-level swap quote helper used by `pool.getSwapQuote`. |
| `calculatePoolInfo(...)` | Compute token A/B amounts and virtual price from pool and vault data. |
| `getDepegAccounts(connection, poolStates)` | Fetch remaining depeg accounts for LST/stable pools. |
| `calculateUnclaimedLockEscrowFee(...)` | Convert lock escrow virtual-price movement into unclaimed LP fee. |
## Common Workflow
| Step | SDK call |
| - | - |
| Read pool state | `const pool = await AmmImpl.create(connection, poolAddress)` |
| Quote a swap | `const quote = pool.getSwapQuote(inMint, inAmount, slippage)` |
| Build a transaction | `const tx = await pool.swap(user, inMint, quote.swapInAmount, quote.minSwapOutAmount)` |
| Sign and submit | Sign with your wallet or backend signer, then send through your RPC pipeline. |
| Refresh before the next quote | `await pool.updateState()` |
## Integration Notes
| Area | Note |
| - | - |
| Amount units | All token amounts are raw integer token units. Use `BN`; do not pass UI decimals. |
| Slippage | SDK slippage parameters are percentages, not bps. |
| Returned transactions | Transactions are unsigned. Some pool creation helpers return multiple transactions. |
| Native SOL | Swap/deposit/withdraw helpers add wrap or unwrap instructions for native SOL paths. |
| Dynamic Vaults | Quotes depend on Dynamic Vault state and current clock, not only the DAMM v1 pool account. |
| Depeg pools | Stable LST pools require depeg account reads for accurate quotes and swap account lists. |
| Config pools | Private configs require the configured `pool_creator_authority` signer. |
# DAMM v2 Data API Overview
Source: https://docs.meteora.ag/developer-guides/damm-v2/api-reference/overview
Learn how the DAMM v2 Data API exposes indexed pools, pool groups, OHLCV candles, historical volume, protocol stats, and query filters.
<Tip>
**All DAMM v2 APIs have a rate limit of 10 requests per second (10 RPS).** Explore the production spec at the [Prod Swagger UI](https://damm-v2.datapi.meteora.ag/swagger-ui/) or the development spec at the [Dev Swagger UI](https://damm-v2-api.dev.metdev.io/swagger-ui/).
</Tip>
## Base URLs
| Environment | Base URL | Swagger UI |
| - | - | - |
| Production | `https://damm-v2.datapi.meteora.ag` | [Open](https://damm-v2.datapi.meteora.ag/swagger-ui/) |
| Development | `https://damm-v2-api.dev.metdev.io` | [Open](https://damm-v2-api.dev.metdev.io/swagger-ui/) |
The checked-in OpenAPI file uses the same endpoint schema for both environments. Use the server dropdown in the API playground to switch between production and development.
## Pools
<CardGroup>
<Card title="Pools" icon="file-code" href="/api-reference/damm-v2/pools/pools">
Returns a paginated list of pools using `GET` `/pools`
</Card>
<Card title="Groups" icon="file-code" href="/api-reference/damm-v2/pools/groups">
Returns a paginated list of pool groups using `GET` `/pools/groups`
</Card>
<Card title="Group" icon="file-code" href="/api-reference/damm-v2/pools/group">
Returns pools that belong to a specific pool group using `GET` `/pools/groups/{lexical_order_mints}`
</Card>
<Card title="Pool" icon="file-code" href="/api-reference/damm-v2/pools/pool">
Returns metadata and current indexed state for a single pool using `GET` `/pools/{address}`
</Card>
<Card title="OHLCV" icon="file-code" href="/api-reference/damm-v2/pools/ohlcv">
Returns OHLCV candles for a single pool over a time range using `GET` `/pools/{address}/ohlcv`
</Card>
<Card title="Historical Volume" icon="file-code" href="/api-reference/damm-v2/pools/historical-volume">
Returns historical volume for a pool aggregated into time buckets using `GET` `/pools/{address}/volume/history`
</Card>
</CardGroup>
## Stats
<CardGroup>
<Card title="Protocol Overview" icon="file-code" href="/api-reference/damm-v2/stats/protocol-overview">
Returns aggregated protocol-level metrics across all pools using `GET` `/stats/protocol_metrics`
</Card>
</CardGroup>
## Query Syntax
List endpoints use common query parameters:
| Parameter | Use |
| - | - |
| `page` | 1-based page number. |
| `page_size` | Page size. Pool lists support up to `1000`. |
| `query` | Search by pool name, tokens, or address. |
| `sort_by` | Format: `<field>:<direction>` or `<metric>_<window>:<direction>`. |
| `filter_by` | Format: `<field><op><value> [&& <field><op><value> ...]`. |
Supported time windows include `5m`, `30m`, `1h`, `2h`, `4h`, `12h`, and `24h`.
Common sortable fields include `tvl`, `fee_pct`, `bin_step`, `pool_created_at`, `farm_apy`, `volume_*`, `fee_*`, `fee_tvl_ratio_*`, and `apr_*`.
Common filter fields include `tvl`, `is_blacklisted`, `pool_address`, `name`, `token_x`, `token_y`, `volume_*`, `fee_*`, `fee_tvl_ratio_*`, and `apr_*`.
# DAMM v2 Changelog
Source: https://docs.meteora.ag/developer-guides/damm-v2/changelog
Track DAMM v2 release notes, breaking changes, and upgrade guidance for cp-amm, SDKs, events, quotes, and API integrations.
<Tip>
Track DAMM v2 releases here.
</Tip>
<Update label="cp-amm 0.2.4" description="Support for Stock Tokens migrated from DBC">
<Info>
Mainnet deployment for Release 0.2.4 is planned for September 8, 2026, at 11:00 AM UTC+8 (Tuesday).
</Info>
## Release summary
| Component | Version | PR |
| - | - | - |
| Program | `0.2.4` | [damm-v2 #225](https://github.com/MeteoraAg/damm-v2/pull/225) |
| TypeScript SDK | `1.4.8` | [damm-v2-sdk #111](https://github.com/MeteoraAg/damm-v2-sdk/pull/111) |
## What We Shipped
* Support for Stock Tokens migrated from DBC
## What To Do
<div>
<table>
<thead>
<tr>
<th>Integrators</th>
<th>What Changed</th>
<th>What To Do</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Partners</strong></td>
<td>
<ul>
<li>Support for Stock Tokens migrated from DBC</li>
</ul>
</td>
<td>
<ul>
<li>Bump your SDK version to <code>@meteora-ag/cp-amm-sdk\@1.4.7-rc.0</code> to start testing.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
## Program: `cp-amm` `0.2.4`
Program ID (mainnet and devnet): `cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG`
[Program PR #225](https://github.com/MeteoraAg/damm-v2/pull/225)
### Added
* Added `Config.permission`. Only private configs, meaning those with a `pool_creator_authority`, can hold permissions. The only permission so far is `CreatePoolWithoutMintValidation`, which lets `initialize_pool` and `initialize_pool_with_dynamic_config` skip the standard mint validation for trusted configs. The Token-2022 wrapped SOL is still rejected under this permission, use the SPL wrapped SOL instead.
### Changed
* `create_config` and `create_dynamic_config` take a new trailing `permission: u128` field.
### Breaking Changes
* `EvtCreateConfig` and `EvtCreateDynamicConfig` include the new `permission` field.
## TypeScript SDK: `@meteora-ag/cp-amm-sdk` `1.4.8`
[SDK PR #111](https://github.com/MeteoraAg/damm-v2-sdk/pull/111)
<Tip>
Early testing: [`@meteora-ag/cp-amm-sdk@1.4.7-rc.0`](https://www.npmjs.com/package/@meteora-ag/cp-amm-sdk/v/1.4.7-rc.0).<br /> Production: [`@meteora-ag/cp-amm-sdk@1.4.8`](https://www.npmjs.com/package/@meteora-ag/cp-amm-sdk/v/1.4.8).
</Tip>
### Changed
* Synced the IDL and bankrun program fixture to cp\_amm 0.2.4.
* `ConfigState.permission` is a u128 bitmask. Use `isConfigPermissionAllow` with `ConfigPermission.CreatePoolWithoutMintValidation` (bit 0) to detect configs that skip permissionless mint and token-badge checks. Token-2022 wrapped SOL is still rejected.
### Added
* Added `ConfigPermission` enum and `isConfigPermissionAllow` helper to read the config permission bitmask.
* `createPool`, `createCustomPool`, `createCustomPoolWithDynamicConfig`, and `initializeReward` reject Token-2022 wrapped SOL (`NATIVE_MINT_2022`) before sending a transaction.
</Update>
<Update label="cp-amm 0.2.3" description="Deprecation of Rate Limiter">
<Info>
Mainnet deployment for Release 0.2.3 is planned for August 20, 2026, at 11:00 AM UTC+8 (Thursday).
</Info>
## Release summary
| Component | Version | PR |
| - | - | - |
| Program | `0.2.3` | [damm-v2 #210](https://github.com/MeteoraAg/damm-v2/pull/219) |
| TypeScript SDK | `1.4.6` | [damm-v2-sdk #108](https://github.com/MeteoraAg/damm-v2-sdk/pull/108) |
## What We Shipped
* Deprecation of Rate Limiter
* Remove stranded `DEAD_LIQUIDITY` reward
## What To Do
<div>
<table>
<thead>
<tr>
<th>Integrators</th>
<th>What Changed</th>
<th>What To Do</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Partners</strong></td>
<td>
<ul>
<li>Deprecation of Rate Limiter</li>
</ul>
</td>
<td>
<ul>
<li>As the Rate Limiter is deprecated, you need to migrate to change your BaseFeeMode to other modes.</li>
<li>Bump your SDK version to <code>@meteora-ag/cp-amm-sdk\@1.4.5-rc.0</code> to start testing.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
## Program: `cp-amm` `0.2.3`
Program ID (mainnet and devnet): `cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG`
[Program PR #219](https://github.com/MeteoraAg/damm-v2/pull/219)
### Deprecated
* Deprecated `BaseFeeMode::RateLimiter`. New configs and new pools can no longer be created with `BaseFeeMode::RateLimiter`. Existing configs with `BaseFeeMode::RateLimiter` can no longer be used to create new pools.
* Existing pools with `BaseFeeMode::RateLimiter` are unaffected. Operators can still call `fix_pool_fee_params`, `fix_config_fee_params` and `update_pool_fees` on existing pools and configs with `BaseFeeMode::RateLimiter`.
### Removed
* Removed deprecated endpoints `claim_protocol_fee` and `zap_protocol_fee`.
### Fixed
* In `CollectFeeMode::Compounding` pools, the claiming fee generated by the `DEAD_LIQUIDITY` share is no longer stranded in the vault. It is settled into `Pool.protocol_b_fee` on every `claim_protocol_fee2`, tracked by the new `Pool.dead_liquidity_fee_checkpoint` field. Only the claiming fee (the `10_000 - compounding_fee_bps` portion of the trading fee) accrues to the protocol, whereas the `DEAD_LIQUIDITY` share of compounding fees intentionally remains in the reserve, benefiting LPs and traders. `PoolMetrics.total_lp_b_fee` and `PoolMetrics.total_protocol_b_fee` are left untouched since they are monotonically increasing counters. Note: actual protocol receipts = total\_protocol\_b\_fee + settled dead-liquidity fee
## TypeScript SDK: `@meteora-ag/cp-amm-sdk` `1.4.6`
[SDK PR #108](https://github.com/MeteoraAg/damm-v2-sdk/pull/108)
<Tip>
Early testing: [`@meteora-ag/cp-amm-sdk@1.4.5-rc.0`](https://www.npmjs.com/package/@meteora-ag/cp-amm-sdk/v/1.4.5-rc.0).<br /> Production: [`@meteora-ag/cp-amm-sdk@1.4.6`](https://www.npmjs.com/package/@meteora-ag/cp-amm-sdk/v/1.4.6).
</Tip>
### Changed
* Synced the IDL and bankrun program fixture to cp\_amm 0.2.3.
* **Breaking:** `getBaseFeeParams` no longer takes `tokenBDecimal` or `activationType`. Those arguments were only used to encode RateLimiter params, which this helper now rejects.
### Deprecated
* Deprecated `BaseFeeMode.RateLimiter` for new configs and new pools. `getBaseFeeParams`, `validatePoolFees`, `createCustomPool`, `createCustomPoolWithDynamicConfig`, and `createPool` reject RateLimiter. Existing RateLimiter pools still quote and swap. `getRateLimiterParams` and the rate-limiter encode/decode helpers remain for those pools.
</Update>
<Update label="cp-amm 0.2.2" description="Position Delegate">
<Info>
Mainnet deployment for Release 0.2.2 is planned for June 26, 2026, at 11:00 AM UTC+8 (Friday).
</Info>
## Release summary
| Component | Version | PR |
| - | - | - |
| Program | `0.2.2` | [damm-v2 #210](https://github.com/MeteoraAg/damm-v2/pull/210) |
| TypeScript SDK | `1.4.4` | [damm-v2-sdk #105](https://github.com/MeteoraAg/damm-v2-sdk/pull/105) |
## What We Shipped
* Position Delegate
* Withdraw Dead Liquidity (Compounding Pools Only)
## What To Do
<div>
<table>
<thead>
<tr>
<th>Integrators</th>
<th>What Changed</th>
<th>What To Do</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Partners</strong></td>
<td>
<ul>
<li>New Position Delegate Instruction</li>
<li>New Withdraw Dead Liquidity Instruction</li>
</ul>
</td>
<td>
<ul>
<li>Bump your SDK version to <code>@meteora-ag/cp-amm-sdk\@1.4.3-rc.0</code> to start testing.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
## Program: `cp-amm` `0.2.2`
Program ID (mainnet and devnet): `cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG`
[Program PR #210](https://github.com/MeteoraAg/damm-v2/pull/210)
### Added
* Added support for NFT delegates to manage positions. The following endpoints can now be signed by a delegate if the owner has granted them permission: `claim_position_fee`, `claim_reward`, `add_liquidity`, `remove_liquidity`, `remove_all_liquidity`, `lock_position`, `lock_inner_position`, `permanent_lock_position`. Note: the `close_position`, `split_position`, and `split_position2` endpoints remain callable by the owner only.
* Added new endpoint `update_delegate_permission` to set the permission bitmask on `Position.delegate_permission`. Pass `permission = 0` to clear all permissions. Callers are responsible for managing the SPL token delegate via SPL `Approve` / `Revoke` separately. The bitmask supports 8 permissions: `AddLiquidity`, `RemoveLiquidity`, `RemoveLiquidityToOwner`, `ClaimPositionFee`, `ClaimPositionFeeToOwner`, `ClaimReward`, `ClaimRewardToOwner`, `LockPosition`.
* Added new endpoint `withdraw_dead_liquidity_reward` allowing the funder to recover the unowned `DEAD_LIQUIDITY` reward share of a `CollectFeeMode::Compounding` pool at any time, without waiting for the reward campaign to end. This share is tracked by the new `dead_liquidity_reward_checkpoint` field in the Pool `RewardInfo`.
### Changed
* Renamed the signer account from `owner` to `signer`, now that the signer may be a delegate, in the following endpoints: `claim_position_fee`, `claim_reward`, `add_liquidity`, `remove_liquidity`, `remove_all_liquidity`, `lock_position`, `lock_inner_position`, `permanent_lock_position`.
### Breaking Changes
* The following endpoints previously rejected unauthorized signers with Anchor's `ConstraintTokenOwner` (2015) and now reject with `PoolError::InvalidAuthority` (6053), `PoolError::InvalidPermission` (6054), or `PoolError::DelegatedAmountNonZero` (6070): `claim_position_fee`, `claim_reward`, `add_liquidity`, `remove_liquidity`, `remove_all_liquidity`, `lock_position`, `lock_inner_position`, `permanent_lock_position`.
## TypeScript SDK: `@meteora-ag/cp-amm-sdk` `1.4.4`
[SDK PR #105](https://github.com/MeteoraAg/damm-v2-sdk/pull/105)
<Tip>
Early testing: [`@meteora-ag/cp-amm-sdk@1.4.3-rc.0`](https://www.npmjs.com/package/@meteora-ag/cp-amm-sdk/v/1.4.3-rc.0).<br /> Production: [`@meteora-ag/cp-amm-sdk@1.4.4`](https://www.npmjs.com/package/@meteora-ag/cp-amm-sdk/v/1.4.4).
</Tip>
### Added
* Added `updateDelegatePermission` endpoint to grant or revoke delegate permissions on a position. It SPL-approves the delegate on the position NFT account and sets the on-chain delegate permission bitmask in a single transaction.
* Added `withdrawDeadLiquidityReward` endpoint to withdraw the reward share attributable to a compounding pool's permanent dead liquidity. Only valid for `CollectFeeMode.Compounding` pools.
* Added `PositionDelegatePermission` enum and `encodeDelegatePermissions` helper to build the delegate permission bitmask.
* Added `UpdateDelegatePermissionParams` and `WithdrawDeadLiquidityRewardParams` types.
### Changed
* Bumped the IDL and program fixture: the signer account on position instructions (`addLiquidity`, `removeLiquidity`, `removeAllLiquidity`, `claimPositionFee`, `claimReward`, `lockPosition`, `lockInnerPosition` and `permanentLockPosition`) was renamed from `owner` to `signer` so a delegate can sign. SDK parameter interfaces are unchanged.
</Update>
<Update label="cp-amm 0.2.0" description="Compounding Liquidity">
<Info>
Mainnet deployment for Release 0.2.0 is planned for March 13, 2026, at 11:00 AM UTC+8 (Friday).
</Info>
<Warning>
**Breaking release.** If you build swap instructions manually, run DLMM swap quotes, or index certain DLMM events, please plan an upgrade before mainnet deployment.
</Warning>
## Release summary
| Component | Version | PR |
| - | - | - |
| Program | `0.2.0` | [damm-v2 #187](https://github.com/MeteoraAg/damm-v2/pull/187) |
| TypeScript SDK | `1.3.7` | [damm-v2-sdk #101](https://github.com/MeteoraAg/damm-v2-sdk/pull/101) |
## What We Shipped
* Compounding Liquidity
## What To Do
<div>
<table>
<thead>
<tr>
<th>Integrators</th>
<th>What Changed</th>
<th>What To Do</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Swap Routers</strong></td>
<td>
<ul>
<li>Swap quote computation</li>
</ul>
</td>
<td>
<ul>
<li>For concentrated pools, update your quote logic to exclude <code>partnerFee</code> from fee calculations</li>
<li>For compounding pools, update your quote logic to use the constant-product formula <code>x \* y = k</code>. Compute quotes using token\_a\_amount, token\_b\_amount, and liquidity from pool state.</li>
</ul>
</td>
</tr>
<tr>
<td><strong>Trading Terminals</strong></td>
<td>
<ul>
<li><code>EvtSwap2</code> event parsing</li>
<li>Tracking of pool reserves amounts for compounding pools</li>
</ul>
</td>
<td>
<ul>
<li>swap\_result.partner\_fee is removed. Total trading fee is now split into claiming\_fee and compounding\_fee. Update event deserialization accordingly.</li>
<li>Read token\_a\_amount and token\_b\_amount directly from pool state (not derived from liquidity math).</li>
</ul>
</td>
</tr>
<tr>
<td><strong>Partners</strong></td>
<td>
<ul>
<li>Swap quote computation</li>
<li>Pool liquidity derivation</li>
</ul>
</td>
<td>
<ul>
<li>Bump your SDK version to <code>@meteora-ag/cp-amm-sdk\@1.3.6.rc.1</code> to start testing.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
## Program: `cp-amm` `0.2.0`
Program ID (mainnet and devnet): `cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG`
[Program PR #187](https://github.com/MeteoraAg/damm-v2/pull/187)
### Added
* Pool now will track reserves balances `(token_a_amount, token_b_amount)` if `pool.layout_version == 1`. For pool layout\_version 0, operator can call the new endpoint `fix_pool_layout_version` to pump pool version.
* Add a new `collect_fee_mode (Compounding)`, in the new collect fee mode, fee will be collected in quote token, and a percentage of fee (configurable) will be added in reserves for compounding. In the new collect fee mode, the pool doesn't have concentrated price range, instead following constant-product formula `token_a_amount * token_b_amount = constant`.
* Endpoints `create_config`, `initialize_customizable_pool` and `initialize_po프로젝트로 돌아가기