Meteora 백서

Meteora

원문

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

urve completion. | | `6048` | `NextSqrtPriceIsSmallerThanStartSqrtPrice` | Next sqrt price is smaller than start sqrt price | Swap movement would cross below the curve start. | | `6049` | `InvalidMinBaseFee` | Invalid min base fee | Minimum base fee is below the program requirement. | | `6050` | `AccountInvariantViolation` | Account invariant violation | CPI account owner, lamports, or data length changed unexpectedly. | | `6051` | `InvalidPoolCreationFee` | Invalid pool creation fee | Pool creation fee is outside allowed bounds. | | `6052` | `PoolCreationFeeHasBeenClaimed` | Pool creation fee has been claimed | Pool creation fee was already claimed. | | `6053` | `Unauthorized` | Not permit to do this action | Signer lacks the required authority. | | `6054` | `ZeroPoolCreationFee` | Pool creation fee is zero | Attempted to claim a zero pool creation fee. | | `6055` | `InvalidMigrationLockedLiquidity` | Invalid migration locked liquidity | Liquidity distribution does not satisfy locked-liquidity requirements. | | `6056` | `InvalidFeeMarketCapScheduler` | Invalid fee market cap scheduler | DAMM v2 market-cap fee scheduler params are invalid. | | `6057` | `FirstSwapValidationFailed` | Fail to validate first swap with minimum fee | First-swap-with-min-fee transaction context failed validation. | | `6058` | `IncorrectATA` | Incorrect ATA | Associated token account does not match expected owner or mint. | | `6059` | `InsufficientPoolLamports` | Pool has insufficient lamports to perform the operation | Pool account cannot pay required lamports for the operation. | | `6060` | `InvalidPermission` | Invalid permission | Operator permission bits are invalid. | | `6061` | `InvalidWithdrawProtocolFeeZapAccounts` | Invalid withdraw protocol fee zap accounts | Protocol zap account list is malformed. | | `6062` | `MintRestrictedFromZap` | SOL,USDC protocol fee cannot be withdrawn via zap | Restricted mint was used with zap. | | `6063` | `InvalidZapOutParameters` | Invalid zap out parameters | Zap output parameters are invalid. | | `6064` | `CpiDisabled` | CPI disabled | Protocol zap CPI is disabled by the downstream zap program. | | `6065` | `MissingZapOutInstruction` | Missing zap out instruction | Required zap instruction was not found. | | `6066` | `InvalidZapAccounts` | Invalid zap accounts | Zap accounts do not match the expected route. | | `6067` | `InvalidCompoundingParameters` | Invalid compounding parameters | DAMM v2 compounding fee settings are invalid. | | `6068` | `InvalidClaimProtocolFeeAccounts` | Invalid claim protocol fee accounts | Protocol fee claim account list does not match the selected mint, pool, receiver, or pool type. | | `6069` | `InvalidInstructionsSysvar` | Invalid instructions sysvar account | Instructions sysvar account is missing or not the canonical sysvar account. | | `6070` | `InvalidRemainingAccountsLength` | Invalid remaining accounts length | Transfer-hook remaining account slices require more accounts than were provided. | | `6071` | `MissingRemainingAccountForTransferHook` | Missing remaining account for transfer hook | A base mint has a transfer hook, but required extra accounts were not supplied. | | `6072` | `NoTransferHookProgram` | No transfer hook program | Transfer-hook accounts were supplied for a mint without an active transfer-hook program. | | `6073` | `DuplicatedRemainingAccountTypes` | Duplicated remaining account types | `TransferHookAccountsInfo` contains duplicate slice types. | | `6074` | `InvalidTransferHookProgram` | Invalid transfer hook program | Transfer-hook program is missing, non-executable, default, or one of the disallowed program IDs. | | `6075` | `InvalidPoolAccount` | Invalid pool account | Pool account owner, discriminator, or expected account variant is invalid. | | `6076` | `PoolTypeMismatch` | Pool type does not match instruction | A standard pool was sent to a transfer-hook-only instruction, or a transfer-hook pool was sent to a standard-only instruction. | | `6077` | `InvalidRemainingAccountSliceType` | Invalid remaining account slice type for this instruction | Transfer-hook remaining account metadata includes a slice type that the instruction does not accept. | | `6078` | `DeprecatedBaseFeeMode` | Deprecated base fee mode | New config or pool creation used `BaseFeeMode::RateLimiter`. | | `6079` | `CannotCreateTokenBadgeOnSupportedMint` | Cannot create token badge on supported mint | A token badge was requested for a quote mint that is already permissionless-supported. | | `6080` | `InvalidTokenBadge` | Invalid token badge | Token badge account is missing, closed, or does not match the quote mint. | | `6081` | `QuoteMintHasNonZeroTransferFee` | Quote mint has a non zero transfer fee | Current or scheduled quote-mint transfer fee is not zero. | | `6082` | `DeprecatedMigrationOption` | Deprecated migration option | New config or pool creation used `MigrationOption::MeteoraDamm`. | <Note> Program `0.2.1` and SDK `1.5.12` include errors through `6082`. If you decode from an older bundled IDL, handle unknown custom errors defensively or regenerate the IDL from the matching program source. </Note> ## TypeScript SDK Validation Helpers The TypeScript SDK performs many checks before building transactions. These helpers return booleans or throw SDK-side errors before the program returns a custom error. | Helper | Related program errors | | - | - | | `validateConfigParameters` | `InvalidFee`, `InvalidCollectFeeMode`, `InvalidMigrationOption`, `DeprecatedMigrationOption`, `DeprecatedBaseFeeMode`, `InvalidTokenDecimals`, `InvalidCurve`, `InvalidPoolCreationFee`. | | `validateFeeScheduler` | `InvalidFeeScheduler`, `InvalidMinBaseFee`, `ExceedMaxFeeBps`. | | `validateFeeRateLimiter` | `InvalidFeeRateLimiter`, `RateLimiterNotSupported`, `DeprecatedBaseFeeMode`. | | `validateDynamicFee` | `InvalidInput`, `MathOverflow`. | | `validateMigrationFeeOption` | `InvalidMigrationFeeOption`, `InvalidMigratedPoolFee`. | | `validateMigratedPoolFee` | `InvalidMigratedPoolFee`, `InvalidFeeMarketCapScheduler`, `InvalidCompoundingParameters`. | | `validateTransferHookProgram`, `validateTransferHookProgramExecutable` | `InvalidTransferHookProgram`. | | `validateLiquidityVestingInfo` | `InvalidVestingParameters`, `InvalidMigrationLockedLiquidity`. | | `validateTokenSupply` | `InvalidTokenSupply`, `InvalidLeftoverAddress`, `TotalBaseTokenExceedMaxSupply`. | | `validateBaseTokenType` | `InvalidTokenType`, `UnsupportNativeMintToken2022`. | | `validateSwapAmount` | `AmountIsZero`. | # DBC Program Events Source: https://docs.meteora.ag/developer-guides/dbc/program/events Understand DBC dynamic_bonding_curve events emitted by config, transfer-hook, pool, swap, fee claim, migration, metadata, and operator flows. The `dynamic-bonding-curve` program emits most 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 DBC pool activity. ## Event CPI | Item | Value | | - | - | | Event authority seed | `__event_authority` | | SDK helper | `deriveDbcEventAuthority()` | | Primary standard swap event | `EvtSwap2` | | Primary transfer-hook swap event | `EvtSwap2WithTransferHook` | | Deprecated compatibility event | `EvtCreateConfig` is deprecated; prefer `EvtCreateConfigV2`. | | Log-event exception | `EvtClaimProtocolFee2` is emitted with `emit!`, not event CPI. | ## Config And Metadata Events | Event | Emitted by | Important fields | Use | | - | - | - | - | | `EvtCreateConfig` | `create_config` | `config`, `quote_mint`, `fee_claimer`, fee and curve fields | Deprecated config payload kept for compatibility. | | `EvtCreateConfigV2` | `create_config` | `config`, `quote_mint`, `fee_claimer`, `leftover_receiver`, `config_parameters` | Preferred config creation payload. | | `EvtCreateConfigV2WithTransferHook` | `create_config_with_transfer_hook` | `config`, `quote_mint`, `fee_claimer`, `leftover_receiver`, `config_parameters`, `transfer_hook_program` | Index transfer-hook configs. | | `EvtPartnerMetadata` | `create_partner_metadata` | `partner_metadata`, `fee_claimer` | Link partner metadata to a fee claimer. | | `EvtVirtualPoolMetadata` | `create_virtual_pool_metadata` | `virtual_pool_metadata`, `virtual_pool` | Link pool metadata to a virtual pool. | | `EvtInitializePool` | `initialize_virtual_pool_with_spl_token`, `initialize_virtual_pool_with_token2022` | `pool`, `config`, `creator`, `base_mint`, `pool_type`, `activation_point` | Index new DBC pools. | | `EvtInitializePoolWithTransferHook` | `initialize_virtual_pool_with_token2022_transfer_hook` | `pool`, `config`, `creator`, `base_mint`, `pool_type`, `activation_point` | Index new transfer-hook DBC pools. | | `EvtUpdatePoolCreator` | `transfer_pool_creator` | `pool`, `creator`, `new_creator` | Track creator authority transfer. | | `EvtCreateTokenBadge` | `create_token_badge` | `token_mint` | Index a newly allowlisted quote mint. | | `EvtCloseTokenBadge` | `close_token_badge` | `token_mint` | Index token badge closure. | ## Swap Events | Event | Emitted by | Important fields | Use | | - | - | - | - | | `EvtSwap` | `swap`, `swap2` | `pool`, `config`, `trade_direction`, `has_referral`, `params`, `swap_result`, `amount_in`, `current_timestamp` | Legacy/simple swap payload. | | `EvtSwap2` | `swap`, `swap2` | `pool`, `config`, `trade_direction`, `has_referral`, `swap_parameters`, `swap_result`, `quote_reserve_amount`, `migration_threshold`, `current_timestamp` | Preferred swap payload for charting, progress, fees, and exact-out or partial-fill support. | | `EvtCurveComplete` | `swap`, `swap2` when the threshold is reached | `pool`, `config`, `base_reserve`, `quote_reserve` | Mark bonding curve completion and migration readiness. | | `EvtSwap2WithTransferHook` | `swap2_with_transfer_hook` | `pool`, `config`, `trade_direction`, `has_referral`, `swap_parameters`, `swap_result`, `quote_reserve_amount`, `migration_threshold`, `current_timestamp` | Preferred transfer-hook swap payload. | | `EvtCurveCompleteWithTransferHook` | `swap2_with_transfer_hook` when the threshold is reached | `pool`, `config`, `base_reserve`, `quote_reserve` | Mark transfer-hook bonding curve completion and hook revocation. | ### EvtSwap2 Payload | Field | Meaning | | - | - | | `trade_direction` | `0` base to quote, `1` quote to base. | | `has_referral` | Whether referral fee was included in the fee split. | | `swap_parameters.amount_0` | Input for exact-in and partial-fill, or requested output for exact-out. | | `swap_parameters.amount_1` | Minimum output for exact-in and partial-fill, or maximum input for exact-out. | | `swap_parameters.swap_mode` | `0` exact in, `1` partial fill, `2` exact out. | | `swap_result.included_fee_input_amount` | Input amount before excluded-fee adjustment. | | `swap_result.excluded_fee_input_amount` | Amount that moved the curve after fee handling. | | `swap_result.amount_left` | Unused amount in partial-fill mode. | | `swap_result.output_amount` | Output token amount. | | `swap_result.next_sqrt_price` | Post-swap sqrt price. | | `swap_result.trading_fee`, `protocol_fee`, `referral_fee` | Fee split for the swap. | | `quote_reserve_amount` | Quote reserve after the swap. Use this for progress charts. | | `migration_threshold` | Configured quote threshold for migration readiness. | <Warning> Do not reconstruct DBC price from token transfer logs. Use `EvtSwap2`, quote helpers, and account state so fee-adjusted amounts, partial fills, and `next_sqrt_price` are handled correctly. </Warning> ## Fee And Claim Events | Event | Emitted by | Important fields | Use | | - | - | - | - | | `EvtClaimTradingFee` | `claim_trading_fee`, `claim_trading_fee2` | `pool`, `token_base_amount`, `token_quote_amount` | Partner trading fee claim. | | `EvtClaimCreatorTradingFee` | `claim_creator_trading_fee`, `claim_creator_trading_fee2` | `pool`, `token_base_amount`, `token_quote_amount` | Creator trading fee claim. | | `EvtClaimProtocolFee` | Removed `claim_protocol_fee` | `pool`, `token_base_amount`, `token_quote_amount` | Historical protocol trading fee claim. New claims use `EvtClaimProtocolFee2`. | | `EvtClaimProtocolFee2` | `claim_protocol_fee2` | `pool`, `receiver_token_account`, `token_mint`, `amount` | Protocol fee claim through the newer single-mint claim path. | | `EvtClaimPoolCreationFee` | `claim_protocol_pool_creation_fee` | `pool`, `receiver`, `creation_fee` | Protocol share of pool creation fee. | | `EvtPartnerClaimPoolCreationFee` | `claim_partner_pool_creation_fee` | `pool`, `partner`, `creation_fee`, `fee_receiver` | Partner share of pool creation fee. | ## Migration And Withdrawal Events | Event | Emitted by | Important fields | Use | | - | - | - | - | | `EvtCreateMeteoraMigrationMetadata` | `migration_meteora_damm_create_metadata` | `virtual_pool` | DAMM v1 migration metadata creation. | | `EvtPartnerWithdrawSurplus` | `partner_withdraw_surplus` | `pool`, `surplus_amount` | Partner surplus withdrawal. | | `EvtCreatorWithdrawSurplus` | `creator_withdraw_surplus` | `pool`, `surplus_amount` | Creator surplus withdrawal. | | `EvtWithdrawLeftover` | `withdraw_leftover` | `pool`, `leftover_receiver`, `leftover_amount` | Leftover base-token withdrawal. | | `EvtWithdrawMigrationFee` | `withdraw_migration_fee` | `pool`, `fee`, `flag` | Migration fee withdrawal with role flag. | ## Operator Events | Event | Emitted by | Important fields | Use | | - | - | - | - | | `EvtCloseClaimFeeOperator` | `close_claim_protocol_fee_operator` | `claim_fee_operator`, `operator` | Track protocol fee operator closure. | ## Indexing Notes 1. Treat `EvtSwap2.quote_reserve_amount / EvtSwap2.migration_threshold` as the event-side progress signal. 2. Reconcile event-derived progress with `VirtualPool.quote_reserve` from account state. 3. Index both `EvtInitializePool` and `EvtInitializePoolWithTransferHook`, plus pool accounts, so pools created before your indexer starts are still discoverable. 4. Store raw `swap_result` values for analytics; rounded UI values can lose fee and partial-fill detail. 5. For migrated pools, use DBC events to identify completion and destination AMM state to track post-migration trading. # DBC Program Instructions Source: https://docs.meteora.ag/developer-guides/dbc/program/instructions Explore DBC dynamic_bonding_curve instructions for partners, creators, transfer-hook pools, swaps, migration, fee claims, operators, and state transitions. The `dynamic-bonding-curve` IDL exposes many instructions. Integrators can choose to either use the TypeScript SDK for transaction construction or build through CPI. ## Partner Instructions | Instruction | Args | SDK path | Purpose | | - | - | - | - | | `create_config` | `ConfigParameters` | `client.partner.createConfig` | Create a partner config for fees, curve, token behavior, DAMM v2 migration, pool creation fee, and graduated-pool settings. Rejects `BaseFeeMode::RateLimiter` and `MigrationOption::MeteoraDamm`. Pass a token badge at remaining account index `0` when the quote mint is not permissionless-supported. | | `create_config_with_transfer_hook` | `ConfigParameters` | `client.partner.createConfigWithTransferHook` | Create a Token 2022 transfer-hook config with an executable transfer-hook program. Uses the same token-badge remaining account and deprecation rules as `create_config`. | | `create_partner_metadata` | `CreatePartnerMetadataParameters` | `client.partner.createPartnerMetadata` | Create optional metadata for the partner fee claimer. | | `claim_trading_fee` | `max_amount_a`, `max_amount_b` | `client.partner.claimPartnerTradingFee`, `claimPartnerTradingFeeToReceiver` | Claim partner trading fees from a standard virtual pool. | | `claim_trading_fee2` | `max_amount_a`, `max_amount_b`, `TransferHookAccountsInfo` | `client.partner.claimPartnerTradingFee2` | Claim partner trading fees from a transfer-hook pool. | | `claim_partner_pool_creation_fee` | None | `client.partner.claimPartnerPoolCreationFee` | Claim the partner share of pool creation fees. | | `partner_withdraw_surplus` | None | `client.partner.partnerWithdrawSurplus` | Withdraw partner quote surplus after migration when allowed. | ## Creator And Pool Instructions | Instruction | Args | SDK path | Purpose | | - | - | - | - | | `initialize_virtual_pool_with_spl_token` | `InitializePoolParameters` | `client.creator.createPool` | Create a DBC pool with an SPL Token base mint and Metaplex metadata. Rejects rate-limiter and DAMM v1 configs. Pass a token badge at remaining account index `0` when the quote mint is not permissionless-supported. | | `initialize_virtual_pool_with_token2022` | `InitializePoolParameters` | `client.creator.createPool` | Create a DBC pool with a Token 2022 base mint. Rejects rate-limiter configs and uses the same token-badge remaining account rule. | | `initialize_virtual_pool_with_token2022_transfer_hook` | `InitializePoolParameters` | `client.creator.createPoolWithTransferHook` | Create a DBC transfer-hook pool with a Token 2022 base mint. Uses the same token-badge remaining account rule. | | `create_virtual_pool_metadata` | `CreateVirtualPoolMetadataParameters` | `client.creator.createPoolMetadata` | Create optional metadata for a virtual pool. | | `claim_creator_trading_fee` | `max_base_amount`, `max_quote_amount` | `client.creator.claimCreatorTradingFee`, `claimCreatorTradingFeeToReceiver` | Claim creator trading fees from a standard virtual pool. | | `claim_creator_trading_fee2` | `max_base_amount`, `max_quote_amount`, `TransferHookAccountsInfo` | `client.creator.claimCreatorTradingFee2` | Claim creator trading fees from a transfer-hook pool. | | `creator_withdraw_surplus` | None | `client.creator.creatorWithdrawSurplus` | Withdraw creator surplus after migration when allowed. | | `transfer_pool_creator` | None | `client.creator.transferPoolCreator` | Transfer creator rights and creator fee claim authority to a new address. | ## Swap Instructions | Instruction | Args | Modes | Notes | | - | - | - | - | | `swap` | `SwapParameters` | Exact in | Legacy exact-in swap path for standard pools. It emits both `EvtSwap` and `EvtSwap2`. | | `swap2` | `SwapParameters2` | Exact in, partial fill, exact out | Preferred for standard-pool trading integrations because the args map directly to `SwapMode`. | | `swap2_with_transfer_hook` | `SwapParameters2`, `TransferHookAccountsInfo` | Exact in, partial fill, exact out | Transfer-hook pool swap path. SDK: `client.pool.swap2WithTransferHook`. | `SwapParameters2` uses these fields: | Field | Meaning | | - | - | | `amount_0` | Input amount for exact-in and partial-fill, or requested output amount for exact-out. | | `amount_1` | Minimum output for exact-in and partial-fill, or maximum input for exact-out. | | `swap_mode` | `0` exact in, `1` partial fill, `2` exact out. | <Note> Existing rate-limiter pools, or configs with `enable_first_swap_with_min_fee` enabled, require the instructions sysvar in remaining accounts on swap instructions. The SDK adds `SYSVAR_INSTRUCTIONS_PUBKEY` when needed. </Note> ## Token Badge Remaining Accounts Config and pool creation read `token_badge` from remaining account index `0` when the quote mint is not permissionless-supported. | Instruction | Remaining account index `0` | | - | - | | `create_config` | Required token badge PDA when the quote mint is not permissionless-supported. | | `create_config_with_transfer_hook` | Same rule. | | `initialize_virtual_pool_with_spl_token` | Same rule. | | `initialize_virtual_pool_with_token2022` | Same rule. | | `initialize_virtual_pool_with_token2022_transfer_hook` | Same rule. | The token badge PDA is derived from `["token_badge", quote_mint]`. It is read-only and not a signer. Permissionless-supported quote mints do not need this account. A missing or mismatched badge returns `InvalidTokenBadge`. A badge does not bypass the zero transfer-fee rule. Transfer-hook swaps also pass extra remainin
프로젝트로 돌아가기