Meteora 백서

Meteora

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 25쪽

ional compounding fee bps. | | `sqrt_min_price` / `sqrt_max_price` | Pool price range. Non-compounding pools must stay within the program min/max sqrt price and have `sqrt_min_price < sqrt_max_price`. | | `has_alpha_vault` | Enables the pool's whitelisted alpha vault address for pre-activation buys. | | `liquidity` | Initial liquidity. Must be greater than `0`. | | `sqrt_price` | Initial sqrt price as a Q64.64 `sqrt(token_b / token_a)` value. | | `activation_type` | `0` for slot activation or `1` for timestamp activation. | | `collect_fee_mode` | `0` for both-token output fees, `1` for token-B-only fees, or `2` for compounding. | | `activation_point` | Optional activation slot or timestamp. If an alpha vault is enabled, this must be provided and must be within the allowed activation window. | This model is usually the best fit for launchpads and integrators that need custom launch fee curves while preventing unauthorized pool creation for the same token pair and config. <Note>If you're a launchpad or integrator that's keen to create your own unique custom pool config key with custom `pool_fees`, please reach out to the team on [discord](https://discord.gg/meteora).</Note> # DAMM v2 Program Accounts Source: https://docs.meteora.ag/developer-guides/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 (deprecated for new configs and new pools), market-cap scheduler linear, market-cap scheduler exponential | | `SwapMode` | `0` ExactIn, `1` PartialFill, `2` ExactOut | | `ConfigPermission` | `0` `CreatePoolWithoutMintValidation` | | `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 | | `permission` | `u128` bitmask. Only private configs, meaning those with a non-default `pool_creator_authority`, can hold a non-zero value. The only defined bit today is `CreatePoolWithoutMintValidation` (`1 << 0`). Pre-existing configs decode as `0`. | Use `fetchConfigState`, `getStaticConfigs`, or `getAllConfigs` to read configs from TypeScript. Use `isConfigPermissionAllow` with `ConfigPermission.CreatePoolWithoutMintValidation` to detect configs that skip permissionless mint and token-badge checks. ### 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 an operator-approved Token 2022 mint. Pool creation and reward initialization require this account when the mint is not permissionless-supported, unless the pool is created from a private config with `CreatePoolWithoutMintValidation`. A badge cannot be created for a mint that is already permissionlessly supported, and it cannot override the native Token 2022 mint rejection. A DBC token badge is not a DAMM v2 token badge. DBC-migrated Stock Tokens use private DAMM v2 configs with `CreatePoolWithoutMintValidation` instead of a per-mint DAMM v2 badge. See [Token 2022 support](/core-products/damm-v2/token-2022-support) for the permissionless allowlist, badge review path, and config permission rules. # DAMM v2 Program Errors Source: https://docs.meteora.ag/developer-guides/damm-v2/program/errors Understand DAMM v2 cp-amm PoolError codes, SDK validation errors, messages, and common integration causes. This page lists the Anchor custom errors returned by the DAMM v2 `cp-amm` program. <Tip> Anchor custom program errors start at `6000`. When a transaction log contains `custom program error: 0x1771`, convert the hex value to decimal to find the matching code. For example, `0x1771` is `6001`, which maps to `InvalidFee`. </Tip> ## Error Codes | Code | Name | Message | Common cause | | - | - | - | - | | `6000` | `MathOverflow` | Math operation overflow | Checked arithmetic overflowed during fee, price, swap, reward, or liquidity math. | | `6001` | `InvalidFee` | Invalid fee setup | Base, dynamic, protocol, referral, or compounding fee parameters failed validation. | | `6002` | `ExceededSlippage` | Exceeded slippage tolerance | The output, input, or liquidity amount was worse than the caller's threshold. Refresh the quote. | | `6003` | `PoolDisabled` | Pool disabled | The pool status does not allow the requested action. | | `6004` | `ExceedMaxFeeBps` | Exceeded max fee bps | Fee settings exceed the pool version's maximum fee. | | `6005` | `InvalidAdmin` | Invalid admin | An admin or operator-only action was signed by an unauthorized account. | | `6006` | `AmountIsZero` | Amount is zero | Swap, liquidity, reward, or fee amount is zero. | | `6007` | `TypeCastFailed` | Type cast error | A numeric conversion failed after large integer math. | | `6008` | `UnableToModifyActivationPoint` | Unable to modify activation point | A config or pool activation point can no longer be changed. | | `6009` | `InvalidAuthorityToCreateThePool` | Invalid authority to create the pool | The signer is not allowed to create a pool from the selected config. | | `6010` | `InvalidActivationType` | Invalid activation type | Activation type is not slot or timestamp. | | `6011` | `InvalidActivationPoint` | Invalid activation point | Activation point is invalid for the selected activation type or launch state. | | `6012` | `InvalidQuoteMint` | Quote token must be SOL,USDC | A restricted quote-mint path received a non-supported quote mint. | | `6013` | `InvalidFeeCurve` | Invalid fee curve | Fee schedule parameters do not produce a valid curve. | | `6014` | `InvalidPriceRange` | Invalid Price Range | Minimum, maximum, or initial square-root price is outside the allowed range. | | `6015` | `PriceRangeViolation` | Trade is over price range | Swap or liquidity math would move outside pool price bounds. | | `6016` | `InvalidParameters` | Invalid parameters | Generic validation failure for instruction parameters. | | `6017` | `InvalidCollectFeeMode` | Invalid collect fee mode | The collect fee mode byte or mode/config combination is unsupported. | | `6018` | `InvalidInput` | Invalid input | Generic input guard failed, often from token order, amount, or mode mismatch. | | `6019` | `CannotCreateTokenBadgeOnSupportedMint` | Cannot create token badge on supported mint | A token badge was requested for a mint that does not need one. | | `6020` | `InvalidTokenBadge` | Invalid token badge | Token badge account is missing, wrong, or does not match the mint. | | `6021` | `InvalidMinimumLiquidity` | Invalid minimum liquidity | Pool creation or liquidity change would violate minimum liquidity. | | `6022` | `InvalidVestingInfo` | Invalid vesting information | Vesting schedule fields are invalid or inconsistent. | | `6023` | `InsufficientLiquidity` | Insufficient liquidity | The pool or position cannot satisfy the requested swap or withdrawal. | | `6024` | `InvalidVestingAccount` | Invalid vesting account | External vesting account does not match the position or expected PDA. | | `6025` | `InvalidPoolStatus` | Invalid pool status | Status byte is invalid or status update is not allowed. | | `6026` | `UnsupportNativeMintToken2022` | Unsupported native mint token2022 | Native SOL mint was used through the Token 2022 path. | | `6027` | `InvalidRewardIndex` | Invalid reward index | Reward index is outside the two supported reward slots. | | `6028` | `InvalidRewardDuration` | Invalid reward duration | Reward campaign duration is outside allowed bounds. | | `6029` | `RewardInitialized` | Reward already initialized | The selected reward slot has already been initialized. | | `6030` | `RewardUninitialized` | Reward not initialized | Claim, fund, or update targeted an uninitialized reward slot. | | `6031` | `InvalidRewardVault` | Invalid reward vault | Reward vault account does not match the pool reward slot. | | `6032` | `MustWithdrawnIneligibleReward` | Must withdraw ineligible reward | Ineligible reward must be withdrawn before the next reward action. | | `6033` | `IdenticalRewardDuration` | Reward duration is the same | Reward duration update used the existing duration. | | `6034` | `RewardCampaignInProgress` | Reward campaign in progress | Reward duration update was attempted before the campaign ended. | | `6035` | `IdenticalFunder` | Identical funder | Reward funder update used the current funder. | | `6036` | `InvalidFunder` | Invalid funder | Signer or funder account does not match reward authority requirements. | | `6037` | `RewardNotEnded` | Reward not ended | Ineligible reward withdrawal was attempted before campaign end. | | `6038` | `FeeInverseIsIncorrect` | Fee inverse is incorrect | Fee inverse calculation failed validation. | | `6039` | `PositionIsNotEmpty` | Position is not empty | Close was attempted while liquidity, fees, rewards, or locks remain. | | `6040` | `InvalidPoolCreatorAuthority` | Invalid pool creator authority | Config creator authority is invalid or mismatched. | | `6041` | `InvalidConfigType` | Invalid config type | Static and dynamic config paths were mixed incorrectly. | | `6042` | `InvalidPoolCreator` | Invalid pool creator | Pool creator account does not satisfy config or operator constraints. | | `6043` | `RewardVaultFrozenSkipRequired` | Reward vault is frozen, must skip reward to proceed | Reward vault is frozen and the caller did not use the skip-reward path. | | `6044` | `InvalidSplitPositionParameters` | Invalid parameters for split position | Split numerator, target position, or liquidity state is invalid. | | `6045` | `UnsupportPositionHasVestingLock` | Unsupported split position has vesting lock | Split operation is not supported for the current vesting lock state. | | `6046` | `SamePosition` | Same position | Source and destination position are the same. | | `6047` | `InvalidBaseFeeMode` | Invalid base fee mode | Base fee mode is not one of the supported scheduler modes. New configs and new pools cannot use rate limiter; that rejection is `DeprecatedBaseFeeMode` (`6071`). | | `6048` | `InvalidFeeRateLimiter` | Invalid fee rate limiter | Rate limiter fee parameters failed validation. | | `6049` | `FailToValidateSingleSwapInstruction` | Fail to validate single swap instruction in rate limiter | Rate-limiter swap did not include the instructions sysvar or violated single-swap checks. | | `6050` | `InvalidFeeTimeScheduler` | Invalid fee scheduler | Time scheduler fee parameters failed validation. | | `6051` | `UndeterminedError` | Undetermined error | Fallback error for unexpected internal state. | | `6052` | `InvalidPoolVersion` | Invalid pool version | Pool layout or fee version is unsupported by the requested path. | | `6053` | `InvalidAuthority` | Invalid authority to do that action | Signer does not own or control the position, pool, config, or operator action. | | `6054` | `InvalidPermission` | Invalid permission | Operator permission bits do not allow the requested action. | | `6055` | `InvalidFeeMarketCapScheduler` | Invalid fee market cap scheduler | Market-cap scheduler parameters failed validation. | | `6056` | `CannotUpdateBaseFee` | Cannot update base fee | Base fee update is not allowed for the current pool or mode. | | `6057` | `InvalidDynamicFeeParameters` | Invalid dynamic fee parameters | Dynamic fee configuration failed bounds checks. | | `6058` | `InvalidUpdatePoolFeesParameters` | Invalid update pool fees parameters | Pool fee update parameters are inconsistent or unauthorized. | | `6059` | `MissingOperatorAccount` | Missing operator account | Operator-only instruction did not include the required operator PDA. | | `6060` | `IncorrectATA` | Incorrect ATA | Associated token account does not match the expected mint or owner. | | `6061` | `InvalidZapOutParameters` | Invalid zap out parameters | Protocol-fee zap parameters are invalid. | | `6062` | `InvalidWithdrawProtocolFeeZapAccounts` | Invalid withdraw protocol fee zap accounts | Zap protocol-fee accounts are missing or mismatched. | | `6063` | `MintRestr
프로젝트로 돌아가기