@meteora-ag/dynamic-bonding-curve-sdk 1.2.5 → 1.2.6
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 +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -705,13 +705,13 @@ var getSwapAmountWithBuffer = (swapBaseAmount, sqrtStartPrice, curve) => {
|
|
|
705
705
|
);
|
|
706
706
|
return _bnjs2.default.min(swapAmountBuffer, maxBaseAmountOnCurve);
|
|
707
707
|
};
|
|
708
|
-
var getPercentageSupplyOnMigration = (initialMarketCap, migrationMarketCap, lockedVesting, totalTokenSupply) => {
|
|
708
|
+
var getPercentageSupplyOnMigration = (initialMarketCap, migrationMarketCap, lockedVesting, totalLeftover, totalTokenSupply) => {
|
|
709
709
|
const marketCapRatio = initialMarketCap.div(migrationMarketCap);
|
|
710
710
|
const sqrtRatio = _decimaljs2.default.sqrt(marketCapRatio);
|
|
711
711
|
const totalVestingAmount = getTotalVestingAmount(lockedVesting);
|
|
712
|
-
const
|
|
713
|
-
const
|
|
714
|
-
const numerator = new (0, _decimaljs2.default)(100).mul(sqrtRatio).sub(
|
|
712
|
+
const vestingPercentage = new (0, _decimaljs2.default)(totalVestingAmount.toString()).mul(new (0, _decimaljs2.default)(100)).div(new (0, _decimaljs2.default)(totalTokenSupply.toString()));
|
|
713
|
+
const leftoverPercentage = new (0, _decimaljs2.default)(totalLeftover.toString()).mul(new (0, _decimaljs2.default)(100)).div(new (0, _decimaljs2.default)(totalTokenSupply.toString()));
|
|
714
|
+
const numerator = new (0, _decimaljs2.default)(100).mul(sqrtRatio).sub(vestingPercentage.add(leftoverPercentage).mul(sqrtRatio));
|
|
715
715
|
const denominator = new (0, _decimaljs2.default)(1).add(sqrtRatio);
|
|
716
716
|
return numerator.div(denominator).toNumber();
|
|
717
717
|
};
|
|
@@ -1786,7 +1786,8 @@ function buildCurveWithMarketCap(buildCurveWithMarketCapParam) {
|
|
|
1786
1786
|
migrationMarketCap,
|
|
1787
1787
|
totalTokenSupply,
|
|
1788
1788
|
tokenBaseDecimal,
|
|
1789
|
-
migrationFee
|
|
1789
|
+
migrationFee,
|
|
1790
|
+
leftover
|
|
1790
1791
|
} = buildCurveWithMarketCapParam;
|
|
1791
1792
|
const {
|
|
1792
1793
|
totalLockedVestingAmount,
|
|
@@ -1803,11 +1804,13 @@ function buildCurveWithMarketCap(buildCurveWithMarketCapParam) {
|
|
|
1803
1804
|
cliffDurationFromMigrationTime,
|
|
1804
1805
|
tokenBaseDecimal
|
|
1805
1806
|
);
|
|
1807
|
+
const totalLeftover = convertToLamports(leftover, tokenBaseDecimal);
|
|
1806
1808
|
const totalSupply = convertToLamports(totalTokenSupply, tokenBaseDecimal);
|
|
1807
1809
|
const percentageSupplyOnMigration = getPercentageSupplyOnMigration(
|
|
1808
1810
|
new (0, _decimaljs2.default)(initialMarketCap),
|
|
1809
1811
|
new (0, _decimaljs2.default)(migrationMarketCap),
|
|
1810
1812
|
lockedVesting,
|
|
1813
|
+
totalLeftover,
|
|
1811
1814
|
totalSupply
|
|
1812
1815
|
);
|
|
1813
1816
|
const migrationQuoteAmount = getMigrationQuoteAmount(
|