DBC Rust SDK

Rust SDK for interacting with the Dynamic Bonding Curve on Meteora.

Getting Started

For an overview on how Dynamic Bonding Curve works, please read this.

This SDK provides a set of tools and methods to interact with the Meteora Dynamic Bonding Curve. It enables developers to easily create and manage dynamic bonding curves, with support for custom configurations and fee structures.

Development

Dependencies

  • anchor 0.31.0

  • solana 2.1.0

  • rust 1.79.0

Build

Program

anchor build -p dynamic_bonding_curve

Test

pnpm install
pnpm test

Program ID address:

  • Mainnet-beta: dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN

  • Devnet: dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN

Key Parameters for configuration

Partner can specify these parameters when they create a configuration on all their pools:

  • pool_fees: include base_fee and dynamic_fee (optional). Partner can add fee scheduler in base_fee or just a fixed fee. pool_fees defines the trading fee for any pool that is created from this configuration.

  • collect_fee_mode (0 | 1): 0 means the virtual pool will only collect fee in quote token, 1 means virtual pool will collect fee in both tokens.

  • migration_option: right now we only support migration to Meteora DAMM, so partner must set the value as 0 for this field.

  • activation_type (0 | 1): 0 means slot, 1 means timestamp, this field indicates the time unit that pool will work with, mostly in calculating fee scheduler and dynamic fee.

  • token_type (0 | 1): 0 means SPL Token, 1 means Token2022.

  • token_decimal: the token decimals that the token will use when user creates the virtual pool with this configuration, we only support token decimals from 6 to 9.

  • partner_lp_percentage: the percentage of LP that partner can claim after token is migrated.

  • partner_locked_lp_percentage: the percentage of LP that partner will locked after token is migrated.

  • creator_lp_percentage: the percentage of LP that creator can claim after token is migrated.

  • creator_locked_lp_percentage: the percentage of LP that creator will be locked after token is migrated.

  • migration_quote_threshold: the threhold for quote token, that after virtual pool reserve get such quote token amount, the token will graduate from the launch pool and will be migrated.

  • fee_claimer: the address of partner that can claim trading fees from the virtual pools as well as fees from the locked LPs.

  • owner: owner of the configuration.

  • quote_mint: the quote mint address that virtual pool will support.

  • locked_vesting: locked vesting for creator after token is migrated (token will be migrated to Jup lock)

  • migration_fee_option: allow partner to choose a fee option on graduated pool (currently support 0.25% | 0.3% | 1% | 2%)

  • token_supply: when the fields are specified, token will have fixed supply in pre and post migration, leftover will be returned to leftover_receiver (configured in config key)

  • sqrt_start_price: square root of min price in the bonding curve for the virtual pools.

  • curve: an array of square price and liquidity, that defines the liquidity distribution for the virtual pools.

Config key for migration

Using the parameter migration_fee_option partners can choose a fee option on graduated pool.

DAMM V1:

Current fee tiers supported: 0.25% | 0.3% | 1% | 2% | 4% which corresponds to 1 | 2 | 3 | 4 | 5 below.

  • migration_fee_option == 1: HBxB8Lf14Yj8pqeJ8C4qDb5ryHL7xwpuykz31BLNYr7S

  • migration_fee_option == 2: 7v5vBdUQHTNeqk1HnduiXcgbvCyVEZ612HLmYkQoAkik

  • migration_fee_option == 3: EkvP7d5yKxovj884d2DwmBQbrHUWRLGK6bympzrkXGja

  • migration_fee_option == 4: 9EZYAJrcqNWNQzP2trzZesP7XKMHA1jEomHzbRsdX8R2

  • migration_fee_option == 5: 8cdKo87jZU2R12KY1BUjjRPwyjgdNjLGqSGQyrDshhud

DAMM V2:

Current fee tiers supported: 0.25% | 0.3% | 1% | 2% | 4% | 6% which corresponds to 0 | 1 | 2 | 3 | 4 | 5 below.

  • migration_fee_option == 0: 7F6dnUcRuyM2TwR8myT1dYypFXpPSxqwKNSFNkxyNESd

  • migration_fee_option == 1: 2nHK1kju6XjphBLbNxpM5XRGFj7p9U8vvNzyZiha1z6k

  • migration_fee_option == 2: Hv8Lmzmnju6m7kcokVKvwqz7QPmdX9XfKjJsXz8RXcjp

  • migration_fee_option == 3: 2c4cYd4reUYVRAB9kUUkrq55VPyy2FNQ3FDL4o12JXmq

  • migration_fee_option == 4: AkmQWebAwFvWk55wBoCr5D62C6VVDTzi84NJuD9H7cFD

  • migration_fee_option == 5: DbCRBj8McvPYHJG1ukj8RE15h2dCNUdTAESG49XpQ44u

Last updated