Skip to main content

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.

The cp-amm program emits Anchor events through event CPI. Use this page when building indexers, analytics pipelines, charting systems, or low-level clients that need to map transactions back to DAMM v2 pool activity.

Event CPI

ItemValue
Program IDcpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG
Event authority PDA seed__event_authority
Event sourceAnchor event CPI inner instructions
Client account planningEvent-emitting instructions include event_authority and the program account. SDK builders and generated clients derive these accounts.
Swap hot pathThe optimized swap entrypoint emits the same Anchor event-CPI payload for EvtSwap2.
Low-level builders should pass the event authority account and the cp-amm program account when the IDL requires them. The program signs the self-CPI with the event authority PDA internally.

Pool And Config Events

EventEmitted byPayload
EvtCreateConfigcreate_configStatic config fees, vault config, pool creator authority, activation type, sqrt price range, collect-fee mode, index, and config address.
EvtCreateDynamicConfigcreate_dynamic_configDynamic config address, pool creator authority, and index.
EvtCloseConfigclose_configConfig address and admin.
EvtCreateTokenBadgecreate_token_badgeToken mint that received a badge.
EvtInitializePoolinitialize_pool, initialize_pool_with_dynamic_config, initialize_customizable_poolPool address, token mints, creator, payer, alpha vault, fee parameters, sqrt price range, activation fields, token flags, initial token amounts, initial reserves, liquidity, and pool type.
EvtInitializePool is the primary pool-creation event. Indexers should treat it as the source of pool metadata at creation time, then reconcile current mutable state from the pool account.

Position Events

EventEmitted byPayload
EvtCreatePositionPool initialization instructions and create_positionPool, owner, position account, and position NFT mint.
EvtClosePositionclose_positionPool, owner, position account, and position NFT mint.
EvtSplitPosition2split_position, split_position2Deprecated compatibility event with split amounts and position snapshots without vested-liquidity fields.
EvtSplitPosition3split_position, split_position2Current split event with owners, source and destination positions, current sqrt price, split amounts, position snapshots, and split parameters.
New indexers should use EvtSplitPosition3. The current split handler emits EvtSplitPosition2 for backward compatibility, but EvtSplitPosition3 carries the current payload shape.

Liquidity And Lock Events

EventEmitted byPayload
EvtLiquidityChangeadd_liquidity, remove_liquidity, remove_all_liquidityPool, position, owner, token A/B amounts, transfer-fee-included token amounts, reserve snapshots, liquidity delta, token amount thresholds, and change_type.
EvtLockPositionlock_position, lock_inner_positionPool, position, owner, vesting account, cliff point, period frequency, cliff unlock liquidity, liquidity per period, and number of periods.
EvtPermanentLockPositionpermanent_lock_positionPool, position, newly locked liquidity, and total permanent locked liquidity.
EvtLiquidityChange.change_type is 0 for add liquidity and 1 for remove liquidity.

Swap Events

EventEmitted byPayload
EvtSwap2swap, swap2Pool, trade direction, collect-fee mode, referral flag, swap parameters, swap result, transfer-fee fields, timestamp, and reserve snapshots.
EvtSwap2 is the canonical swap event for charting and analytics. Prefer it over SPL token transfer logs because DAMM v2 swaps can include Token-2022 transfer fees, protocol fees, compounding fees, and referral fees.
FieldMeaning
trade_direction0 means token A to token B. 1 means token B to token A.
has_referralWhether a referral account participated in the swap.
params.amount_0Input amount for exact-in and partial-fill swaps. Desired output amount for exact-out swaps.
params.amount_1Minimum output for exact-in and partial-fill swaps. Maximum input for exact-out swaps.
params.swap_mode0 exact in, 1 partial fill, 2 exact out.
swap_result.included_fee_input_amountInput amount including transfer fee accounting.
swap_result.excluded_fee_input_amountInput amount after excluded transfer fee accounting.
swap_result.amount_leftUnused input for partial-fill or exact-out execution.
swap_result.output_amountSwap output amount before external transfer-fee effects.
swap_result.next_sqrt_pricePool sqrt price after the swap.
swap_result.claiming_feeLP fee component.
swap_result.protocol_feeProtocol fee component.
swap_result.compounding_feeCompounding fee component.
swap_result.referral_feeReferral fee component.
included_transfer_fee_amount_inTransfer fee included on input side.
included_transfer_fee_amount_outTransfer fee included on output side.
excluded_transfer_fee_amount_outOutput amount excluded by transfer fee accounting.
reserve_a_amount, reserve_b_amountPool reserve snapshots after execution.

Fee And Reward Events

EventEmitted byPayload
EvtClaimPositionFeeclaim_position_feePool, position, owner, claimed token A fee, and claimed token B fee.
EvtClaimProtocolFeeclaim_protocol_feePool and protocol fee amounts claimed from token A and token B.
EvtInitializeRewardinitialize_rewardPool, reward mint, funder, creator, reward index, and reward duration.
EvtFundRewardfund_rewardPool, funder, reward mint, reward index, funded amount, transfer-fee-excluded input amount, reward duration end, previous reward rate, and new reward rate.
EvtClaimRewardclaim_rewardPool, position, owner, reward mint, reward index, and claimed reward amount.
EvtUpdateRewardDurationupdate_reward_durationPool, reward index, old duration, and new duration.
EvtUpdateRewardFunderupdate_reward_funderPool, reward index, old funder, and new funder.
EvtWithdrawIneligibleRewardwithdraw_ineligible_rewardPool, reward mint, and withdrawn amount.
Reward indexes are limited to the two DAMM v2 reward slots, 0 and 1.

Operator Events

EventEmitted byPayload
EvtSetPoolStatusset_pool_statusPool and status byte.
EvtUpdatePoolFeesupdate_pool_feesPool, operator, and update parameters.
EvtUpdatePoolFees.params.cliff_fee_numerator is optional. EvtUpdatePoolFees.params.dynamic_fee is also optional; None skips dynamic-fee updates, while a default dynamic-fee value disables dynamic fees.

Fee Parameter Decoding

EvtInitializePool.pool_fees.base_fee.data uses the Borsh event format. Pool account state uses the Pod-aligned account format.
SourceFormatTypeScript decoder family
EvtInitializePool eventBorshdecodeFeeTimeSchedulerParams, decodeFeeRateLimiterParams, decodeFeeMarketCapSchedulerParams
Pool state accountPod-aligneddecodePodAlignedFeeTimeScheduler, decodePodAlignedFeeRateLimiter, decodePodAlignedFeeMarketCapScheduler
Choose the decoder from the pool fee mode. Do not decode an event payload with a pool-state decoder, or pool account data with an event decoder.

Indexing Notes

Use caseEvent to index
Pool discoveryEvtInitializePool
Position lifecycleEvtCreatePosition, EvtClosePosition
LP accountingEvtLiquidityChange, EvtClaimPositionFee
Swap history and candlesEvtSwap2
RewardsEvtInitializeReward, EvtFundReward, EvtClaimReward, EvtUpdateRewardDuration, EvtUpdateRewardFunder, EvtWithdrawIneligibleReward
Locks and vestingEvtLockPosition, EvtPermanentLockPosition, EvtSplitPosition3
Operator changesEvtSetPoolStatus, EvtUpdatePoolFees, config events
Most events include pool and can be joined directly to pool state. Config and token-badge events do not necessarily include a pool, so index them by config address or token mint.