Meteora 백서

Meteora

원문

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

h pools. | Field | Use | | - | - | | `pool_fees` | Trade and protocol fee fractions applied to pools created from the config. | | `activation_duration` | Duration added to the current slot or timestamp to derive the default activation point. | | `vault_config_key` | Alpha Vault config or base key. Default pubkey means no alpha vault. | | `pool_creator_authority` | If default, the config is public. If non-default, only this signer can create pools from the config. | | `activation_type` | `0` slot or `1` timestamp. | | `partner_fee_numerator` | Partner share of protocol fee using `FEE_DENOMINATOR`. | | `_padding` | Reserved bytes. | The TypeScript SDK exposes `createConfig`, `getPoolConfig`, `getFeeConfigurations`, and `getPoolConfigsWithPoolCreatorAuthority`. ## LockEscrow `LockEscrow` tracks LP tokens locked for an owner and the fee value accrued by locked LP. | Field | Use | | - | - | | `pool` | DAMM v1 pool. | | `owner` | Owner entitled to the locked LP fee stream. | | `escrow_vault` | SPL token account that stores locked pool LP tokens. | | `bump` | Lock escrow PDA bump. | | `total_locked_amount` | Locked LP amount after fee accrual adjustments. | | `lp_per_token` | Virtual-price checkpoint used to derive unclaimed LP fee. | | `unclaimed_fee_pending` | Pending LP-denominated fee amount. | | `a_fee`, `b_fee` | Lifetime token A and token B fees claimed from this escrow. | ## Operator `Operator` is a zero-copy admin-created permission account. | Field | Use | | - | - | | `whitelisted_address` | Address authorized for the permission bitmap. | | `permission` | `u128` bitmap. Bit `0` allows protocol fee claiming. Bit `1` allows zap protocol fee. | | `padding` | Reserved bytes. | ## Nested Types | Type | Fields | Use | | - | - | - | | `PoolFees` | `trade_fee_numerator`, `trade_fee_denominator`, `protocol_trade_fee_numerator`, `protocol_trade_fee_denominator` | Trade fee and protocol share of trade fee. | | `PartnerInfo` | `fee_numerator`, `partner_authority`, `pending_fee_a`, `pending_fee_b` | Optional partner fee state for config-created pools. | | `Bootstrapping` | `activation_point`, `whitelisted_vault`, deprecated `pool_creator`, `activation_type` | Launch-pool activation and alpha-vault access state. | | `TokenMultiplier` | `token_a_multiplier`, `token_b_multiplier`, `precision_factor` | Stable-swap decimal normalization. | | `Depeg` | `depeg_type`, `base_virtual_price`, `base_cache_updated` | LST/depeg virtual price data. | | `CustomizableParams` | `trade_fee_numerator`, `activation_point`, `has_alpha_vault`, `activation_type`, `padding` | Parameters for customizable constant-product pools. | | `ConfigParameters` | fee numerators, activation fields, vault config, creator authority, index, partner fee | Parameters used by `create_config`. | ## Dynamic Vault Relationship DAMM v1 does not hold all pool token inventory directly in the `Pool` account. Each token side uses a Dynamic Vault account: | Account | Role | | - | - | | `a_vault`, `b_vault` | Dynamic Vault state accounts for token A and token B. | | `a_token_vault`, `b_token_vault` | Token accounts owned by each Dynamic Vault. | | `a_vault_lp_mint`, `b_vault_lp_mint` | Dynamic Vault LP mints. | | `a_vault_lp`, `b_vault_lp` | DAMM v1 pool-owned Dynamic Vault LP token accounts. | Quote engines must read the pool, both Dynamic Vault accounts, both vault token accounts, both vault LP mints, both pool vault-LP token accounts, the clock sysvar, and any depeg/stake accounts required by the curve. # DAMM v1 Program Errors Source: https://docs.meteora.ag/developer-guides/damm-v1/program/errors Understand DAMM v1 dynamic AMM Anchor errors, including codes, enum names, messages, and common integration causes. This page lists the Anchor custom errors returned by the DAMM v1 `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 Reference | Code | Error | Message | Common cause | | - | - | - | - | | `6000` | `MathOverflow` | Math operation overflow | Arithmetic overflow or invalid intermediate value. | | `6001` | `InvalidFee` | Invalid fee setup | Fee fraction is invalid, out of bounds, or not allowed for the curve/config. | | `6002` | `InvalidInvariant` | Invalid invariant d | Stable invariant calculation failed. | | `6003` | `FeeCalculationFailure` | Fee calculation failure | Fee math could not produce a valid value. | | `6004` | `ExceededSlippage` | Exceeded slippage tolerance | Output or LP amount did not satisfy the caller's minimum/maximum threshold. | | `6005` | `InvalidCalculation` | Invalid curve calculation | Swap, deposit, or withdrawal math failed. | | `6006` | `ZeroTradingTokens` | Given pool token amount results in zero trading tokens | LP amount is too small to produce output. | | `6007` | `ConversionError` | Math conversion overflow | Numeric cast cannot fit the target type. | | `6008` | `FaultyLpMint` | LP mint authority must be 'A' vault lp, without freeze authority, and 0 supply | LP mint does not match required initialization constraints. | | `6009` | `MismatchedTokenMint` | Token mint mismatched | Token account or vault mint does not match pool state. | | `6010` | `MismatchedLpMint` | LP mint mismatched | LP token account or mint does not match pool state. | | `6011` | `MismatchedOwner` | Invalid lp token owner | LP token owner does not match the required signer or escrow. | | `6012` | `InvalidVaultAccount` | Invalid vault account | Dynamic Vault account does not match the expected token mint or PDA. | | `6013` | `InvalidVaultLpAccount` | Invalid vault lp account | Pool's Dynamic Vault LP token account is invalid. | | `6014` | `InvalidPoolLpMintAccount` | Invalid pool lp mint account | Pool LP mint account is invalid. | | `6015` | `PoolDisabled` | Pool disabled | Operation is blocked because the pool is disabled. | | `6016` | `InvalidAdminAccount` | Invalid admin account | Legacy admin account check failed. | | `6017` | `InvalidProtocolFeeAccount` | Invalid protocol fee account | Protocol fee token account does not match expected PDA or mint. | | `6018` | `SameAdminAccount` | Same admin account | Old and new admin are identical in a legacy admin flow. | | `6019` | `IdenticalSourceDestination` | Identical user source and destination token account | Swap source and destination are the same account. | | `6020` | `ApyCalculationError` | Apy calculation error | Legacy APY calculation failed. | | `6021` | `InsufficientSnapshot` | Insufficient virtual price snapshot | Missing virtual-price data for yield/APY math. | | `6022` | `NonUpdatableCurve` | Current curve is non-updatable | Attempted to override a curve that cannot be updated. | | `6023` | `MisMatchedCurve` | New curve is mismatched with old curve | New curve type differs from existing curve type. | | `6024` | `InvalidAmplification` | Amplification is invalid | Stable amp is not within the allowed range or permissionless value. | | `6025` | `UnsupportedOperation` | Operation is not supported | Instruction is not supported for this pool or curve. | | `6026` | `ExceedMaxAChanges` | Exceed max amplification changes | Stable amp update exceeds max allowed change. | | `6027` | `InvalidRemainingAccountsLen` | Invalid remaining accounts length | Depeg, referral, zap, or remaining account list length is incorrect. | | `6028` | `InvalidRemainingAccounts` | Invalid remaining account | A required remaining account is wrong or in the wrong order. | | `6029` | `MismatchedDepegMint` | Token mint B doesn't matches depeg type token mint | Depeg configuration does not match the expected token mint. | | `6030` | `InvalidApyAccount` | Invalid APY account | Legacy APY account validation failed. | | `6031` | `InvalidTokenMultiplier` | Invalid token multiplier | Stable token multiplier is invalid for the token decimals or precision. | | `6032` | `InvalidDepegInformation` | Invalid depeg information | Depeg type, cache, virtual price, or remaining account data is invalid. | | `6033` | `UpdateTimeConstraint` | Update time constraint violated | Stable amp or depeg update happened before the cooldown passed. | | `6034` | `ExceedMaxFeeBps` | Exceeded max fee bps | Trade fee exceeds the program max. | | `6035` | `InvalidAdmin` | Invalid admin | Admin signer is not the configured program admin. | | `6036` | `PoolIsNotPermissioned` | Pool is not permissioned | Admin-only permissioned-pool operation was used on another pool type. | | `6037` | `InvalidDepositAmount` | Invalid deposit amount | Pool creation or liquidity instruction received invalid token amounts. | | `6038` | `InvalidFeeOwner` | Invalid fee owner | Partner or fee owner signer/account does not match pool state. | | `6039` | `NonDepletedPool` | Pool is not depleted | Bootstrap liquidity was attempted before the pool was depleted. | | `6040` | `AmountNotPeg` | Token amount is not 1:1 | Stable permissionless creation did not satisfy the expected peg ratio. | | `6041` | `AmountIsZero` | Amount is zero | Instruction amount is zero where a positive amount is required. | | `6042` | `TypeCastFailed` | Type cast error | Numeric cast failed. | | `6043` | `AmountIsNotEnough` | Amount is not enough | Provided amount is lower than the required minimum. | | `6044` | `InvalidActivationDuration` | Invalid activation duration | Config or customizable activation duration is outside limits. | | `6045` | `PoolIsNotLaunchPool` | Pool is not launch pool | Launch-pool-only instruction used on a non-launch pool. | | `6046` | `UnableToModifyActivationPoint` | Unable to modify activation point | Activation update attempted after the pre-activation swap window started. | | `6047` | `InvalidAuthorityToCreateThePool` | Invalid authority to create the pool | Config has a non-default creator authority and signer does not match. | | `6048` | `InvalidActivationType` | Invalid activation type | Activation type is not `0` slot or `1` timestamp. | | `6049` | `InvalidActivationPoint` | Invalid activation point | Activation point is not in the allowed window. | | `6050` | `PreActivationSwapStarted` | Pre activation swap window started | Attempted restricted activation update after pre-activation swap began. | | `6051` | `InvalidPoolType` | Invalid pool type | Pool type does not match the instruction requirement. | | `6052` | `InvalidQuoteMint` | Quote token must be SOL,USDC | Mainnet alpha-vault launch path requires SOL or USDC quote-side mint. | | `6053` | `InvalidTokenMetadataProgram` | Invalid token metadata program | Metadata program account is not the Metaplex metadata program. | | `6054` | `InvalidPermission` | Invalid permission | Operator permission bitmap is zero or exceeds supported operations. | | `6055` | `InvalidZapOutParameters` | Invalid zap out parameters | Zap protocol fee route parameters are invalid. | | `6056` | `IncorrectATA` | Incorrect ATA | Token account is not the expected associated token account. | | `6057` | `InvalidWithdrawProtocolFeeZapAccounts` | Invalid withdraw protocol fee zap accounts | Zap protocol fee account set is malformed. | | `6058` | `MintRestrictedFromZap` | SOL,USDC protocol fee cannot be withdrawn via zap | Zap protocol fee attempted for a restricted mint. | | `6059` | `CpiDisabled` | CPI disabled | Instruction rejects CPI invocation. | | `6060` | `MissingZapOutInstruction` | Missing zap out instruction | Zap route instruction was not found in the transaction sysvar. | | `6061` | `InvalidZapAccounts` | Invalid zap accounts | Zap route source/destination or account validation failed. | # DAMM v1 Program Events Source: https://docs.meteora.ag/developer-guides/damm-v1/program/events Understand DAMM v1 dynamic AMM events emitted by pool creation, swaps, liquidity, locks, configs, fees, activation, and admin flows. DAMM v1 events are emitted as Anchor log events through `emit!`. Use this page when building indexers, trading terminals, analytics pipelines, or dashboards that need to classify DAMM v1 transactions. <Note> DAMM v1 does not use the event-CPI pattern used by newer Meteora programs. Parse Anchor logs from the DAMM v1 program ID instead of expecting an `__event_authority` account. </Note> ## Event Delivery | Item | Value | | - | - | | Program ID | `Eo7WjKq67rjJQSZxS6z3YkapzY3eMj6Xy8X5EQVn5UaB` | | Delivery | Anchor `emit!` log events | | Source files | `programs/amm/src/event.rs` and instruction handlers that call `emit!` | | SDK compatibility | The bundled SDK IDL also includes events used by older client snapshots, including `MoveLockedLp`. | ## Pool Events | Event | Emitted by | Payload | | - | - | - | | `PoolCreated` | `initialize_permissioned_pool`, `initialize_permissionless_pool`, `initialize_permissionless_pool_with_fee_tier`, config/customizable initialization paths through the shared initializer | LP mint, token A mint, token B mint, pool type, and pool address. | | `PoolEnabled` | `enable_or_disable_pool` | Pool address and enabled flag. | | `PoolInfo` | `get_pool_info` | Token A amount, token B amount, virtual price, and current timestamp. | | `BootstrapLiquidity` | `bootstrap_liquidity` | LP amount minted, token A amount, token B amount, and pool address. | `PoolCreated` is the main pool-discovery event. Indexers should still read the current pool account and Dynamic Vault accounts because pool fees, activation state, lock totals, partner fees, and vault balances can change after creation. ## Liquidity Events | Event | Emitted by | Payload | | - | - | - | | `AddLiquidity` | `add_balance_liquidity`, `add_imbalance_liquidity` | LP amount minted, token A amount deposited, and token B amount deposited. | | `RemoveLiquidity` | `remove_balance_liquidity`, `remove_liquidity_single_side` | LP amount burned, token A amount withdrawn, and token B amount withdrawn. | For single-sided stable withdrawals, one output side can be zero. For balanced withdrawals, both output sides are populated. ## Swap Events | Event | Emitted by | Payload | | - | - | - | | `Swap` | `swap` | Input amount, output amount, LP trade fee, protocol fee, and host fee. | `Swap` does not include token mint fields. To determine direction, indexers must inspect the transaction accounts or reconcile against pool state and token transfers. | Field | Meaning | | - | - | | `in_amount` | Source token amount sent into the swap path. | | `out_amount` | Destination token amount sent to the user. | | `trade_fee` | LP fee component after protocol fee is separated. | | `protocol_fee` | Protocol fee component. | | `host_fee` | Referral host fee component when a host account is supplied. | ## Config And Fee Events | Event | Emitted by | Payload | | - | - | - | | `CreateConfig` | `create_config` | Trade fee numerator, protocol trade fee numerator, and config address. | | `CloseConfig` | `close_config` | Config address. | | `SetPoolFees` | `set_pool_fees` | New trade fee numerator/denominator, new protocol fee numerator/denominator, and pool address. | | `OverrideCurveParam` | `override_curve_param` | New stable amp value, update timestamp, and pool address. | | `WithdrawProtocolFees` | `withdraw_protocol_fees` | Pool address, protocol token A/B amounts withdrawn, and protocol fee token account owners. | | `PartnerClaimFees` | `partner_claim_fee` | Pool address, token A/B fee amounts, and partner authority. | Fee numerators use `FEE_DENOMINATOR = 100_000`. Do not interpret event fee numerators directly as basis points without conversion. ## Lock Events | Event | Emitted by | Payload | | - | - | - | | `CreateLockEscrow` | `create_lock_escrow` | Pool address and escrow owner. | | `Lock` | `lock` | Pool address, escrow owner, and LP amount locked. | | `ClaimFee` | `claim_fee` | Pool address, escrow owner, LP amount claimed as fee, token A fee amount, and token B fee amount. | | `MoveLockedLp` | `move_locked_lp` in the SDK IDL/program crate | Pool address, source lock escrow, destination lock escrow, and moved LP amount. | The current `meteora-dynamic-amm/programs/amm` source snapshot emits the first three lock events. The public SDK IDL includes `MoveLockedLp` for SDK compatibility. ## Legacy Event Types | Event | Notes | | - | - | | `TransferAdmin` | Present in the event type definitions for older permissioned-pool admin flows. It is not emitted by the current source paths inspected for this guide. | | `MigrateFeeAccount` | Present in the event type definitions for older fee-account migration flows. It is not emitted by the current source paths inspected for this guide. | ## Indexing Notes | Task | Recommendation | | - | - | | Pool discovery | Use `PoolCreated`, then fetch the pool, config if present, LP mint, and Dynamic Vault state. | | Swap analytics | Combine `Swap` logs with account ordering and SPL token transfers to infer token direction and mint identity. | | LP accounting | Use `AddLiquidity` and `RemoveLiquidity` events for activity, but compute current LP value from pool and vault state. | | Lock dashboards | Use lock events for activity and read `LockEscrow` for current claimable fee state. | | Fee dashboards | Track `SetPoolFees`, `CreateConfig`, `PartnerClaimFees`, and `WithdrawProtocolFees`, then reconcile against protocol fee token accounts. | | Source compatibility | Treat event type presence and actual emission separately. Some IDL events exist for older flows that are not emitted by the current source handlers. | # DAMM v1 Program Instructions Source: https://docs.meteora.ag/developer-guides/damm-v1/program/instructions Explore all DAMM v1 amm instructions for pool creation, swaps, liquidity, locks, configs, fees, activation, operators, and admin flows. The `amm` IDL exposes many instructions. Integrators can choose to either use the TypeScript SDK for transaction construction or build through CPI. ## Pool Creation | Instruction | Use | | - | - | | `initialize_permissioned_pool` | Creates a permissioned pool from an arbitrary signer pool account. | | `initialize_permissionless_pool` | Creates a permissionless pool with the curve's default fee. | | `initialize_permissionless_pool_with_fee_tier` | Creates a permissionless pool with an allowed trade fee tier. | | `initialize_permissionless_constant_product_pool_with_config` | Creates a config-based constant-product pool with the config's default activation point. | | `initialize_permissionless_constant_product_pool_with_config2` | Creates a config-based constant-product pool with an optional activation point override. | | `initialize_customizable_permissionless_constant_product_pool` | Creates a customizable constant-product launch pool without a config PDA. | | `create_mint_metadata` | Creates missing Metaplex LP mint metadata for older pools. | Pool initialization creates or initializes the pool, LP mint, pool-owned Dynamic Vault LP token accounts, protocol fee token accounts, initial liquidity, and LP mint metadata. The two Dynamic Vault accounts and their token vaults must exist or be created as part of the setup flow. ## Pool PDA Variants | Pool type | Address behavior | | - | - | | Permissioned | Pool address is an arbitrary signer account. | | Permissionless default fee | PDA from curve type byte and sorted token mints. | | Permissionless fee tier | PDA from curve type byte, sorted token mints, and optional fee-bps seed. The default fee tier omits the fee seed. | | Config-based constant product | PDA from sorted token mints and config key. | | Customizable constant product | PDA from `pool` and sorted token mints. | Use the SDK or Rust helper derivations instead of rebuilding seeds manually. ## Swaps | Instruction | Use | | - | - | | `swap` | Swaps token A to B or token B to A with exact input and minimum output protection. | `swap` validates pool enablement and launch activation, updates depeg virtual price when required, deposits input through one Dynamic Vault
프로젝트로 돌아가기