> ## 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.

# 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, migration, pool creation fee, and graduated-pool settings. |
| `create_config_with_transfer_hook` | `ConfigParameters`                                         | `client.partner.createConfigWithTransferHook`                               | Create a Token 2022 transfer-hook config with an executable transfer-hook program.                                  |
| `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.      |
| `initialize_virtual_pool_with_token2022`               | `InitializePoolParameters`                                        | `client.creator.createPool`                                                 | Create a DBC pool with a Token 2022 base mint.                            |
| `initialize_virtual_pool_with_token2022_transfer_hook` | `InitializePoolParameters`                                        | `client.creator.createPoolWithTransferHook`                                 | Create a DBC transfer-hook pool with a Token 2022 base mint.              |
| `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>
  If the config uses rate limiter fees, or `enable_first_swap_with_min_fee` is enabled, swap instructions require the instructions sysvar in remaining accounts. The SDK adds `SYSVAR_INSTRUCTIONS_PUBKEY` when needed.
</Note>

Transfer-hook swaps also pass extra remaining accounts described by `TransferHookAccountsInfo`.

| Remaining account slice    | Meaning                                                                              |
| -------------------------- | ------------------------------------------------------------------------------------ |
| `TransferHookBase`         | Extra accounts for base-token transfer-hook CPIs.                                    |
| `TransferHookBaseReferral` | Extra accounts for base-token referral transfers when a referral account is present. |

Standard swap instructions reject `TransferHookPool` accounts, and `swap2_with_transfer_hook` rejects standard `VirtualPool` accounts with `PoolTypeMismatch`.

## Migration Instructions

| Instruction                              | Destination                     | SDK path                                                                                   | Purpose                                                                                          |
| ---------------------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
| `create_locker`                          | DAMM v1 or DAMM v2 support flow | `client.migration.createLocker`                                                            | Create the locker escrow when locked vesting is configured.                                      |
| `withdraw_leftover`                      | DAMM v1 or DAMM v2              | `client.migration.withdrawLeftover`                                                        | Withdraw leftover base tokens after migration.                                                   |
| `migration_meteora_damm_create_metadata` | DAMM v1                         | `client.migration.createDammV1MigrationMetadata`                                           | Create metadata before DAMM v1 migration.                                                        |
| `migrate_meteora_damm`                   | DAMM v1                         | `client.migration.migrateToDammV1`                                                         | Migrate a completed DBC pool to DAMM v1.                                                         |
| `migrate_meteora_damm_lock_lp_token`     | DAMM v1                         | `client.migration.lockDammV1LpToken`                                                       | Lock permanent LP allocation for partner or creator.                                             |
| `migrate_meteora_damm_claim_lp_token`    | DAMM v1                         | `client.migration.claimDammV1LpToken`                                                      | Claim partner or creator LP allocation.                                                          |
| `migration_damm_v2_create_metadata`      | DAMM v2                         | Deprecated                                                                                 | Deprecated since program `0.1.7`; DAMM v2 migration no longer needs a separate metadata account. |
| `migration_damm_v2`                      | DAMM v2                         | `client.migration.migrateToDammV2`                                                         | Migrate a completed DBC pool to DAMM v2.                                                         |
| `withdraw_migration_fee`                 | DAMM v1 or DAMM v2              | `client.partner.partnerWithdrawMigrationFee`, `client.creator.creatorWithdrawMigrationFee` | Withdraw partner or creator migration fee. Uses `flag` to select the fee side.                   |
