bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 34쪽
pt SDK | `cd packages/dynamic-bonding-curve && pnpm install && pnpm run build` |
| Run TypeScript SDK tests | `cd packages/dynamic-bonding-curve && pnpm test` |
| Run TypeScript type checks | `cd packages/dynamic-bonding-curve && pnpm run check-types` |
| Run Rust quote tests | `cd dynamic-bonding-curve && cargo test -p dynamic-bonding-curve-sdk` |
| Run Go examples | `go run examples/<file-name>.go` |
| Run program tests | `anchor test` from the `dynamic-bonding-curve` repository |
<Note>
Some SDK tests depend on local validator fixtures and deployed program artifacts. For production integrations, simulate transactions and test on devnet before sending mainnet transactions.
</Note>
## Stay Updated
<CardGroup>
<Card title="DBC Changelog" icon="newspaper" href="/developer-guides/dbc/changelog">
Program, IDL, SDK, quote, migration, and validation changes for integration planning.
</Card>
</CardGroup>
# DBC Program Accounts
Source: https://docs.meteora.ag/developer-guides/dbc/program/accounts
Understand DBC dynamic_bonding_curve accounts, including configs, transfer-hook configs, virtual pools, metadata, operators, migration state, constants, and PDA seeds.
<Note>
This page summarizes the `dynamic-bonding-curve` account model. For exact layouts, use the published IDL and generated TypeScript types exported by `@meteora-ag/dynamic-bonding-curve-sdk`.
</Note>
## Address Map
| Address | How it is chosen | Use |
| - | - | - |
| `PoolConfig` | New signer account passed to `create_config` | Partner config for quote mint, fee claimer, leftover receiver, fees, curve, token behavior, migration settings, and graduated-pool settings. |
| `ConfigWithTransferHook` | New signer account passed to `create_config_with_transfer_hook` | Transfer-hook config. It stores an embedded `PoolConfig` plus the executable transfer-hook program. |
| `VirtualPool` | PDA from quote mint, base mint, and config | Standard active DBC pool for one base mint and config. Stores `pool_state`. |
| `TransferHookPool` | Same pool PDA derivation, initialized by `initialize_virtual_pool_with_token2022_transfer_hook` | Transfer-hook active DBC pool. Stores the same `pool_state` layout as `VirtualPool`, with a separate discriminator. |
| Base vault | PDA token account from pool and base mint | Program-controlled token account for launched base tokens. |
| Quote vault | PDA token account from pool and quote mint | Program-controlled token account for quote tokens. |
| Pool authority | PDA from `pool_authority` | Program authority over vaults and migration flows. The deployed address is `FhVo3mqL8PW5pH5U2CN4XE33DokiyZnUwuGpH2hmHLuM`. |
| Protocol fee authority | PDA from `protocol_fee_authority` under the protocol fee program | Fixed signer expected by `claim_protocol_fee2`, usually through the protocol fee wrapper program. |
| Event authority | PDA from `__event_authority` | Anchor event-CPI authority required by event-emitting instructions. |
| Partner metadata | PDA from `partner_metadata` and fee claimer | Optional public metadata for a partner. |
| Virtual pool metadata | PDA from `virtual_pool_metadata` and pool | Optional public metadata for a pool. |
| DAMM v1 migration metadata | PDA from `meteora` and pool | Metadata used by DAMM v1 migration and LP lock/claim flows. |
| DAMM v2 migration metadata | PDA from `damm_v2` and pool | Deprecated in the program; DAMM v2 migration no longer requires a separate metadata setup step. |
| Token badge | PDA from `token_badge` and quote mint | Operator-created allowlist for a Token 2022 quote mint that is not permissionless-supported. |
| Operator | PDA from `operator` | Admin-created permission account for protocol pool creation fee claims and token badge management. |
| Claim fee operator | PDA from `cf_operator` | Legacy protocol fee claim authorization account. |
## Constants
| Constant | Value | Meaning |
| - | - | - |
| `MAX_CURVE_POINT` | `16` | Maximum curve points accepted by public curve builders. |
| `MAX_CURVE_POINT_CONFIG` | `20` | Fixed on-chain `PoolConfig.curve` capacity. |
| `FEE_DENOMINATOR` | `1_000_000_000` | Fee numerator denominator used by DBC fee math. |
| `MIN_FEE_BPS` | `25` | Minimum pre-graduation base fee, equal to 0.25%. |
| `MAX_FEE_BPS` | `9900` | Maximum pre-graduation total fee, equal to 99%. |
| `PROTOCOL_FEE_PERCENT` | `20` | Protocol share of trading fees before optional referral split. |
| `HOST_FEE_PERCENT` | `20` | Referral share of the protocol fee when a referral account is present. |
| `PROTOCOL_POOL_CREATION_FEE_PERCENT` | `10` | Protocol share of pool creation fees. The remainder is claimable by the partner. |
| `MIN_POOL_CREATION_FEE` | `1_000_000` lamports | Minimum non-zero pool creation fee. |
| `MAX_POOL_CREATION_FEE` | `100_000_000_000` lamports | Maximum pool creation fee. |
| `MIN_LOCKED_LIQUIDITY_BPS` | `1000` | Minimum locked-liquidity requirement, equal to 10%. |
| `MAX_LOCK_DURATION_IN_SECONDS` | `63_072_000` | Maximum lock duration for migrated DAMM v2 liquidity, equal to two years. |
## Enums
| Enum | Values |
| - | - |
| `ActivationType` | `0` slot, `1` timestamp. |
| `TokenType` / `PoolType` | `0` SPL Token, `1` Token-2022. |
| `CollectFeeMode` | `0` quote token, `1` output token. |
| `MigrationOption` | `0` DAMM v1 (deprecated for new configs and new pools), `1` DAMM v2. |
| `MigrationFeeOption` | `0` 25 bps, `1` 30 bps, `2` 100 bps, `3` 200 bps, `4` 400 bps, `5` 600 bps, `6` customizable. |
| `BaseFeeMode` | `0` linear scheduler, `1` exponential scheduler, `2` rate limiter (deprecated for new configs and new pools). |
| `MigrationProgress` | `0` pre-bonding curve, `1` post-bonding curve, `2` locked vesting, `3` created pool. |
| `TokenAuthorityOption` | `0` creator update authority, `1` immutable, `2` partner update authority, `3` creator update and mint authority, `4` partner update and mint authority. |
| `OperatorPermission` | `0` claim protocol fee, `1` zap protocol fee (deprecated bit kept for ordering), `2` create token badge, `3` close token badge. |
## PoolConfig
`PoolConfig` is the partner-created account that defines all pools launched with a config.
`ConfigWithTransferHook` embeds the same `PoolConfig` as `config` and appends `transfer_hook_program`. The SDK's `StateService.getPoolConfig` returns the embedded `PoolConfig` for both account variants.
| Field | Use |
| - | - |
| `quote_mint` | Quote mint for every pool using the config. |
| `fee_claimer` | Partner authority allowed to claim partner fees and partner pool creation fees. |
| `leftover_receiver` | Receiver for leftover base tokens after migration for fixed-supply launches. |
| `pool_fees` | `BaseFeeConfig` and optional `DynamicFeeConfig` used before migration. |
| `partner_liquidity_vesting_info`, `creator_liquidity_vesting_info` | DAMM v2 migrated-liquidity vesting settings. |
| `collect_fee_mode` | Whether DBC pre-migration fees are collected in quote token or output token. |
| `migration_option` | Destination AMM. New configs must use DAMM v2. Existing DAMM v1 pools can still migrate. |
| `activation_type` | Whether fee schedules and activation checks use slot or timestamp. |
| `token_decimal`, `token_type`, `quote_token_flag` | Base token decimals, base token program, and quote token classification. |
| `partner_*_liquidity_percentage`, `creator_*_liquidity_percentage` | Permanent locked and claimable liquidity shares after migration. |
| `migration_fee_option`, `migration_fee_percentage`, `creator_migration_fee_percentage` | Graduated pool fee key and partner/creator migration fee split. |
| `fixed_token_supply_flag`, `pre_migration_token_supply`, `post_migration_token_supply` | Fixed-supply behavior and supply limits. |
| `creator_trading_fee_percentage` | Creator share of trading fees. |
| `token_update_authority` | Mint and metadata authority mode for pool creation. |
| `swap_base_amount`, `migration_quote_threshold`, `migration_base_threshold`, `migration_sqrt_price` | Amount and price thresholds computed from the curve configuration. |
| `locked_vesting_config` | Base token vesting schedule used by locker flows. |
| `migrated_collect_fee_mode`, `migrated_dynamic_fee`, `migrated_pool_fee_bps`, `migrated_compounding_fee_bps` | DAMM v2 graduated-pool fee behavior. |
| `migrated_pool_base_fee_mode`, `migrated_pool_base_fee_bytes` | DAMM v2 base-fee mode and serialized market-cap scheduler params. |
| `enable_first_swap_with_min_fee` | Enables the bundled creator first-swap validation path. |
| `pool_creation_fee` | Lamport fee charged on pool creation. |
| `sqrt_start_price`, `curve` | Q64.64 start price and fixed array of liquidity distribution points. |
## VirtualPool And TransferHookPool
`VirtualPool` and `TransferHookPool` are the accounts traders, indexers, and migration keepers read most often.
Both accounts store the active pool fields under `pool_state` in the IDL and `poolState` in the TypeScript SDK. Older integrations that read flat fields such as `pool.config`, `pool.baseMint`, or `pool.quoteReserve` must read `pool.poolState.config`, `pool.poolState.baseMint`, and `pool.poolState.quoteReserve`.
| Field | Use |
| - | - |
| `volatility_tracker` | Dynamic fee state: reference price, accumulator, and last update timestamp. |
| `config` | `PoolConfig` used by the pool. |
| `creator` | Pool creator. This authority can claim creator fees, withdraw creator surplus, and transfer creator rights. |
| `base_mint`, `base_vault`, `quote_vault` | Token identity and program-controlled vaults. |
| `base_reserve`, `quote_reserve` | Current reserves. `quote_reserve` is the main migration progress input. |
| `protocol_base_fee`, `protocol_quote_fee` | Accrued protocol trading fees. |
| `partner_base_fee`, `partner_quote_fee` | Accrued partner trading fees. |
| `creator_base_fee`, `creator_quote_fee` | Accrued creator trading fees. |
| `sqrt_price` | Current Q64.64 sqrt price. |
| `activation_point` | Slot or timestamp used for fee schedules and rate limiter windows. |
| `pool_type` | SPL Token or Token-2022 base mint. |
| `is_migrated` | Boolean-like migration completion flag. |
| `migration_progress` | State machine for bonding, vesting, and migrated pool creation. |
| `is_partner_withdraw_surplus`, `is_creator_withdraw_surplus`, `is_protocol_withdraw_surplus` | Surplus withdrawal flags. |
| `is_withdraw_leftover` | Leftover base-token withdrawal flag. |
| `migration_fee_withdraw_status` | Bit flags for partner and creator migration fee withdrawals. |
| `metrics` | Lifetime protocol and trading fee counters. |
| `finish_curve_timestamp` | Timestamp when the curve completed. |
| `creation_fee_bits` | Pool creation fee claim flags. |
| `has_swap` | Cached flag indicating whether the pool has had a swap. |
| `protocol_liquidity_migration_fee_bps` | Protocol liquidity migration fee bps. |
| `protocol_migration_base_fee_amount`, `protocol_migration_quote_fee_amount` | Protocol migration fee amounts. |
## Nested Types
| Type | Fields | Use |
| - | - | - |
| `PoolFeesConfig` | `base_fee`, `dynamic_fee` | Active pre-graduation fee configuration. |
| `BaseFeeConfig` | `cliff_fee_numerator`, `first_factor`, `second_factor`, `third_factor`, `base_fee_mode` | Linear or exponential scheduler parameters. Rate limiter parameters remain readable on existing pools. |
| `DynamicFeeConfig` | `initialized`, `max_volatility_accumulator`, `variable_fee_control`, `bin_step`, `filter_period`, `decay_period`, `reduction_factor`, `bin_step_u128` | Optional volatility-based fee configuration. |
| `LockedVestingConfig` | `amount_per_period`, `cliff_duration_from_migration_time`, `frequency`, `number_of_period`, `cliff_unlock_amount` | Base token vesting schedule after migration. |
| `LiquidityVestingInfo` | `vesting_percentage`, `bps_per_period`, `number_of_periods`, `frequency`, `cliff_duration_from_migration_time` | DAMM v2 migrated-liquidity vesting. |
| `LiquidityDistributionConfig` | `sqrt_price`, `liquidity` | One curve segment endpoint and liquidity value. |
| `PoolMetrics` | `total_protocol_base_fee`, `total_protocol_quote_fee`, `total_trading_base_fee`, `total_trading_quote_fee` | Lifetime fee counters. |
## Metadata And Operator Accounts
| Account | Fields | Use |
| - | - | - |
| `PartnerMetadata` | `fee_claimer`, `name`, `website`, `logo` | Optional partner profile keyed by fee claimer. |
| `VirtualPoolMetadata` | `virtual_pool`, `name`, `website`, `logo` | Optional pool profile keyed by pool. |
| `Operator` | `whitelisted_address`, `permission` | Admin-created operator permission bitmap for protocol pool creation fee claims and token badge management. |
| `TokenBadge` | `token_mint`, `128` bytes of padding | Operator-approved Token 2022 quote mint. PDA seeds are `token_badge` and the mint. Account size is `160` bytes plus the 8-byte discriminator. |
| `ClaimFeeOperator` | `operator` | Legacy protocol fee claim authorization account. |
| `MeteoraDammMigrationMetadata` | `virtual_pool`, `partner`, `lp_mint`, partner/creator locked and claimable liquidity, claim and lock statuses | DAMM v1 migration and LP claim state. |
| `LockEscrow` | `pool`, `owner`, `escrow_vault`, `total_locked_amount`, `lp_per_token`, fee fields | Locker escrow state used by locked vesting and DAMM v1 LP locks. |
# DBC Program Errors
Source: https://docs.meteora.ag/developer-guides/dbc/program/errors
Understand DBC dynamic_bonding_curve error codes, messages, SDK validation checks, transfer-hook errors, and common causes for integration debugging.
This page lists the Anchor custom errors returned by the `dynamic-bonding-curve` 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, `PoolError::MathOverflow` maps to code `6000`.
</Tip>
## Error Codes
| Code | Error | Message | Common cause |
| - | - | - | - |
| `6000` | `MathOverflow` | Math operation overflow | Amounts, prices, or liquidity values exceed supported integer bounds. |
| `6001` | `InvalidFee` | Invalid fee setup | Base fee, dynamic fee, or fee scheduler parameters are inconsistent. |
| `6002` | `ExceededSlippage` | Exceeded slippage tolerance | Swap output is below the minimum output, or exact-out input exceeds the maximum input. |
| `6003` | `ExceedMaxFeeBps` | Exceeded max fee bps | Fee numerator is above the program maximum. |
| `6004` | `InvalidAdmin` | Invalid admin | Signer is not an admin for an admin-only instruction. |
| `6005` | `AmountIsZero` | Amount is zero | Swap, claim, or migration amount is zero where a positive amount is required. |
| `6006` | `TypeCastFailed` | Type cast error | Integer conversion failed. |
| `6007` | `InvalidActivationType` | Invalid activation type | Activation type is not slot (`0`) or timestamp (`1`). |
| `6008` | `InvalidQuoteMint` | Invalid quote mint | Quote mint does not match the config or supported path. |
| `6009` | `InvalidCollectFeeMode` | Invalid collect fee mode | Collect fee mode is not quote token (`0`) or output token (`1`). |
| `6010` | `InvalidMigrationFeeOption` | Invalid migration fee option | Migration fee option is outside the supported range, or custom option is used with the wrong destination. |
| `6011` | `InvalidInput` | Invalid input | Generic parameter validation failure. |
| `6012` | `NotEnoughLiquidity` | Not enough liquidity | Swap or migration needs more liquidity than the curve can provide. |
| `6013` | `PoolIsCompleted` | Pool is completed | Attempted a pre-migration action after the curve completed. |
| `6014` | `PoolIsIncompleted` | Pool is incompleted | Attempted migration or post-completion action before the threshold was reached. |
| `6015` | `InvalidMigrationOption` | Invalid migration option | Migration option is not DAMM v1 (`0`) or DAMM v2 (`1`). New configs must use DAMM v2. |
| `6016` | `InvalidTokenDecimals` | Invalid token decimals | Token decimals are outside supported bounds. |
| `6017` | `InvalidTokenType` | Invalid token type | Token type is not SPL Token or Token-2022, or is incompatible with the migration. |
| `6018` | `InvalidFeePercentage` | Invalid fee percentage | Partner or creator migration fee split is outside allowed bounds. |
| `6019` | `InvalidQuoteThreshold` | Invalid quote threshold | Migration quote threshold is zero or invalid. |
| `6020` | `InvalidTokenSupply` | Invalid token supply | Pre-migration and post-migration supply values are inconsistent. |
| `6021` | `InvalidCurve` | Invalid curve | Curve points are empty, unsorted, out of price range, or have invalid liquidity. |
| `6022` | `NotPermitToDoThisAction` | Not permit to do this action | Signer is not the expected partner, creator, or authorized actor. |
| `6023` | `InvalidOwnerAccount` | Invalid owner account | Token account owner does not match expected authority. |
| `6024` | `InvalidConfigAccount` | Invalid config account | Config account does not match the pool or instruction. |
| `6025` | `SurplusHasBeenWithdraw` | Surplus has been withdraw | Surplus was already claimed. |
| `6026` | `LeftoverHasBeenWithdraw` | Leftover has been withdraw | Leftover tokens were already claimed. |
| `6027` | `TotalBaseTokenExceedMaxSupply` | Total base token is exceeded max supply | Config or pool creation would exceed allowed base supply. |
| `6028` | `UnsupportNativeMintToken2022` | Unsupport native mint token 2022 | Native mint was used with an unsupported Token-2022 path. |
| `6029` | `InsufficientLiquidityForMigration` | Insufficient liquidity for migration | Pool does not have enough liquidity to initialize the destination DAMM pool. |
| `6030` | `MissingPoolConfigInRemainingAccount` | Missing pool config in remaining account | Required config account was not supplied in remaining accounts. |
| `6031` | `InvalidVestingParameters` | Invalid vesting parameters | Vesting schedule is malformed or has invalid totals. |
| `6032` | `InvalidLeftoverAddress` | Invalid leftover address | Leftover receiver is missing or invalid when fixed supply requires it. |
| `6033` | `InsufficientLiquidity` | Liquidity in bonding curve is insufficient | Curve segment cannot support the requested price movement. |
| `6034` | `InvalidFeeScheduler` | Invalid fee scheduler | Scheduler periods, duration, or reduction factor are invalid. |
| `6035` | `InvalidCreatorTradingFeePercentage` | Invalid creator trading fee percentage | Creator trading fee share is outside allowed bounds. |
| `6036` | `InvalidNewCreator` | Invalid new creator | New creator address is invalid or equals the old creator. |
| `6037` | `InvalidTokenAuthorityOption` | Invalid token authority option | Token authority mode is outside supported values. |
| `6038` | `InvalidAccount` | Invalid account for the instruction | Account does not match expected PDA, mint, vault, or owner. |
| `6039` | `InvalidMigratorFeePercentage` | Invalid migrator fee percentage | Migrator fee setting is outside allowed range. |
| `6040` | `MigrationFeeHasBeenWithdraw` | Migration fee has been withdraw | Partner or creator migration fee was already withdrawn. |
| `6041` | `InvalidBaseFeeMode` | Invalid base fee mode | Base fee mode is not linear scheduler, exponential scheduler, or rate limiter. |
| `6042` | `InvalidFeeRateLimiter` | Invalid fee rate limiter | Rate limiter fields are missing or invalid. |
| `6043` | `FailToValidateSingleSwapInstruction` | Fail to validate single swap instruction in rate limiter | Instruction sysvar validation failed for a rate limiter swap. |
| `6044` | `InvalidMigratedPoolFee` | Invalid migrated pool fee params | DAMM v2 graduated-pool fee params are invalid. |
| `6045` | `UndeterminedError` | Undertermined error | Generic fallback error. |
| `6046` | `RateLimiterNotSupported` | Rate limiter not supported | Rate limiter was used in an unsupported context. |
| `6047` | `AmountLeftIsNotZero` | Amount left is not zero | Exact-in path did not consume the expected amount. Use partial fill near c프로젝트로 돌아가기