@meteora-ag/dynamic-bonding-curve-sdk 1.1.8 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -5,10 +5,10 @@
5
5
  var _web3js = require('@solana/web3.js');
6
6
 
7
7
  // src/types.ts
8
- var ActivationType = /* @__PURE__ */ ((ActivationType3) => {
9
- ActivationType3[ActivationType3["Slot"] = 0] = "Slot";
10
- ActivationType3[ActivationType3["Timestamp"] = 1] = "Timestamp";
11
- return ActivationType3;
8
+ var ActivationType = /* @__PURE__ */ ((ActivationType2) => {
9
+ ActivationType2[ActivationType2["Slot"] = 0] = "Slot";
10
+ ActivationType2[ActivationType2["Timestamp"] = 1] = "Timestamp";
11
+ return ActivationType2;
12
12
  })(ActivationType || {});
13
13
  var TokenType = /* @__PURE__ */ ((TokenType2) => {
14
14
  TokenType2[TokenType2["SPL"] = 0] = "SPL";
@@ -61,6 +61,11 @@ var Rounding = /* @__PURE__ */ ((Rounding2) => {
61
61
  Rounding2[Rounding2["Down"] = 1] = "Down";
62
62
  return Rounding2;
63
63
  })(Rounding || {});
64
+ var TokenUpdateAuthorityOption = /* @__PURE__ */ ((TokenUpdateAuthorityOption2) => {
65
+ TokenUpdateAuthorityOption2[TokenUpdateAuthorityOption2["Mutable"] = 0] = "Mutable";
66
+ TokenUpdateAuthorityOption2[TokenUpdateAuthorityOption2["Immutable"] = 1] = "Immutable";
67
+ return TokenUpdateAuthorityOption2;
68
+ })(TokenUpdateAuthorityOption || {});
64
69
 
65
70
  // src/constants.ts
66
71
  var _bnjs = require('bn.js'); var _bnjs2 = _interopRequireDefault(_bnjs);
@@ -361,6 +366,9 @@ function getInitializeAmounts(sqrtMinPrice, sqrtMaxPrice, sqrtPrice, liquidity)
361
366
 
362
367
 
363
368
  var _spltoken = require('@solana/spl-token');
369
+ function fromDecimalToBN(value) {
370
+ return new (0, _bnjs2.default)(value.floor().toFixed());
371
+ }
364
372
  function createProgramAccountFilter(owner, offset) {
365
373
  const ownerKey = typeof owner === "string" ? new (0, _web3js.PublicKey)(owner) : owner;
366
374
  return [
@@ -495,10 +503,18 @@ function getDeltaAmountBase(lowerSqrtPrice, upperSqrtPrice, liquidity) {
495
503
  const denominator = lowerSqrtPrice.mul(upperSqrtPrice);
496
504
  return numerator.add(denominator).sub(new (0, _bnjs2.default)(1)).div(denominator);
497
505
  }
498
- var getMigrationBaseToken = (migrationQuoteThreshold, sqrtMigrationPrice, migrationOption) => {
506
+ var getMigrationQuoteAmountFromMigrationQuoteThreshold = (migrationQuoteThreshold, migrationFeePercent) => {
507
+ const migrationQuoteAmount = migrationQuoteThreshold.mul(new (0, _decimaljs2.default)(100).sub(new (0, _decimaljs2.default)(migrationFeePercent))).div(new (0, _decimaljs2.default)(100));
508
+ return migrationQuoteAmount;
509
+ };
510
+ var getMigrationQuoteThresholdFromMigrationQuoteAmount = (migrationQuoteAmount, migrationFeePercent) => {
511
+ const migrationQuoteThreshold = migrationQuoteAmount.mul(new (0, _decimaljs2.default)(100)).div(new (0, _decimaljs2.default)(100).sub(new (0, _decimaljs2.default)(migrationFeePercent)));
512
+ return migrationQuoteThreshold;
513
+ };
514
+ var getMigrationBaseToken = (migrationQuoteAmount, sqrtMigrationPrice, migrationOption) => {
499
515
  if (migrationOption == 0 /* MET_DAMM */) {
500
516
  const price = sqrtMigrationPrice.mul(sqrtMigrationPrice);
501
- const quote = migrationQuoteThreshold.shln(128);
517
+ const quote = migrationQuoteAmount.shln(128);
502
518
  const { div: baseDiv, mod } = quote.divmod(price);
503
519
  let div = baseDiv;
504
520
  if (!mod.isZero()) {
@@ -507,7 +523,7 @@ var getMigrationBaseToken = (migrationQuoteThreshold, sqrtMigrationPrice, migrat
507
523
  return div;
508
524
  } else if (migrationOption == 1 /* MET_DAMM_V2 */) {
509
525
  const liquidity = getInitialLiquidityFromDeltaQuote(
510
- migrationQuoteThreshold,
526
+ migrationQuoteAmount,
511
527
  MIN_SQRT_PRICE,
512
528
  sqrtMigrationPrice
513
529
  );
@@ -540,8 +556,9 @@ var getLiquidity = (baseAmount, quoteAmount, minSqrtPrice, maxSqrtPrice) => {
540
556
  );
541
557
  return _bnjs2.default.min(liquidityFromBase, liquidityFromQuote);
542
558
  };
543
- var getFirstCurve = (migrationSqrPrice, migrationAmount, swapAmount, migrationQuoteThreshold) => {
544
- const sqrtStartPrice = migrationSqrPrice.mul(migrationAmount).div(swapAmount);
559
+ var getFirstCurve = (migrationSqrPrice, migrationBaseAmount, swapAmount, migrationQuoteThreshold, migrationFeePercent) => {
560
+ const denominator = swapAmount.mul(new (0, _bnjs2.default)(100).sub(new (0, _bnjs2.default)(migrationFeePercent))).div(new (0, _bnjs2.default)(100));
561
+ const sqrtStartPrice = migrationSqrPrice.mul(migrationBaseAmount).div(denominator);
545
562
  const liquidity = getLiquidity(
546
563
  swapAmount,
547
564
  migrationQuoteThreshold,
@@ -558,7 +575,7 @@ var getFirstCurve = (migrationSqrPrice, migrationAmount, swapAmount, migrationQu
558
575
  ]
559
576
  };
560
577
  };
561
- var getTotalSupplyFromCurve = (migrationQuoteThreshold, sqrtStartPrice, curve, lockedVesting, migrationOption, leftover) => {
578
+ var getTotalSupplyFromCurve = (migrationQuoteThreshold, sqrtStartPrice, curve, lockedVesting, migrationOption, leftover, migrationFeePercent) => {
562
579
  const sqrtMigrationPrice = getMigrationThresholdPrice(
563
580
  migrationQuoteThreshold,
564
581
  sqrtStartPrice,
@@ -574,8 +591,12 @@ var getTotalSupplyFromCurve = (migrationQuoteThreshold, sqrtStartPrice, curve, l
574
591
  sqrtStartPrice,
575
592
  curve
576
593
  );
594
+ const migrationQuoteAmount = getMigrationQuoteAmountFromMigrationQuoteThreshold(
595
+ new (0, _decimaljs2.default)(migrationQuoteThreshold.toString()),
596
+ migrationFeePercent
597
+ );
577
598
  const migrationBaseAmount = getMigrationBaseToken(
578
- migrationQuoteThreshold,
599
+ fromDecimalToBN(migrationQuoteAmount),
579
600
  sqrtMigrationPrice,
580
601
  migrationOption
581
602
  );
@@ -656,8 +677,8 @@ var getPercentageSupplyOnMigration = (initialMarketCap, migrationMarketCap, lock
656
677
  const denominator = new (0, _decimaljs2.default)(1).add(sqrtRatio);
657
678
  return numerator.div(denominator).toNumber();
658
679
  };
659
- var getMigrationQuoteThreshold = (migrationMarketCap, percentageSupplyOnMigration) => {
660
- return migrationMarketCap.mul(percentageSupplyOnMigration).div(new (0, _decimaljs2.default)(100)).toNumber();
680
+ var getMigrationQuoteAmount = (migrationMarketCap, percentageSupplyOnMigration) => {
681
+ return migrationMarketCap.mul(percentageSupplyOnMigration).div(new (0, _decimaljs2.default)(100));
661
682
  };
662
683
  function getBaseFeeParams(startingBaseFeeBps, endingBaseFeeBps, feeSchedulerMode, numberOfPeriod, totalDuration) {
663
684
  if (startingBaseFeeBps == endingBaseFeeBps) {
@@ -1195,6 +1216,12 @@ function validateTokenSupply(tokenSupply, leftoverReceiver, swapBaseAmount, migr
1195
1216
  new (0, _bnjs2.default)(tokenSupply.preMigrationTokenSupply)
1196
1217
  ));
1197
1218
  }
1219
+ function validateTokenUpdateAuthorityOptions(option) {
1220
+ return [
1221
+ 0 /* Mutable */,
1222
+ 1 /* Immutable */
1223
+ ].includes(option);
1224
+ }
1198
1225
  function validateConfigParameters(configParam) {
1199
1226
  if (!configParam.poolFees) {
1200
1227
  throw new Error("Pool fees are required");
@@ -1205,6 +1232,9 @@ function validateConfigParameters(configParam) {
1205
1232
  if (!validateCollectFeeMode(configParam.collectFeeMode)) {
1206
1233
  throw new Error("Invalid collect fee mode");
1207
1234
  }
1235
+ if (!validateTokenUpdateAuthorityOptions(configParam.tokenUpdateAuthority)) {
1236
+ throw new Error("Invalid option for token update authority");
1237
+ }
1208
1238
  if (!validateMigrationAndTokenType(
1209
1239
  configParam.migrationOption,
1210
1240
  configParam.tokenType
@@ -1217,6 +1247,12 @@ function validateConfigParameters(configParam) {
1217
1247
  if (!validateMigrationFeeOption(configParam.migrationFeeOption)) {
1218
1248
  throw new Error("Invalid migration fee option");
1219
1249
  }
1250
+ if (configParam.migrationFee.feePercentage < 0 || configParam.migrationFee.feePercentage > 50) {
1251
+ throw new Error("Migration fee percentage must be between 0 and 50");
1252
+ }
1253
+ if (configParam.migrationFee.creatorFeePercentage < 0 || configParam.migrationFee.creatorFeePercentage > 100) {
1254
+ throw new Error("Creator fee percentage must be between 0 and 100");
1255
+ }
1220
1256
  if (!validateTokenDecimals(configParam.tokenDecimal)) {
1221
1257
  throw new Error("Token decimal must be between 6 and 9");
1222
1258
  }
@@ -1325,7 +1361,7 @@ function validateSwapAmount(amountIn) {
1325
1361
 
1326
1362
 
1327
1363
  function buildCurve(buildCurveParam) {
1328
- const {
1364
+ let {
1329
1365
  totalTokenSupply,
1330
1366
  percentageSupplyOnMigration,
1331
1367
  migrationQuoteThreshold,
@@ -1342,7 +1378,9 @@ function buildCurve(buildCurveParam) {
1342
1378
  partnerLockedLpPercentage,
1343
1379
  creatorLockedLpPercentage,
1344
1380
  creatorTradingFeePercentage,
1345
- leftover
1381
+ leftover,
1382
+ tokenUpdateAuthority,
1383
+ migrationFee
1346
1384
  } = buildCurveParam;
1347
1385
  const {
1348
1386
  startingFeeBps,
@@ -1377,12 +1415,16 @@ function buildCurve(buildCurveParam) {
1377
1415
  const totalSupply = new (0, _bnjs2.default)(totalTokenSupply).mul(
1378
1416
  new (0, _bnjs2.default)(10).pow(new (0, _bnjs2.default)(tokenBaseDecimal))
1379
1417
  );
1380
- const migrationQuoteThresholdWithDecimals = new (0, _bnjs2.default)(
1381
- migrationQuoteThreshold * 10 ** tokenQuoteDecimal
1418
+ const migrationQuoteAmount = getMigrationQuoteAmountFromMigrationQuoteThreshold(
1419
+ new (0, _decimaljs2.default)(migrationQuoteThreshold),
1420
+ migrationFee.feePercentage
1382
1421
  );
1383
- const migrationPrice = new (0, _decimaljs2.default)(migrationQuoteThreshold.toString()).div(
1422
+ const migrationPrice = new (0, _decimaljs2.default)(migrationQuoteAmount.toString()).div(
1384
1423
  new (0, _decimaljs2.default)(migrationBaseSupply.toString())
1385
1424
  );
1425
+ let migrationQuoteThresholdInLamport = new (0, _bnjs2.default)(
1426
+ migrationQuoteThreshold * 10 ** tokenQuoteDecimal
1427
+ );
1386
1428
  const totalLeftover = new (0, _bnjs2.default)(leftover).mul(
1387
1429
  new (0, _bnjs2.default)(10).pow(new (0, _bnjs2.default)(tokenBaseDecimal))
1388
1430
  );
@@ -1391,8 +1433,11 @@ function buildCurve(buildCurveParam) {
1391
1433
  tokenBaseDecimal,
1392
1434
  tokenQuoteDecimal
1393
1435
  );
1436
+ let migrationQuoteAmountInLamport = new (0, _bnjs2.default)(
1437
+ migrationQuoteThreshold * 10 ** tokenQuoteDecimal
1438
+ );
1394
1439
  const migrationBaseAmount = getMigrationBaseToken(
1395
- new (0, _bnjs2.default)(migrationQuoteThresholdWithDecimals),
1440
+ new (0, _bnjs2.default)(migrationQuoteAmountInLamport),
1396
1441
  migrateSqrtPrice,
1397
1442
  migrationOption
1398
1443
  );
@@ -1402,15 +1447,17 @@ function buildCurve(buildCurveParam) {
1402
1447
  migrateSqrtPrice,
1403
1448
  migrationBaseAmount,
1404
1449
  swapAmount,
1405
- migrationQuoteThresholdWithDecimals
1450
+ migrationQuoteThresholdInLamport,
1451
+ migrationFee.feePercentage
1406
1452
  );
1407
1453
  const totalDynamicSupply = getTotalSupplyFromCurve(
1408
- migrationQuoteThresholdWithDecimals,
1454
+ migrationQuoteThresholdInLamport,
1409
1455
  sqrtStartPrice,
1410
1456
  curve,
1411
1457
  lockedVesting,
1412
1458
  migrationOption,
1413
- totalLeftover
1459
+ totalLeftover,
1460
+ migrationFee.feePercentage
1414
1461
  );
1415
1462
  const remainingAmount = totalSupply.sub(totalDynamicSupply);
1416
1463
  const lastLiquidity = getInitialLiquidityFromDeltaBase(
@@ -1436,7 +1483,7 @@ function buildCurve(buildCurveParam) {
1436
1483
  migrationOption,
1437
1484
  tokenType,
1438
1485
  tokenDecimal: tokenBaseDecimal,
1439
- migrationQuoteThreshold: migrationQuoteThresholdWithDecimals,
1486
+ migrationQuoteThreshold: migrationQuoteThresholdInLamport,
1440
1487
  partnerLpPercentage,
1441
1488
  creatorLpPercentage,
1442
1489
  partnerLockedLpPercentage,
@@ -1449,6 +1496,8 @@ function buildCurve(buildCurveParam) {
1449
1496
  postMigrationTokenSupply: totalSupply
1450
1497
  },
1451
1498
  creatorTradingFeePercentage,
1499
+ tokenUpdateAuthority,
1500
+ migrationFee,
1452
1501
  padding0: [],
1453
1502
  padding1: [],
1454
1503
  curve
@@ -1460,7 +1509,8 @@ function buildCurveWithMarketCap(buildCurveWithMarketCapParam) {
1460
1509
  initialMarketCap,
1461
1510
  migrationMarketCap,
1462
1511
  totalTokenSupply,
1463
- tokenBaseDecimal
1512
+ tokenBaseDecimal,
1513
+ migrationFee
1464
1514
  } = buildCurveWithMarketCapParam;
1465
1515
  const {
1466
1516
  totalLockedVestingAmount,
@@ -1486,10 +1536,14 @@ function buildCurveWithMarketCap(buildCurveWithMarketCapParam) {
1486
1536
  lockedVesting,
1487
1537
  totalSupply
1488
1538
  );
1489
- const migrationQuoteThreshold = getMigrationQuoteThreshold(
1539
+ const migrationQuoteAmount = getMigrationQuoteAmount(
1490
1540
  new (0, _decimaljs2.default)(migrationMarketCap),
1491
1541
  new (0, _decimaljs2.default)(percentageSupplyOnMigration)
1492
1542
  );
1543
+ const migrationQuoteThreshold = getMigrationQuoteThresholdFromMigrationQuoteAmount(
1544
+ migrationQuoteAmount,
1545
+ new (0, _decimaljs2.default)(migrationFee.feePercentage)
1546
+ ).toNumber();
1493
1547
  return buildCurve({
1494
1548
  ...buildCurveWithMarketCapParam,
1495
1549
  percentageSupplyOnMigration,
@@ -1515,7 +1569,9 @@ function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam) {
1515
1569
  creatorLockedLpPercentage,
1516
1570
  activationType,
1517
1571
  dynamicFeeEnabled,
1518
- migrationFeeOption
1572
+ migrationFeeOption,
1573
+ migrationFee,
1574
+ tokenUpdateAuthority
1519
1575
  } = buildCurveWithTwoSegmentsParam;
1520
1576
  const {
1521
1577
  startingFeeBps,
@@ -1550,20 +1606,30 @@ function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam) {
1550
1606
  let totalSupply = new (0, _bnjs2.default)(totalTokenSupply).mul(
1551
1607
  new (0, _bnjs2.default)(10).pow(new (0, _bnjs2.default)(tokenBaseDecimal))
1552
1608
  );
1553
- let migrationQuoteThreshold = migrationMarketCap * percentageSupplyOnMigration / 100;
1554
- let migrationQuoteThresholdWithDecimals = new (0, _bnjs2.default)(
1555
- migrationQuoteThreshold * 10 ** tokenQuoteDecimal
1609
+ let migrationQuoteAmount = getMigrationQuoteAmount(
1610
+ new (0, _decimaljs2.default)(migrationMarketCap),
1611
+ new (0, _decimaljs2.default)(percentageSupplyOnMigration)
1556
1612
  );
1557
- let migrationPrice = new (0, _decimaljs2.default)(migrationQuoteThreshold.toString()).div(
1613
+ let migrationQuoteThreshold = getMigrationQuoteThresholdFromMigrationQuoteAmount(
1614
+ migrationQuoteAmount,
1615
+ new (0, _decimaljs2.default)(migrationFee.feePercentage)
1616
+ );
1617
+ let migrationPrice = migrationQuoteAmount.div(
1558
1618
  new (0, _decimaljs2.default)(migrationBaseSupply.toString())
1559
1619
  );
1620
+ let migrationQuoteThresholdInLamport = fromDecimalToBN(
1621
+ migrationQuoteThreshold.mul(new (0, _decimaljs2.default)(10 ** tokenQuoteDecimal))
1622
+ );
1623
+ let migrationQuoteAmountInLamport = fromDecimalToBN(
1624
+ migrationQuoteAmount.mul(new (0, _decimaljs2.default)(10 ** tokenQuoteDecimal))
1625
+ );
1560
1626
  let migrateSqrtPrice = getSqrtPriceFromPrice(
1561
1627
  migrationPrice.toString(),
1562
1628
  tokenBaseDecimal,
1563
1629
  tokenQuoteDecimal
1564
1630
  );
1565
1631
  let migrationBaseAmount = getMigrationBaseToken(
1566
- new (0, _bnjs2.default)(migrationQuoteThresholdWithDecimals),
1632
+ migrationQuoteAmountInLamport,
1567
1633
  migrateSqrtPrice,
1568
1634
  migrationOption
1569
1635
  );
@@ -1599,7 +1665,7 @@ function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam) {
1599
1665
  midPrices[i],
1600
1666
  initialSqrtPrice,
1601
1667
  swapAmount,
1602
- migrationQuoteThresholdWithDecimals
1668
+ migrationQuoteThresholdInLamport
1603
1669
  );
1604
1670
  if (result.isOk) {
1605
1671
  curve = result.curve;
@@ -1608,12 +1674,13 @@ function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam) {
1608
1674
  }
1609
1675
  }
1610
1676
  let totalDynamicSupply = getTotalSupplyFromCurve(
1611
- migrationQuoteThresholdWithDecimals,
1677
+ migrationQuoteThresholdInLamport,
1612
1678
  sqrtStartPrice,
1613
1679
  curve,
1614
1680
  lockedVesting,
1615
1681
  migrationOption,
1616
- totalLeftover
1682
+ totalLeftover,
1683
+ migrationFee.feePercentage
1617
1684
  );
1618
1685
  if (totalDynamicSupply.gt(totalSupply)) {
1619
1686
  let leftOverDelta = totalDynamicSupply.sub(totalSupply);
@@ -1633,7 +1700,7 @@ function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam) {
1633
1700
  migrationOption,
1634
1701
  tokenType,
1635
1702
  tokenDecimal: tokenBaseDecimal,
1636
- migrationQuoteThreshold: migrationQuoteThresholdWithDecimals,
1703
+ migrationQuoteThreshold: migrationQuoteThresholdInLamport,
1637
1704
  partnerLpPercentage,
1638
1705
  creatorLpPercentage,
1639
1706
  partnerLockedLpPercentage,
@@ -1648,12 +1715,14 @@ function buildCurveWithTwoSegments(buildCurveWithTwoSegmentsParam) {
1648
1715
  creatorTradingFeePercentage,
1649
1716
  padding0: [],
1650
1717
  padding1: [],
1651
- curve
1718
+ curve,
1719
+ tokenUpdateAuthority,
1720
+ migrationFee
1652
1721
  };
1653
1722
  return instructionParams;
1654
1723
  }
1655
1724
  function buildCurveWithLiquidityWeights(buildCurveWithLiquidityWeightsParam) {
1656
- const {
1725
+ let {
1657
1726
  totalTokenSupply,
1658
1727
  migrationOption,
1659
1728
  tokenBaseDecimal,
@@ -1671,7 +1740,9 @@ function buildCurveWithLiquidityWeights(buildCurveWithLiquidityWeightsParam) {
1671
1740
  leftover,
1672
1741
  initialMarketCap,
1673
1742
  migrationMarketCap,
1674
- liquidityWeights
1743
+ liquidityWeights,
1744
+ migrationFee,
1745
+ tokenUpdateAuthority
1675
1746
  } = buildCurveWithLiquidityWeightsParam;
1676
1747
  const {
1677
1748
  startingFeeBps,
@@ -1736,12 +1807,13 @@ function buildCurveWithLiquidityWeights(buildCurveWithLiquidityWeightsParam) {
1736
1807
  let totalSwapAndMigrationAmount = totalSupply.sub(totalVestingAmount).sub(totalLeftover);
1737
1808
  let sumFactor = new (0, _decimaljs2.default)(0);
1738
1809
  let pmaxWeight = new (0, _decimaljs2.default)(pMax.toString());
1810
+ let migrationFeeFactor = new (0, _decimaljs2.default)(100).sub(new (0, _decimaljs2.default)(migrationFee.feePercentage)).div(new (0, _decimaljs2.default)(100));
1739
1811
  for (let i = 1; i < 17; i++) {
1740
1812
  let pi = new (0, _decimaljs2.default)(sqrtPrices[i].toString());
1741
1813
  let piMinus = new (0, _decimaljs2.default)(sqrtPrices[i - 1].toString());
1742
1814
  let k = new (0, _decimaljs2.default)(liquidityWeights[i - 1]);
1743
1815
  let w1 = pi.sub(piMinus).div(pi.mul(piMinus));
1744
- let w2 = pi.sub(piMinus).div(pmaxWeight.mul(pmaxWeight));
1816
+ let w2 = pi.sub(piMinus).mul(migrationFeeFactor).div(pmaxWeight.mul(pmaxWeight));
1745
1817
  let weight = k.mul(w1.add(w2));
1746
1818
  sumFactor = sumFactor.add(weight);
1747
1819
  }
@@ -1763,14 +1835,22 @@ function buildCurveWithLiquidityWeights(buildCurveWithLiquidityWeightsParam) {
1763
1835
  curve
1764
1836
  );
1765
1837
  let migrationAmount = totalSwapAndMigrationAmount.sub(swapBaseAmountBuffer);
1766
- let migrationQuoteThreshold = migrationAmount.mul(pMax).mul(pMax).shrn(128);
1838
+ let migrationQuoteAmount = migrationAmount.mul(pMax).mul(pMax).shrn(128);
1839
+ let migrationQuoteThreshold = getMigrationQuoteThresholdFromMigrationQuoteAmount(
1840
+ new (0, _decimaljs2.default)(migrationQuoteAmount.toString()),
1841
+ new (0, _decimaljs2.default)(migrationFee.feePercentage)
1842
+ );
1843
+ let migrationQuoteThresholdInLamport = fromDecimalToBN(
1844
+ migrationQuoteThreshold
1845
+ );
1767
1846
  let totalDynamicSupply = getTotalSupplyFromCurve(
1768
- migrationQuoteThreshold,
1847
+ migrationQuoteThresholdInLamport,
1769
1848
  pMin,
1770
1849
  curve,
1771
1850
  lockedVesting,
1772
1851
  migrationOption,
1773
- totalLeftover
1852
+ totalLeftover,
1853
+ migrationFee.feePercentage
1774
1854
  );
1775
1855
  if (totalDynamicSupply.gt(totalSupply)) {
1776
1856
  let leftOverDelta = totalDynamicSupply.sub(totalSupply);
@@ -1790,7 +1870,7 @@ function buildCurveWithLiquidityWeights(buildCurveWithLiquidityWeightsParam) {
1790
1870
  migrationOption,
1791
1871
  tokenType,
1792
1872
  tokenDecimal: tokenBaseDecimal,
1793
- migrationQuoteThreshold,
1873
+ migrationQuoteThreshold: migrationQuoteThresholdInLamport,
1794
1874
  partnerLpPercentage,
1795
1875
  creatorLpPercentage,
1796
1876
  partnerLockedLpPercentage,
@@ -1805,189 +1885,9 @@ function buildCurveWithLiquidityWeights(buildCurveWithLiquidityWeightsParam) {
1805
1885
  creatorTradingFeePercentage,
1806
1886
  padding0: [],
1807
1887
  padding1: [],
1808
- curve
1809
- };
1810
- return instructionParams;
1811
- }
1812
- function buildCurveWithCreatorFirstBuy(buildCurveWithCreatorFirstBuyParam) {
1813
- const {
1814
- totalTokenSupply,
1815
- migrationOption,
1816
- tokenBaseDecimal,
1817
- tokenQuoteDecimal,
1818
- dynamicFeeEnabled,
1819
- activationType,
1820
- collectFeeMode,
1821
- migrationFeeOption,
1822
- tokenType,
1823
- partnerLpPercentage,
1824
- creatorLpPercentage,
1825
- partnerLockedLpPercentage,
1826
- creatorLockedLpPercentage,
1827
- creatorTradingFeePercentage,
1828
- leftover,
1829
- initialMarketCap,
1830
- migrationMarketCap,
1831
- liquidityWeights
1832
- } = buildCurveWithCreatorFirstBuyParam;
1833
- const { quoteAmount, baseAmount } = buildCurveWithCreatorFirstBuyParam.creatorFirstBuyOption;
1834
- const {
1835
- startingFeeBps,
1836
- endingFeeBps,
1837
- numberOfPeriod,
1838
- feeSchedulerMode,
1839
- totalDuration
1840
- } = buildCurveWithCreatorFirstBuyParam.feeSchedulerParam;
1841
- const baseFeeParams = getBaseFeeParams(
1842
- startingFeeBps,
1843
- endingFeeBps,
1844
- feeSchedulerMode,
1845
- numberOfPeriod,
1846
- totalDuration
1847
- );
1848
- const {
1849
- totalLockedVestingAmount,
1850
- numberOfVestingPeriod,
1851
- cliffUnlockAmount,
1852
- totalVestingDuration,
1853
- cliffDurationFromMigrationTime
1854
- } = buildCurveWithCreatorFirstBuyParam.lockedVestingParam;
1855
- const lockedVesting = getLockedVestingParams(
1856
- totalLockedVestingAmount,
1857
- numberOfVestingPeriod,
1858
- cliffUnlockAmount,
1859
- totalVestingDuration,
1860
- cliffDurationFromMigrationTime,
1861
- tokenBaseDecimal
1862
- );
1863
- let pMin = getSqrtPriceFromMarketCap(
1864
- initialMarketCap,
1865
- totalTokenSupply,
1866
- tokenBaseDecimal,
1867
- tokenQuoteDecimal
1868
- );
1869
- let pMax = getSqrtPriceFromMarketCap(
1870
- migrationMarketCap,
1871
- totalTokenSupply,
1872
- tokenBaseDecimal,
1873
- tokenQuoteDecimal
1874
- );
1875
- if (quoteAmount === 0 && baseAmount > 0) {
1876
- throw new Error("quoteAmount must be greater than 0");
1877
- }
1878
- let firstBuyQuoteAmount = new (0, _bnjs2.default)(
1879
- new (0, _decimaljs2.default)(quoteAmount).mul(new (0, _decimaljs2.default)(10).pow(tokenQuoteDecimal)).toNumber()
1880
- );
1881
- let firstBuyBaseAmount = new (0, _bnjs2.default)(baseAmount).mul(
1882
- new (0, _bnjs2.default)(10).pow(new (0, _bnjs2.default)(tokenBaseDecimal))
1883
- );
1884
- const cliffFeeNumerator = bpsToFeeNumerator(startingFeeBps);
1885
- let quoteAmountAfterFee = firstBuyQuoteAmount.mul(new (0, _bnjs2.default)(FEE_DENOMINATOR).sub(cliffFeeNumerator)).div(new (0, _bnjs2.default)(FEE_DENOMINATOR));
1886
- let p0 = quoteAmountAfterFee.shln(128).div(firstBuyBaseAmount).div(pMin);
1887
- let l0 = quoteAmountAfterFee.shln(128).div(pMin.sub(p0));
1888
- if (pMin.lt(p0)) {
1889
- throw Error("first price is greater than initial market cap");
1890
- }
1891
- let curve = [
1892
- {
1893
- sqrtPrice: pMin,
1894
- liquidity: l0
1895
- }
1896
- ];
1897
- let priceRatio = new (0, _decimaljs2.default)(pMax.toString()).div(
1898
- new (0, _decimaljs2.default)(pMin.toString())
1899
- );
1900
- let qDecimal = priceRatio.pow(new (0, _decimaljs2.default)(1).div(new (0, _decimaljs2.default)(15)));
1901
- let sqrtPrices = [];
1902
- let currentPrice = pMin;
1903
- for (let i = 0; i < 16; i++) {
1904
- sqrtPrices.push(currentPrice);
1905
- currentPrice = convertDecimalToBN(
1906
- qDecimal.mul(new (0, _decimaljs2.default)(currentPrice.toString()))
1907
- );
1908
- }
1909
- let totalSupply = new (0, _bnjs2.default)(totalTokenSupply).mul(
1910
- new (0, _bnjs2.default)(10).pow(new (0, _bnjs2.default)(tokenBaseDecimal))
1911
- );
1912
- let totalLeftover = new (0, _bnjs2.default)(leftover).mul(
1913
- new (0, _bnjs2.default)(10).pow(new (0, _bnjs2.default)(tokenBaseDecimal))
1914
- );
1915
- let totalVestingAmount = getTotalVestingAmount(lockedVesting);
1916
- let totalSwapAndMigrationAmount = totalSupply.sub(totalVestingAmount).sub(totalLeftover);
1917
- let totalSwapAndMigrationAmountAfterFirstBuyAmount = totalSwapAndMigrationAmount.sub(firstBuyBaseAmount);
1918
- let sumFactor = new (0, _decimaljs2.default)(0);
1919
- let pmaxWeight = new (0, _decimaljs2.default)(pMax.toString());
1920
- for (let i = 1; i < 16; i++) {
1921
- let pi = new (0, _decimaljs2.default)(sqrtPrices[i].toString());
1922
- let piMinus = new (0, _decimaljs2.default)(sqrtPrices[i - 1].toString());
1923
- let k = new (0, _decimaljs2.default)(liquidityWeights[i - 1]);
1924
- let w1 = pi.sub(piMinus).div(pi.mul(piMinus));
1925
- let w2 = pi.sub(piMinus).div(pmaxWeight.mul(pmaxWeight));
1926
- let weight = k.mul(w1.add(w2));
1927
- sumFactor = sumFactor.add(weight);
1928
- }
1929
- let l1 = new (0, _decimaljs2.default)(
1930
- totalSwapAndMigrationAmountAfterFirstBuyAmount.toString()
1931
- ).div(sumFactor);
1932
- for (let i = 0; i < 15; i++) {
1933
- let k = new (0, _decimaljs2.default)(liquidityWeights[i]);
1934
- let liquidity = convertDecimalToBN(l1.mul(k));
1935
- let sqrtPrice = i < 15 ? sqrtPrices[i + 1] : pMax;
1936
- curve.push({
1937
- sqrtPrice,
1938
- liquidity
1939
- });
1940
- }
1941
- let swapBaseAmount = getBaseTokenForSwap(p0, pMax, curve);
1942
- let swapBaseAmountBuffer = getSwapAmountWithBuffer(
1943
- swapBaseAmount,
1944
- p0,
1945
- curve
1946
- );
1947
- let migrationAmount = totalSwapAndMigrationAmount.sub(swapBaseAmountBuffer);
1948
- let migrationQuoteThreshold = migrationAmount.mul(pMax).mul(pMax).shrn(128);
1949
- let totalDynamicSupply = getTotalSupplyFromCurve(
1950
- migrationQuoteThreshold,
1951
- p0,
1952
1888
  curve,
1953
- lockedVesting,
1954
- migrationOption,
1955
- totalLeftover
1956
- );
1957
- if (totalDynamicSupply.gt(totalSupply)) {
1958
- let leftOverDelta = totalDynamicSupply.sub(totalSupply);
1959
- if (!leftOverDelta.lt(totalLeftover)) {
1960
- throw new Error("leftOverDelta must be less than totalLeftover");
1961
- }
1962
- }
1963
- const instructionParams = {
1964
- poolFees: {
1965
- baseFee: {
1966
- ...baseFeeParams
1967
- },
1968
- dynamicFee: dynamicFeeEnabled ? getDynamicFeeParams(endingFeeBps) : null
1969
- },
1970
- activationType,
1971
- collectFeeMode,
1972
- migrationOption,
1973
- tokenType,
1974
- tokenDecimal: tokenBaseDecimal,
1975
- migrationQuoteThreshold,
1976
- partnerLpPercentage,
1977
- creatorLpPercentage,
1978
- partnerLockedLpPercentage,
1979
- creatorLockedLpPercentage,
1980
- sqrtStartPrice: p0,
1981
- lockedVesting,
1982
- migrationFeeOption,
1983
- tokenSupply: {
1984
- preMigrationTokenSupply: totalSupply,
1985
- postMigrationTokenSupply: totalSupply
1986
- },
1987
- creatorTradingFeePercentage,
1988
- padding0: [],
1989
- padding1: [],
1990
- curve
1889
+ migrationFee,
1890
+ tokenUpdateAuthority
1991
1891
  };
1992
1892
  return instructionParams;
1993
1893
  }
@@ -2000,7 +1900,7 @@ var idl_default = {
2000
1900
  address: "dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN",
2001
1901
  metadata: {
2002
1902
  name: "dynamic_bonding_curve",
2003
- version: "0.1.0",
1903
+ version: "0.1.2",
2004
1904
  spec: "0.1.0",
2005
1905
  description: "Created with Anchor"
2006
1906
  },
@@ -4994,6 +4894,74 @@ var idl_default = {
4994
4894
  }
4995
4895
  ]
4996
4896
  },
4897
+ {
4898
+ name: "transfer_pool_creator",
4899
+ discriminator: [
4900
+ 20,
4901
+ 7,
4902
+ 169,
4903
+ 33,
4904
+ 58,
4905
+ 147,
4906
+ 166,
4907
+ 33
4908
+ ],
4909
+ accounts: [
4910
+ {
4911
+ name: "virtual_pool",
4912
+ writable: true
4913
+ },
4914
+ {
4915
+ name: "config",
4916
+ relations: [
4917
+ "virtual_pool"
4918
+ ]
4919
+ },
4920
+ {
4921
+ name: "creator",
4922
+ signer: true,
4923
+ relations: [
4924
+ "virtual_pool"
4925
+ ]
4926
+ },
4927
+ {
4928
+ name: "new_creator"
4929
+ },
4930
+ {
4931
+ name: "event_authority",
4932
+ pda: {
4933
+ seeds: [
4934
+ {
4935
+ kind: "const",
4936
+ value: [
4937
+ 95,
4938
+ 95,
4939
+ 101,
4940
+ 118,
4941
+ 101,
4942
+ 110,
4943
+ 116,
4944
+ 95,
4945
+ 97,
4946
+ 117,
4947
+ 116,
4948
+ 104,
4949
+ 111,
4950
+ 114,
4951
+ 105,
4952
+ 116,
4953
+ 121
4954
+ ]
4955
+ }
4956
+ ]
4957
+ }
4958
+ },
4959
+ {
4960
+ name: "program"
4961
+ }
4962
+ ],
4963
+ args: []
4964
+ },
4997
4965
  {
4998
4966
  name: "withdraw_leftover",
4999
4967
  discriminator: [
@@ -5082,7 +5050,110 @@ var idl_default = {
5082
5050
  }
5083
5051
  },
5084
5052
  {
5085
- name: "base_vault",
5053
+ name: "base_vault",
5054
+ docs: [
5055
+ "The vault token account for output token"
5056
+ ],
5057
+ writable: true,
5058
+ relations: [
5059
+ "virtual_pool"
5060
+ ]
5061
+ },
5062
+ {
5063
+ name: "base_mint",
5064
+ docs: [
5065
+ "The mint of quote token"
5066
+ ],
5067
+ relations: [
5068
+ "virtual_pool"
5069
+ ]
5070
+ },
5071
+ {
5072
+ name: "leftover_receiver",
5073
+ relations: [
5074
+ "config"
5075
+ ]
5076
+ },
5077
+ {
5078
+ name: "token_base_program",
5079
+ docs: [
5080
+ "Token base program"
5081
+ ]
5082
+ },
5083
+ {
5084
+ name: "event_authority",
5085
+ pda: {
5086
+ seeds: [
5087
+ {
5088
+ kind: "const",
5089
+ value: [
5090
+ 95,
5091
+ 95,
5092
+ 101,
5093
+ 118,
5094
+ 101,
5095
+ 110,
5096
+ 116,
5097
+ 95,
5098
+ 97,
5099
+ 117,
5100
+ 116,
5101
+ 104,
5102
+ 111,
5103
+ 114,
5104
+ 105,
5105
+ 116,
5106
+ 121
5107
+ ]
5108
+ }
5109
+ ]
5110
+ }
5111
+ },
5112
+ {
5113
+ name: "program"
5114
+ }
5115
+ ],
5116
+ args: []
5117
+ },
5118
+ {
5119
+ name: "withdraw_migration_fee",
5120
+ docs: [
5121
+ "BOTH partner and creator FUNCTIONS ///"
5122
+ ],
5123
+ discriminator: [
5124
+ 237,
5125
+ 142,
5126
+ 45,
5127
+ 23,
5128
+ 129,
5129
+ 6,
5130
+ 222,
5131
+ 162
5132
+ ],
5133
+ accounts: [
5134
+ {
5135
+ name: "pool_authority",
5136
+ address: "FhVo3mqL8PW5pH5U2CN4XE33DokiyZnUwuGpH2hmHLuM"
5137
+ },
5138
+ {
5139
+ name: "config",
5140
+ relations: [
5141
+ "virtual_pool"
5142
+ ]
5143
+ },
5144
+ {
5145
+ name: "virtual_pool",
5146
+ writable: true
5147
+ },
5148
+ {
5149
+ name: "token_quote_account",
5150
+ docs: [
5151
+ "The receiver token account"
5152
+ ],
5153
+ writable: true
5154
+ },
5155
+ {
5156
+ name: "quote_vault",
5086
5157
  docs: [
5087
5158
  "The vault token account for output token"
5088
5159
  ],
@@ -5092,24 +5163,22 @@ var idl_default = {
5092
5163
  ]
5093
5164
  },
5094
5165
  {
5095
- name: "base_mint",
5166
+ name: "quote_mint",
5096
5167
  docs: [
5097
5168
  "The mint of quote token"
5098
5169
  ],
5099
5170
  relations: [
5100
- "virtual_pool"
5171
+ "config"
5101
5172
  ]
5102
5173
  },
5103
5174
  {
5104
- name: "leftover_receiver",
5105
- relations: [
5106
- "config"
5107
- ]
5175
+ name: "sender",
5176
+ signer: true
5108
5177
  },
5109
5178
  {
5110
- name: "token_base_program",
5179
+ name: "token_quote_program",
5111
5180
  docs: [
5112
- "Token base program"
5181
+ "Token b program"
5113
5182
  ]
5114
5183
  },
5115
5184
  {
@@ -5145,7 +5214,12 @@ var idl_default = {
5145
5214
  name: "program"
5146
5215
  }
5147
5216
  ],
5148
- args: []
5217
+ args: [
5218
+ {
5219
+ name: "flag",
5220
+ type: "u8"
5221
+ }
5222
+ ]
5149
5223
  }
5150
5224
  ],
5151
5225
  accounts: [
@@ -5424,6 +5498,19 @@ var idl_default = {
5424
5498
  150
5425
5499
  ]
5426
5500
  },
5501
+ {
5502
+ name: "EvtPartnerWithdrawMigrationFee",
5503
+ discriminator: [
5504
+ 181,
5505
+ 105,
5506
+ 127,
5507
+ 67,
5508
+ 8,
5509
+ 187,
5510
+ 120,
5511
+ 57
5512
+ ]
5513
+ },
5427
5514
  {
5428
5515
  name: "EvtPartnerWithdrawSurplus",
5429
5516
  discriminator: [
@@ -5463,6 +5550,19 @@ var idl_default = {
5463
5550
  147
5464
5551
  ]
5465
5552
  },
5553
+ {
5554
+ name: "EvtUpdatePoolCreator",
5555
+ discriminator: [
5556
+ 107,
5557
+ 225,
5558
+ 165,
5559
+ 237,
5560
+ 91,
5561
+ 158,
5562
+ 213,
5563
+ 220
5564
+ ]
5565
+ },
5466
5566
  {
5467
5567
  name: "EvtVirtualPoolMetadata",
5468
5568
  discriminator: [
@@ -5488,6 +5588,19 @@ var idl_default = {
5488
5588
  94,
5489
5589
  229
5490
5590
  ]
5591
+ },
5592
+ {
5593
+ name: "EvtWithdrawMigrationFee",
5594
+ discriminator: [
5595
+ 26,
5596
+ 203,
5597
+ 84,
5598
+ 85,
5599
+ 161,
5600
+ 23,
5601
+ 100,
5602
+ 214
5603
+ ]
5491
5604
  }
5492
5605
  ],
5493
5606
  errors: [
@@ -5670,6 +5783,31 @@ var idl_default = {
5670
5783
  code: 6035,
5671
5784
  name: "InvalidCreatorTradingFeePercentage",
5672
5785
  msg: "Invalid creator trading fee percentage"
5786
+ },
5787
+ {
5788
+ code: 6036,
5789
+ name: "InvalidNewCreator",
5790
+ msg: "Invalid new creator"
5791
+ },
5792
+ {
5793
+ code: 6037,
5794
+ name: "InvalidTokenUpdateAuthorityOption",
5795
+ msg: "Invalid token update authority option"
5796
+ },
5797
+ {
5798
+ code: 6038,
5799
+ name: "InvalidAccount",
5800
+ msg: "Invalid account for the instruction"
5801
+ },
5802
+ {
5803
+ code: 6039,
5804
+ name: "InvalidMigratorFeePercentage",
5805
+ msg: "Invalid migrator fee percentage"
5806
+ },
5807
+ {
5808
+ code: 6040,
5809
+ name: "MigrationFeeHasBeenWithdraw",
5810
+ msg: "Migration fee has been withdraw"
5673
5811
  }
5674
5812
  ],
5675
5813
  types: [
@@ -5904,12 +6042,24 @@ var idl_default = {
5904
6042
  name: "creator_trading_fee_percentage",
5905
6043
  type: "u8"
5906
6044
  },
6045
+ {
6046
+ name: "token_update_authority",
6047
+ type: "u8"
6048
+ },
6049
+ {
6050
+ name: "migration_fee",
6051
+ type: {
6052
+ defined: {
6053
+ name: "MigrationFee"
6054
+ }
6055
+ }
6056
+ },
5907
6057
  {
5908
6058
  name: "padding_0",
5909
6059
  type: {
5910
6060
  array: [
5911
6061
  "u8",
5912
- 7
6062
+ 4
5913
6063
  ]
5914
6064
  }
5915
6065
  },
@@ -6424,6 +6574,22 @@ var idl_default = {
6424
6574
  ]
6425
6575
  }
6426
6576
  },
6577
+ {
6578
+ name: "EvtPartnerWithdrawMigrationFee",
6579
+ type: {
6580
+ kind: "struct",
6581
+ fields: [
6582
+ {
6583
+ name: "pool",
6584
+ type: "pubkey"
6585
+ },
6586
+ {
6587
+ name: "fee",
6588
+ type: "u64"
6589
+ }
6590
+ ]
6591
+ }
6592
+ },
6427
6593
  {
6428
6594
  name: "EvtPartnerWithdrawSurplus",
6429
6595
  type: {
@@ -6504,6 +6670,26 @@ var idl_default = {
6504
6670
  ]
6505
6671
  }
6506
6672
  },
6673
+ {
6674
+ name: "EvtUpdatePoolCreator",
6675
+ type: {
6676
+ kind: "struct",
6677
+ fields: [
6678
+ {
6679
+ name: "pool",
6680
+ type: "pubkey"
6681
+ },
6682
+ {
6683
+ name: "creator",
6684
+ type: "pubkey"
6685
+ },
6686
+ {
6687
+ name: "new_creator",
6688
+ type: "pubkey"
6689
+ }
6690
+ ]
6691
+ }
6692
+ },
6507
6693
  {
6508
6694
  name: "EvtVirtualPoolMetadata",
6509
6695
  docs: [
@@ -6543,6 +6729,26 @@ var idl_default = {
6543
6729
  ]
6544
6730
  }
6545
6731
  },
6732
+ {
6733
+ name: "EvtWithdrawMigrationFee",
6734
+ type: {
6735
+ kind: "struct",
6736
+ fields: [
6737
+ {
6738
+ name: "pool",
6739
+ type: "pubkey"
6740
+ },
6741
+ {
6742
+ name: "fee",
6743
+ type: "u64"
6744
+ },
6745
+ {
6746
+ name: "flag",
6747
+ type: "u8"
6748
+ }
6749
+ ]
6750
+ }
6751
+ },
6546
6752
  {
6547
6753
  name: "InitializePoolParameters",
6548
6754
  type: {
@@ -6727,11 +6933,16 @@ var idl_default = {
6727
6933
  type: "pubkey"
6728
6934
  },
6729
6935
  {
6730
- name: "pool_creator",
6936
+ name: "padding_0",
6731
6937
  docs: [
6732
- "pool creator"
6938
+ "!!! BE CAREFUL to use tomestone field, previous is pool creator"
6733
6939
  ],
6734
- type: "pubkey"
6940
+ type: {
6941
+ array: [
6942
+ "u8",
6943
+ 32
6944
+ ]
6945
+ }
6735
6946
  },
6736
6947
  {
6737
6948
  name: "partner",
@@ -6842,11 +7053,16 @@ var idl_default = {
6842
7053
  type: "pubkey"
6843
7054
  },
6844
7055
  {
6845
- name: "pool_creator",
7056
+ name: "padding_0",
6846
7057
  docs: [
6847
- "pool creator"
7058
+ "!!! BE CAREFUL to use tomestone field, previous is pool creator"
6848
7059
  ],
6849
- type: "pubkey"
7060
+ type: {
7061
+ array: [
7062
+ "u8",
7063
+ 32
7064
+ ]
7065
+ }
6850
7066
  },
6851
7067
  {
6852
7068
  name: "partner",
@@ -6870,6 +7086,22 @@ var idl_default = {
6870
7086
  ]
6871
7087
  }
6872
7088
  },
7089
+ {
7090
+ name: "MigrationFee",
7091
+ type: {
7092
+ kind: "struct",
7093
+ fields: [
7094
+ {
7095
+ name: "fee_percentage",
7096
+ type: "u8"
7097
+ },
7098
+ {
7099
+ name: "creator_fee_percentage",
7100
+ type: "u8"
7101
+ }
7102
+ ]
7103
+ }
7104
+ },
6873
7105
  {
6874
7106
  name: "PartnerMetadata",
6875
7107
  docs: [
@@ -7061,16 +7293,25 @@ var idl_default = {
7061
7293
  type: "u8"
7062
7294
  },
7063
7295
  {
7064
- name: "_padding_0",
7296
+ name: "token_update_authority",
7065
7297
  docs: [
7066
- "padding 0"
7298
+ "token update authority"
7067
7299
  ],
7068
- type: {
7069
- array: [
7070
- "u8",
7071
- 2
7072
- ]
7073
- }
7300
+ type: "u8"
7301
+ },
7302
+ {
7303
+ name: "migration_fee_percentage",
7304
+ docs: [
7305
+ "migration fee percentage"
7306
+ ],
7307
+ type: "u8"
7308
+ },
7309
+ {
7310
+ name: "creator_migration_fee_percentage",
7311
+ docs: [
7312
+ "creator migration fee percentage"
7313
+ ],
7314
+ type: "u8"
7074
7315
  },
7075
7316
  {
7076
7317
  name: "_padding_1",
@@ -7080,7 +7321,7 @@ var idl_default = {
7080
7321
  type: {
7081
7322
  array: [
7082
7323
  "u8",
7083
- 8
7324
+ 7
7084
7325
  ]
7085
7326
  }
7086
7327
  },
@@ -7385,7 +7626,9 @@ var idl_default = {
7385
7626
  {
7386
7627
  name: "post_migration_token_supply",
7387
7628
  docs: [
7388
- "post migration token supply"
7629
+ "post migration token supply",
7630
+ "becase DBC allow user to swap over the migration quote threshold, so in extreme case user may swap more than allowed buffer on curve",
7631
+ "that result the total supply in post migration may be increased a bit (between pre_migration_token_supply and post_migration_token_supply)"
7389
7632
  ],
7390
7633
  type: "u64"
7391
7634
  }
@@ -7553,16 +7796,11 @@ var idl_default = {
7553
7796
  type: "u8"
7554
7797
  },
7555
7798
  {
7556
- name: "_padding_0",
7799
+ name: "migration_fee_withdraw_status",
7557
7800
  docs: [
7558
- "padding"
7801
+ "migration fee withdraw status, first bit is for partner, second bit is for creator"
7559
7802
  ],
7560
- type: {
7561
- array: [
7562
- "u8",
7563
- 1
7564
- ]
7565
- }
7803
+ type: "u8"
7566
7804
  },
7567
7805
  {
7568
7806
  name: "metrics",
@@ -22182,7 +22420,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
22182
22420
  lockDammV1LpTokenParam.payer,
22183
22421
  dammPool,
22184
22422
  lpMint,
22185
- dammV1MigrationMetadata.poolCreator,
22423
+ poolState.creator,
22186
22424
  lockEscrowKey,
22187
22425
  dammV1Program
22188
22426
  );
@@ -22217,7 +22455,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
22217
22455
  pool: dammPool,
22218
22456
  lpMint,
22219
22457
  lockEscrow: lockEscrowKey,
22220
- owner: lockDammV1LpTokenParam.isPartner ? dammV1MigrationMetadata.partner : dammV1MigrationMetadata.poolCreator,
22458
+ owner: lockDammV1LpTokenParam.isPartner ? dammV1MigrationMetadata.partner : poolState.creator,
22221
22459
  sourceTokens,
22222
22460
  escrowVault,
22223
22461
  aVault,
@@ -22267,7 +22505,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
22267
22505
  );
22268
22506
  } else {
22269
22507
  destinationToken = findAssociatedTokenAddress(
22270
- dammV1MigrationMetadata.poolCreator,
22508
+ virtualPoolState.creator,
22271
22509
  lpMint,
22272
22510
  _spltoken.TOKEN_PROGRAM_ID
22273
22511
  );
@@ -22276,7 +22514,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
22276
22514
  const createDestinationTokenIx = _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
22277
22515
  claimDammV1LpTokenParam.payer,
22278
22516
  destinationToken,
22279
- claimDammV1LpTokenParam.isPartner ? dammV1MigrationMetadata.partner : dammV1MigrationMetadata.poolCreator,
22517
+ claimDammV1LpTokenParam.isPartner ? dammV1MigrationMetadata.partner : virtualPoolState.creator,
22280
22518
  lpMint,
22281
22519
  _spltoken.TOKEN_PROGRAM_ID
22282
22520
  );
@@ -22293,7 +22531,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
22293
22531
  lpMint,
22294
22532
  sourceToken,
22295
22533
  destinationToken,
22296
- owner: claimDammV1LpTokenParam.isPartner ? dammV1MigrationMetadata.partner : dammV1MigrationMetadata.poolCreator,
22534
+ owner: claimDammV1LpTokenParam.isPartner ? dammV1MigrationMetadata.partner : virtualPoolState.creator,
22297
22535
  sender: claimDammV1LpTokenParam.payer,
22298
22536
  tokenProgram: _spltoken.TOKEN_PROGRAM_ID
22299
22537
  };
@@ -22689,6 +22927,37 @@ var PartnerService = class extends DynamicBondingCurveProgram {
22689
22927
  tokenQuoteProgram
22690
22928
  }).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
22691
22929
  }
22930
+ async withdrawMigrationFee(withdrawMigrationFeeParams) {
22931
+ const { virtualPool, sender, feePayer } = withdrawMigrationFeeParams;
22932
+ const virtualPoolState = await this.state.getPool(virtualPool);
22933
+ const configState = await this.state.getPoolConfig(
22934
+ virtualPoolState.config
22935
+ );
22936
+ const { ataPubkey: tokenQuoteAccount, ix: preInstruction } = await getOrCreateATAInstruction(
22937
+ this.program.provider.connection,
22938
+ configState.quoteMint,
22939
+ sender,
22940
+ _nullishCoalesce(feePayer, () => ( sender)),
22941
+ true,
22942
+ getTokenProgram(configState.quoteTokenFlag)
22943
+ );
22944
+ const postInstruction = [];
22945
+ if (configState.quoteMint.equals(_spltoken.NATIVE_MINT)) {
22946
+ const unwarpSOLIx = unwrapSOLInstruction(sender, sender);
22947
+ unwarpSOLIx && postInstruction.push(unwarpSOLIx);
22948
+ }
22949
+ const transaction = await this.program.methods.withdrawMigrationFee(0).accountsPartial({
22950
+ poolAuthority: this.poolAuthority,
22951
+ config: virtualPoolState.config,
22952
+ virtualPool,
22953
+ tokenQuoteAccount,
22954
+ quoteVault: virtualPoolState.quoteVault,
22955
+ quoteMint: configState.quoteMint,
22956
+ sender,
22957
+ tokenQuoteProgram: getTokenProgram(configState.quoteTokenFlag)
22958
+ }).preInstructions([preInstruction]).postInstructions(postInstruction).transaction();
22959
+ return transaction;
22960
+ }
22692
22961
  };
22693
22962
 
22694
22963
  // src/services/creator.ts
@@ -22699,6 +22968,7 @@ var PartnerService = class extends DynamicBondingCurveProgram {
22699
22968
 
22700
22969
 
22701
22970
 
22971
+
22702
22972
  var CreatorService = class extends DynamicBondingCurveProgram {
22703
22973
  constructor(connection, commitment) {
22704
22974
  super(connection, commitment);
@@ -22938,6 +23208,55 @@ var CreatorService = class extends DynamicBondingCurveProgram {
22938
23208
  };
22939
23209
  return this.program.methods.creatorWithdrawSurplus().accountsPartial(accounts).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
22940
23210
  }
23211
+ async transferPoolCreator(transferPoolCreatorParams) {
23212
+ const { virtualPool, creator, newCreator } = transferPoolCreatorParams;
23213
+ const virtualPoolState = await this.state.getPool(virtualPool);
23214
+ const migrationMetadata = deriveDammV1MigrationMetadataAddress(virtualPool);
23215
+ const transaction = await this.program.methods.transferPoolCreator().accountsPartial({
23216
+ virtualPool,
23217
+ newCreator,
23218
+ config: virtualPoolState.config,
23219
+ creator
23220
+ }).remainingAccounts([
23221
+ {
23222
+ isSigner: false,
23223
+ isWritable: false,
23224
+ pubkey: migrationMetadata
23225
+ }
23226
+ ]).transaction();
23227
+ return transaction;
23228
+ }
23229
+ async withdrawMigrationFee(withdrawMigrationFeeParams) {
23230
+ const { virtualPool, sender, feePayer } = withdrawMigrationFeeParams;
23231
+ const virtualPoolState = await this.state.getPool(virtualPool);
23232
+ const configState = await this.state.getPoolConfig(
23233
+ virtualPoolState.config
23234
+ );
23235
+ const { ataPubkey: tokenQuoteAccount, ix: preInstruction } = await getOrCreateATAInstruction(
23236
+ this.program.provider.connection,
23237
+ configState.quoteMint,
23238
+ sender,
23239
+ _nullishCoalesce(feePayer, () => ( sender)),
23240
+ true,
23241
+ getTokenProgram(configState.quoteTokenFlag)
23242
+ );
23243
+ const postInstruction = [];
23244
+ if (configState.quoteMint.equals(_spltoken.NATIVE_MINT)) {
23245
+ const unwarpSOLIx = unwrapSOLInstruction(sender, sender);
23246
+ unwarpSOLIx && postInstruction.push(unwarpSOLIx);
23247
+ }
23248
+ const transaction = await this.program.methods.withdrawMigrationFee(1).accountsPartial({
23249
+ poolAuthority: this.poolAuthority,
23250
+ config: virtualPoolState.config,
23251
+ virtualPool,
23252
+ tokenQuoteAccount,
23253
+ quoteVault: virtualPoolState.quoteVault,
23254
+ quoteMint: configState.quoteMint,
23255
+ sender,
23256
+ tokenQuoteProgram: getTokenProgram(configState.quoteTokenFlag)
23257
+ }).preInstructions([preInstruction]).postInstructions(postInstruction).transaction();
23258
+ return transaction;
23259
+ }
22941
23260
  };
22942
23261
 
22943
23262
  // src/client.ts
@@ -23118,5 +23437,9 @@ var DynamicBondingCurveClient = class _DynamicBondingCurveClient {
23118
23437
 
23119
23438
 
23120
23439
 
23121
- exports.ActivationType = ActivationType; exports.BASE_ADDRESS = BASE_ADDRESS; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_STEP_BPS_DEFAULT = BIN_STEP_BPS_DEFAULT; exports.BIN_STEP_BPS_U128_DEFAULT = BIN_STEP_BPS_U128_DEFAULT; exports.CollectFeeMode = CollectFeeMode; exports.CreatorService = CreatorService; exports.DAMM_V1_MIGRATION_FEE_ADDRESS = DAMM_V1_MIGRATION_FEE_ADDRESS; exports.DAMM_V1_PROGRAM_ID = DAMM_V1_PROGRAM_ID; exports.DAMM_V2_MIGRATION_FEE_ADDRESS = DAMM_V2_MIGRATION_FEE_ADDRESS; exports.DAMM_V2_PROGRAM_ID = DAMM_V2_PROGRAM_ID; exports.DYNAMIC_BONDING_CURVE_PROGRAM_ID = DYNAMIC_BONDING_CURVE_PROGRAM_ID; exports.DYNAMIC_FEE_DECAY_PERIOD_DEFAULT = DYNAMIC_FEE_DECAY_PERIOD_DEFAULT; exports.DYNAMIC_FEE_FILTER_PERIOD_DEFAULT = DYNAMIC_FEE_FILTER_PERIOD_DEFAULT; exports.DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT = DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT; exports.DynamicBondingCurveClient = DynamicBondingCurveClient; exports.DynamicBondingCurveProgram = DynamicBondingCurveProgram; exports.FEE_DENOMINATOR = FEE_DENOMINATOR; exports.FeeSchedulerMode = FeeSchedulerMode; exports.GetFeeMode = GetFeeMode; exports.LOCKER_PROGRAM_ID = LOCKER_PROGRAM_ID; exports.MAX_CURVE_POINT = MAX_CURVE_POINT; exports.MAX_FEE_NUMERATOR = MAX_FEE_NUMERATOR; exports.MAX_PRICE_CHANGE_BPS_DEFAULT = MAX_PRICE_CHANGE_BPS_DEFAULT; exports.MAX_SQRT_PRICE = MAX_SQRT_PRICE; exports.MAX_SWALLOW_PERCENTAGE = MAX_SWALLOW_PERCENTAGE; exports.METAPLEX_PROGRAM_ID = METAPLEX_PROGRAM_ID; exports.MIN_SQRT_PRICE = MIN_SQRT_PRICE; exports.MigrationFeeOption = MigrationFeeOption; exports.MigrationOption = MigrationOption; exports.MigrationService = MigrationService; exports.OFFSET = OFFSET; exports.ONE_Q64 = ONE_Q64; exports.PARTNER_SURPLUS_SHARE = PARTNER_SURPLUS_SHARE; exports.PartnerService = PartnerService; exports.PoolService = PoolService; exports.RESOLUTION = RESOLUTION; exports.Rounding = Rounding; exports.SLOT_DURATION = SLOT_DURATION; exports.SWAP_BUFFER_PERCENTAGE = SWAP_BUFFER_PERCENTAGE; exports.TIMESTAMP_DURATION = TIMESTAMP_DURATION; exports.TokenDecimal = TokenDecimal; exports.TokenType = TokenType; exports.TradeDirection = TradeDirection; exports.U64_MAX = U64_MAX; exports.VAULT_PROGRAM_ID = VAULT_PROGRAM_ID; exports.bpsToFeeNumerator = bpsToFeeNumerator; exports.buildCurve = buildCurve; exports.buildCurveWithCreatorFirstBuy = buildCurveWithCreatorFirstBuy; exports.buildCurveWithLiquidityWeights = buildCurveWithLiquidityWeights; exports.buildCurveWithMarketCap = buildCurveWithMarketCap; exports.buildCurveWithTwoSegments = buildCurveWithTwoSegments; exports.cleanUpTokenAccountTx = cleanUpTokenAccountTx; exports.convertDecimalToBN = convertDecimalToBN; exports.createDammV1Program = createDammV1Program; exports.createDammV2Program = createDammV2Program; exports.createDbcProgram = createDbcProgram; exports.createInitializePermissionlessDynamicVaultIx = createInitializePermissionlessDynamicVaultIx; exports.createLockEscrowIx = createLockEscrowIx; exports.createProgramAccountFilter = createProgramAccountFilter; exports.createVaultProgram = createVaultProgram; exports.deriveBaseKeyForLocker = deriveBaseKeyForLocker; exports.deriveDammV1EventAuthority = deriveDammV1EventAuthority; exports.deriveDammV1LockEscrowAddress = deriveDammV1LockEscrowAddress; exports.deriveDammV1LpMintAddress = deriveDammV1LpMintAddress; exports.deriveDammV1MigrationMetadataAddress = deriveDammV1MigrationMetadataAddress; exports.deriveDammV1PoolAddress = deriveDammV1PoolAddress; exports.deriveDammV1PoolAuthority = deriveDammV1PoolAuthority; exports.deriveDammV1ProtocolFeeAddress = deriveDammV1ProtocolFeeAddress; exports.deriveDammV1VaultLPAddress = deriveDammV1VaultLPAddress; exports.deriveDammV2EventAuthority = deriveDammV2EventAuthority; exports.deriveDammV2LockEscrowAddress = deriveDammV2LockEscrowAddress; exports.deriveDammV2MigrationMetadataAddress = deriveDammV2MigrationMetadataAddress; exports.deriveDammV2PoolAddress = deriveDammV2PoolAddress; exports.deriveDammV2PoolAuthority = deriveDammV2PoolAuthority; exports.deriveDammV2TokenVaultAddress = deriveDammV2TokenVaultAddress; exports.deriveDbcEventAuthority = deriveDbcEventAuthority; exports.deriveDbcPoolAddress = deriveDbcPoolAddress; exports.deriveDbcPoolAuthority = deriveDbcPoolAuthority; exports.deriveDbcPoolMetadata = deriveDbcPoolMetadata; exports.deriveDbcTokenVaultAddress = deriveDbcTokenVaultAddress; exports.deriveEscrow = deriveEscrow; exports.deriveLockerEventAuthority = deriveLockerEventAuthority; exports.deriveMintMetadata = deriveMintMetadata; exports.derivePartnerMetadata = derivePartnerMetadata; exports.derivePositionAddress = derivePositionAddress; exports.derivePositionNftAccount = derivePositionNftAccount; exports.deriveTokenVaultKey = deriveTokenVaultKey; exports.deriveVaultAddress = deriveVaultAddress; exports.deriveVaultLpMintAddress = deriveVaultLpMintAddress; exports.deriveVaultPdas = deriveVaultPdas; exports.feeNumeratorToBps = feeNumeratorToBps; exports.findAssociatedTokenAddress = findAssociatedTokenAddress; exports.getAccountCreationTimestamp = getAccountCreationTimestamp; exports.getAccountCreationTimestamps = getAccountCreationTimestamps; exports.getAccountData = getAccountData; exports.getBaseFeeParams = getBaseFeeParams; exports.getBaseTokenForSwap = getBaseTokenForSwap; exports.getCurrentBaseFeeNumerator = getCurrentBaseFeeNumerator; exports.getDeltaAmountBase = getDeltaAmountBase; exports.getDeltaAmountBaseUnsigned = getDeltaAmountBaseUnsigned; exports.getDeltaAmountQuoteUnsigned = getDeltaAmountQuoteUnsigned; exports.getDynamicFeeParams = getDynamicFeeParams; exports.getFeeInPeriod = getFeeInPeriod; exports.getFeeMode = getFeeMode; exports.getFeeOnAmount = getFeeOnAmount; exports.getFirstCurve = getFirstCurve; exports.getFirstKey = getFirstKey; exports.getInitialLiquidityFromDeltaBase = getInitialLiquidityFromDeltaBase; exports.getInitialLiquidityFromDeltaQuote = getInitialLiquidityFromDeltaQuote; exports.getInitializeAmounts = getInitializeAmounts; exports.getLiquidity = getLiquidity; exports.getLockedVestingParams = getLockedVestingParams; exports.getMigrationBaseToken = getMigrationBaseToken; exports.getMigrationQuoteThreshold = getMigrationQuoteThreshold; exports.getMigrationThresholdPrice = getMigrationThresholdPrice; exports.getMinBaseFeeBps = getMinBaseFeeBps; exports.getNextSqrtPriceFromAmountBaseRoundingUp = getNextSqrtPriceFromAmountBaseRoundingUp; exports.getNextSqrtPriceFromAmountQuoteRoundingDown = getNextSqrtPriceFromAmountQuoteRoundingDown; exports.getNextSqrtPriceFromInput = getNextSqrtPriceFromInput; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getPercentageSupplyOnMigration = getPercentageSupplyOnMigration; exports.getPriceFromSqrtPrice = getPriceFromSqrtPrice; exports.getSecondKey = getSecondKey; exports.getSqrtPriceFromMarketCap = getSqrtPriceFromMarketCap; exports.getSqrtPriceFromPrice = getSqrtPriceFromPrice; exports.getSwapAmountFromBaseToQuote = getSwapAmountFromBaseToQuote; exports.getSwapAmountFromQuoteToBase = getSwapAmountFromQuoteToBase; exports.getSwapAmountWithBuffer = getSwapAmountWithBuffer; exports.getSwapResult = getSwapResult; exports.getTokenDecimals = getTokenDecimals; exports.getTokenProgram = getTokenProgram; exports.getTokenType = getTokenType; exports.getTotalSupplyFromCurve = getTotalSupplyFromCurve; exports.getTotalTokenSupply = getTotalTokenSupply; exports.getTotalVestingAmount = getTotalVestingAmount; exports.getTwoCurve = getTwoCurve; exports.getVariableFee = getVariableFee; exports.isDefaultLockedVesting = isDefaultLockedVesting; exports.isNativeSol = isNativeSol; exports.prepareTokenAccountTx = prepareTokenAccountTx; exports.swapQuote = swapQuote; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.validateActivationType = validateActivationType; exports.validateBalance = validateBalance; exports.validateBaseTokenType = validateBaseTokenType; exports.validateCollectFeeMode = validateCollectFeeMode; exports.validateConfigParameters = validateConfigParameters; exports.validateCurve = validateCurve; exports.validateLPPercentages = validateLPPercentages; exports.validateMigrationAndTokenType = validateMigrationAndTokenType; exports.validateMigrationFeeOption = validateMigrationFeeOption; exports.validatePoolFees = validatePoolFees; exports.validateSwapAmount = validateSwapAmount; exports.validateTokenDecimals = validateTokenDecimals; exports.validateTokenSupply = validateTokenSupply; exports.wrapSOLInstruction = wrapSOLInstruction;
23440
+
23441
+
23442
+
23443
+
23444
+ exports.ActivationType = ActivationType; exports.BASE_ADDRESS = BASE_ADDRESS; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_STEP_BPS_DEFAULT = BIN_STEP_BPS_DEFAULT; exports.BIN_STEP_BPS_U128_DEFAULT = BIN_STEP_BPS_U128_DEFAULT; exports.CollectFeeMode = CollectFeeMode; exports.CreatorService = CreatorService; exports.DAMM_V1_MIGRATION_FEE_ADDRESS = DAMM_V1_MIGRATION_FEE_ADDRESS; exports.DAMM_V1_PROGRAM_ID = DAMM_V1_PROGRAM_ID; exports.DAMM_V2_MIGRATION_FEE_ADDRESS = DAMM_V2_MIGRATION_FEE_ADDRESS; exports.DAMM_V2_PROGRAM_ID = DAMM_V2_PROGRAM_ID; exports.DYNAMIC_BONDING_CURVE_PROGRAM_ID = DYNAMIC_BONDING_CURVE_PROGRAM_ID; exports.DYNAMIC_FEE_DECAY_PERIOD_DEFAULT = DYNAMIC_FEE_DECAY_PERIOD_DEFAULT; exports.DYNAMIC_FEE_FILTER_PERIOD_DEFAULT = DYNAMIC_FEE_FILTER_PERIOD_DEFAULT; exports.DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT = DYNAMIC_FEE_REDUCTION_FACTOR_DEFAULT; exports.DynamicBondingCurveClient = DynamicBondingCurveClient; exports.DynamicBondingCurveProgram = DynamicBondingCurveProgram; exports.FEE_DENOMINATOR = FEE_DENOMINATOR; exports.FeeSchedulerMode = FeeSchedulerMode; exports.GetFeeMode = GetFeeMode; exports.LOCKER_PROGRAM_ID = LOCKER_PROGRAM_ID; exports.MAX_CURVE_POINT = MAX_CURVE_POINT; exports.MAX_FEE_NUMERATOR = MAX_FEE_NUMERATOR; exports.MAX_PRICE_CHANGE_BPS_DEFAULT = MAX_PRICE_CHANGE_BPS_DEFAULT; exports.MAX_SQRT_PRICE = MAX_SQRT_PRICE; exports.MAX_SWALLOW_PERCENTAGE = MAX_SWALLOW_PERCENTAGE; exports.METAPLEX_PROGRAM_ID = METAPLEX_PROGRAM_ID; exports.MIN_SQRT_PRICE = MIN_SQRT_PRICE; exports.MigrationFeeOption = MigrationFeeOption; exports.MigrationOption = MigrationOption; exports.MigrationService = MigrationService; exports.OFFSET = OFFSET; exports.ONE_Q64 = ONE_Q64; exports.PARTNER_SURPLUS_SHARE = PARTNER_SURPLUS_SHARE; exports.PartnerService = PartnerService; exports.PoolService = PoolService; exports.RESOLUTION = RESOLUTION; exports.Rounding = Rounding; exports.SLOT_DURATION = SLOT_DURATION; exports.SWAP_BUFFER_PERCENTAGE = SWAP_BUFFER_PERCENTAGE; exports.TIMESTAMP_DURATION = TIMESTAMP_DURATION; exports.TokenDecimal = TokenDecimal; exports.TokenType = TokenType; exports.TokenUpdateAuthorityOption = TokenUpdateAuthorityOption; exports.TradeDirection = TradeDirection; exports.U64_MAX = U64_MAX; exports.VAULT_PROGRAM_ID = VAULT_PROGRAM_ID; exports.bpsToFeeNumerator = bpsToFeeNumerator; exports.buildCurve = buildCurve; exports.buildCurveWithLiquidityWeights = buildCurveWithLiquidityWeights; exports.buildCurveWithMarketCap = buildCurveWithMarketCap; exports.buildCurveWithTwoSegments = buildCurveWithTwoSegments; exports.cleanUpTokenAccountTx = cleanUpTokenAccountTx; exports.convertDecimalToBN = convertDecimalToBN; exports.createDammV1Program = createDammV1Program; exports.createDammV2Program = createDammV2Program; exports.createDbcProgram = createDbcProgram; exports.createInitializePermissionlessDynamicVaultIx = createInitializePermissionlessDynamicVaultIx; exports.createLockEscrowIx = createLockEscrowIx; exports.createProgramAccountFilter = createProgramAccountFilter; exports.createVaultProgram = createVaultProgram; exports.deriveBaseKeyForLocker = deriveBaseKeyForLocker; exports.deriveDammV1EventAuthority = deriveDammV1EventAuthority; exports.deriveDammV1LockEscrowAddress = deriveDammV1LockEscrowAddress; exports.deriveDammV1LpMintAddress = deriveDammV1LpMintAddress; exports.deriveDammV1MigrationMetadataAddress = deriveDammV1MigrationMetadataAddress; exports.deriveDammV1PoolAddress = deriveDammV1PoolAddress; exports.deriveDammV1PoolAuthority = deriveDammV1PoolAuthority; exports.deriveDammV1ProtocolFeeAddress = deriveDammV1ProtocolFeeAddress; exports.deriveDammV1VaultLPAddress = deriveDammV1VaultLPAddress; exports.deriveDammV2EventAuthority = deriveDammV2EventAuthority; exports.deriveDammV2LockEscrowAddress = deriveDammV2LockEscrowAddress; exports.deriveDammV2MigrationMetadataAddress = deriveDammV2MigrationMetadataAddress; exports.deriveDammV2PoolAddress = deriveDammV2PoolAddress; exports.deriveDammV2PoolAuthority = deriveDammV2PoolAuthority; exports.deriveDammV2TokenVaultAddress = deriveDammV2TokenVaultAddress; exports.deriveDbcEventAuthority = deriveDbcEventAuthority; exports.deriveDbcPoolAddress = deriveDbcPoolAddress; exports.deriveDbcPoolAuthority = deriveDbcPoolAuthority; exports.deriveDbcPoolMetadata = deriveDbcPoolMetadata; exports.deriveDbcTokenVaultAddress = deriveDbcTokenVaultAddress; exports.deriveEscrow = deriveEscrow; exports.deriveLockerEventAuthority = deriveLockerEventAuthority; exports.deriveMintMetadata = deriveMintMetadata; exports.derivePartnerMetadata = derivePartnerMetadata; exports.derivePositionAddress = derivePositionAddress; exports.derivePositionNftAccount = derivePositionNftAccount; exports.deriveTokenVaultKey = deriveTokenVaultKey; exports.deriveVaultAddress = deriveVaultAddress; exports.deriveVaultLpMintAddress = deriveVaultLpMintAddress; exports.deriveVaultPdas = deriveVaultPdas; exports.feeNumeratorToBps = feeNumeratorToBps; exports.findAssociatedTokenAddress = findAssociatedTokenAddress; exports.fromDecimalToBN = fromDecimalToBN; exports.getAccountCreationTimestamp = getAccountCreationTimestamp; exports.getAccountCreationTimestamps = getAccountCreationTimestamps; exports.getAccountData = getAccountData; exports.getBaseFeeParams = getBaseFeeParams; exports.getBaseTokenForSwap = getBaseTokenForSwap; exports.getCurrentBaseFeeNumerator = getCurrentBaseFeeNumerator; exports.getDeltaAmountBase = getDeltaAmountBase; exports.getDeltaAmountBaseUnsigned = getDeltaAmountBaseUnsigned; exports.getDeltaAmountQuoteUnsigned = getDeltaAmountQuoteUnsigned; exports.getDynamicFeeParams = getDynamicFeeParams; exports.getFeeInPeriod = getFeeInPeriod; exports.getFeeMode = getFeeMode; exports.getFeeOnAmount = getFeeOnAmount; exports.getFirstCurve = getFirstCurve; exports.getFirstKey = getFirstKey; exports.getInitialLiquidityFromDeltaBase = getInitialLiquidityFromDeltaBase; exports.getInitialLiquidityFromDeltaQuote = getInitialLiquidityFromDeltaQuote; exports.getInitializeAmounts = getInitializeAmounts; exports.getLiquidity = getLiquidity; exports.getLockedVestingParams = getLockedVestingParams; exports.getMigrationBaseToken = getMigrationBaseToken; exports.getMigrationQuoteAmount = getMigrationQuoteAmount; exports.getMigrationQuoteAmountFromMigrationQuoteThreshold = getMigrationQuoteAmountFromMigrationQuoteThreshold; exports.getMigrationQuoteThresholdFromMigrationQuoteAmount = getMigrationQuoteThresholdFromMigrationQuoteAmount; exports.getMigrationThresholdPrice = getMigrationThresholdPrice; exports.getMinBaseFeeBps = getMinBaseFeeBps; exports.getNextSqrtPriceFromAmountBaseRoundingUp = getNextSqrtPriceFromAmountBaseRoundingUp; exports.getNextSqrtPriceFromAmountQuoteRoundingDown = getNextSqrtPriceFromAmountQuoteRoundingDown; exports.getNextSqrtPriceFromInput = getNextSqrtPriceFromInput; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getPercentageSupplyOnMigration = getPercentageSupplyOnMigration; exports.getPriceFromSqrtPrice = getPriceFromSqrtPrice; exports.getSecondKey = getSecondKey; exports.getSqrtPriceFromMarketCap = getSqrtPriceFromMarketCap; exports.getSqrtPriceFromPrice = getSqrtPriceFromPrice; exports.getSwapAmountFromBaseToQuote = getSwapAmountFromBaseToQuote; exports.getSwapAmountFromQuoteToBase = getSwapAmountFromQuoteToBase; exports.getSwapAmountWithBuffer = getSwapAmountWithBuffer; exports.getSwapResult = getSwapResult; exports.getTokenDecimals = getTokenDecimals; exports.getTokenProgram = getTokenProgram; exports.getTokenType = getTokenType; exports.getTotalSupplyFromCurve = getTotalSupplyFromCurve; exports.getTotalTokenSupply = getTotalTokenSupply; exports.getTotalVestingAmount = getTotalVestingAmount; exports.getTwoCurve = getTwoCurve; exports.getVariableFee = getVariableFee; exports.isDefaultLockedVesting = isDefaultLockedVesting; exports.isNativeSol = isNativeSol; exports.prepareTokenAccountTx = prepareTokenAccountTx; exports.swapQuote = swapQuote; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.validateActivationType = validateActivationType; exports.validateBalance = validateBalance; exports.validateBaseTokenType = validateBaseTokenType; exports.validateCollectFeeMode = validateCollectFeeMode; exports.validateConfigParameters = validateConfigParameters; exports.validateCurve = validateCurve; exports.validateLPPercentages = validateLPPercentages; exports.validateMigrationAndTokenType = validateMigrationAndTokenType; exports.validateMigrationFeeOption = validateMigrationFeeOption; exports.validatePoolFees = validatePoolFees; exports.validateSwapAmount = validateSwapAmount; exports.validateTokenDecimals = validateTokenDecimals; exports.validateTokenSupply = validateTokenSupply; exports.validateTokenUpdateAuthorityOptions = validateTokenUpdateAuthorityOptions; exports.wrapSOLInstruction = wrapSOLInstruction;
23122
23445
  //# sourceMappingURL=index.cjs.map