Skip to content

[sync]: program 0.2.2 - #116

Closed
dannxbt wants to merge 7 commits into
mainfrom
sync/program-0.2.2
Closed

dannxbt wants to merge 7 commits into
mainfrom
sync/program-0.2.2

Conversation

@dannxbt

@dannxbt dannxbt commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

DBC SDK 1.6.0

Syncs the SDK with dynamic bonding curve 0.2.2.

Added

  • client.partner.createConfig2. Pass transferFeeParameters for a base-mint transfer fee, or null when there is none. 0 basis points is valid only with TransferFeeWithheldAuthority.Partner and MigratedTransferFeeAuthorityOption.Immutable.
  • TransferFeeWithheldAuthority and MigratedTransferFeeAuthorityOption.
  • Swap quotes account for Token-2022 transfer fees and return includedTransferFeeAmountIn and excludedTransferFeeAmountOut. getSwapQuoteTransferFees fetches the quote mint and the current epoch.
  • getQuoteFromInputAmount and getQuoteFromOutputAmount quote a buildCurve result (ConfigParameters) before a pool exists. client.pool.swapQuote2 quotes an existing pool and requires currentPoint.

Changed

  • createConfigAndPool and createConfigAndPoolWithFirstBuy always use createConfig2. Omitting transferFeeParameters is the same as null.
  • A base transfer fee, or a quote mint with a non-zero transfer fee or a live transfer fee config authority, requires a constant token supply, no locked vesting, MigrationFeeOption.Customizable, and MigratedCollectFeeMode.Compounding. The base fee is Token-2022 only and at most 10%.
  • MigratedCollectFeeMode.Compounding allows compoundingFeeBps of 0.
  • Curve builders size the migration deposit from ceil(migrationQuoteThreshold * (100 - migrationFee.feePercentage) / 100), then convert that quote amount into the migration base. buildCurveWithLiquidityWeights and buildCurveWithCustomSqrtPrices use constant product for Compounding, and concentrated liquidity for QuoteToken and OutputToken.
  • buildCurveWithTwoSegments and buildCurveWithMidPrice keep a fractional percentageSupplyOnMigration when sizing the migration base.
  • Liquidity vesting frequency is floor(totalDuration / numberOfPeriods).
  • Exponential fee schedulers, including the migrated market-cap scheduler, choose reductionFactor with the program's Q64 decay so the last period stays at or above the requested ending fee.
  • Rate-limiter validation checks the fee at u64::MAX.
  • Swap quotes reject amounts outside the program's u64 and u128 bounds. Insufficient-liquidity quotes use the program error text, Liquidity in bonding curve is insufficient.
  • Synced the DAMM v2 IDL and cp_amm.so fixture to cp_amm 0.2.5.
  • calculateFeeSchedulerEndingBaseFeeBps uses the program's integer conversion, numerator * 10_000 / FEE_DENOMINATOR.

Deprecated

  • client.partner.createConfig in favour of createConfig2. createConfig and createConfigWithTransferHook reject a quote mint with a non-zero transfer fee or a live transfer fee config authority.

Breaking

  • Swap quotes for a Token-2022 quote mint require quoteMint and currentEpoch.
  • SwapQuoteConfig is removed. getQuoteFrom* takes ConfigParameters and does not accept a decoded PoolConfig.
  • getMigratedPoolFeeParams throws for MigrationFeeOption.Customizable when migratedPoolFee.poolFeeBps is not set.
  • swap, swap2, claimPartnerTradingFee, and claimCreatorTradingFee reject transfer-hook pools. Use swap2WithTransferHook, claimPartnerTradingFee2, and claimCreatorTradingFee2. Standard pool creation rejects a transfer-hook config, and transfer-hook pool creation rejects a standard config.

Devnet

Transfer fee on the quote mint

  1. Quote mint: Ht3XpsXotiANunYTLeYwkiSdNZq4PBs9sTXgYBNABEwn
  2. Create config: https://solscan.io/tx/8tSq8VRPemZ96kG8neg4CvdRsrAPaYATGYXGWkF9JiGFtjZbYJZLLJmQ8cTGfJ57SkhdzktJUvpYdQBjQXaX5Px?cluster=devnet
  3. Create pool: https://solscan.io/tx/Yg9pnNBeUQKcqDGu9prn9c9Qf8i1B3osNwRPTUBbWAEF9RUqxhFm8hjFHU4h3Atfd6HM5MkGvouYRVC77XKDrgH?cluster=devnet
  4. Buy: https://solscan.io/tx/4DTyvjwSJZTHxcVBP6g63nBEvEVDxKRKymaJYho74MS87JbiTaBwWpW2tRrk5uXpiBU2U2LD4nMeNuEnLUmLvwrb?cluster=devnet
  5. Migrate to DAMM v2: https://solscan.io/tx/5XAUfFhg97qLamFgdTwbBhgDoxuBr3tN4ZqjM322D1EoFAYJubxP6T8TQzVTaiJbssYGjbQvNv21JMXoYENrPKKD?cluster=devnet

Transfer fee on the base mint

  1. Create config: https://solscan.io/tx/5uYAnSwWrJWz7vN9tW3imwopvQVHJL5N6uAgnpmXQfBbsmXPs7jKj7VNureuc6iCaxa9nH84TqfEsDLnq4pXj59Y?cluster=devnet
  2. Create pool: https://solscan.io/tx/39xn9xEg6ziHeYkkFtpoZC8bN5XqsVTUcXDnDkpziuJSLXs6yqsnFUeustwkL6rNub4Tvt44DnELQanuPpfKtAvh?cluster=devnet
  3. Buy: https://solscan.io/tx/52HjePt2sERDtxKJ2AzJGhbVWD4XwfCrj7yFjbJsU1wK3DTvjubrCURnE7UcY8uVhnBSSfvZexxwnLdhXHQ9p1bM?cluster=devnet
  4. Migrate to DAMM v2: https://solscan.io/tx/2F2rfVcwvFSYkszUSCjK359MirBnU6x16YfmkK8fVtBdPfQaGnPE4qYTrnFqMP5Auty8ba35ZCJzSEHRqLHcXjRF?cluster=devnet

Match createConfig2, transfer-fee quotes, and compounding migration on the existing SDK layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
@dannxbt
dannxbt added this pull request to stack #118 September 27, 2026 11:42
@dannxbt dannxbt changed the title sync: program 0.2.2 [sync]: program 0.2.2 Sep 27, 2026
Comment thread packages/dynamic-bonding-curve/src/helpers/common.ts
Comment thread packages/dynamic-bonding-curve/src/helpers/common.ts Outdated
Comment thread packages/dynamic-bonding-curve/src/helpers/common.ts Outdated
bangyro
bangyro previously approved these changes Sep 28, 2026
dannxbt and others added 5 commits September 29, 2026 04:15
quoteSwap2 accepted either shape and, when currentPoint was omitted, quoted a fee scheduler at the cliff fee. swapQuote2 now quotes the live accounts, and getQuoteFrom* quotes the pool initialize_pool would write.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Fractional migration percentages, floored vesting periods, and Q64 fee decay now follow the program. Quotes stay inside the u64 and u128 bounds and use the program's liquidity errors.

Co-authored-by: Cursor <cursoragent@cursor.com>
Locked vesting periods floor the same way liquidity vesting does. Exponential ending fees and pow follow the program's Q64 integer math.

Co-authored-by: Cursor <cursoragent@cursor.com>
Prettier also accepts the locked vesting frequency test, which was failing CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants