@meteora-ag/cp-amm-sdk 1.1.2 → 1.1.4
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +41 -41
package/dist/index.mjs
CHANGED
|
@@ -7419,10 +7419,7 @@ function getNextSqrtPriceFromOutput(sqrtPrice, liquidity, outAmount, isB) {
|
|
|
7419
7419
|
|
|
7420
7420
|
// src/helpers/fee.ts
|
|
7421
7421
|
import Decimal2 from "decimal.js";
|
|
7422
|
-
function getBaseFeeNumerator(feeSchedulerMode, cliffFeeNumerator, period, reductionFactor
|
|
7423
|
-
if (periodFrequency.eq(new BN5(0)) || period.eq(new BN5(0))) {
|
|
7424
|
-
return cliffFeeNumerator;
|
|
7425
|
-
}
|
|
7422
|
+
function getBaseFeeNumerator(feeSchedulerMode, cliffFeeNumerator, period, reductionFactor) {
|
|
7426
7423
|
let feeNumerator;
|
|
7427
7424
|
if (feeSchedulerMode == 0 /* Linear */) {
|
|
7428
7425
|
feeNumerator = cliffFeeNumerator.sub(period.mul(reductionFactor));
|
|
@@ -7443,20 +7440,21 @@ function getDynamicFeeNumerator(volatilityAccumulator, binStep, variableFeeContr
|
|
|
7443
7440
|
return vFee.add(new BN5(99999999999)).div(new BN5(1e11));
|
|
7444
7441
|
}
|
|
7445
7442
|
function getFeeNumerator(currentPoint, activationPoint, numberOfPeriod, periodFrequency, feeSchedulerMode, cliffFeeNumerator, reductionFactor, dynamicFeeParams) {
|
|
7443
|
+
let feeNumerator;
|
|
7446
7444
|
if (Number(periodFrequency) == 0 || new BN5(currentPoint).lt(activationPoint)) {
|
|
7447
|
-
|
|
7445
|
+
feeNumerator = cliffFeeNumerator;
|
|
7446
|
+
} else {
|
|
7447
|
+
const period = BN5.min(
|
|
7448
|
+
new BN5(numberOfPeriod),
|
|
7449
|
+
new BN5(currentPoint).sub(activationPoint).div(periodFrequency)
|
|
7450
|
+
);
|
|
7451
|
+
feeNumerator = getBaseFeeNumerator(
|
|
7452
|
+
feeSchedulerMode,
|
|
7453
|
+
cliffFeeNumerator,
|
|
7454
|
+
period,
|
|
7455
|
+
reductionFactor
|
|
7456
|
+
);
|
|
7448
7457
|
}
|
|
7449
|
-
const period = BN5.min(
|
|
7450
|
-
new BN5(numberOfPeriod),
|
|
7451
|
-
new BN5(currentPoint).sub(activationPoint).div(periodFrequency)
|
|
7452
|
-
);
|
|
7453
|
-
let feeNumerator = getBaseFeeNumerator(
|
|
7454
|
-
feeSchedulerMode,
|
|
7455
|
-
cliffFeeNumerator,
|
|
7456
|
-
period,
|
|
7457
|
-
reductionFactor,
|
|
7458
|
-
periodFrequency
|
|
7459
|
-
);
|
|
7460
7458
|
if (dynamicFeeParams) {
|
|
7461
7459
|
const { volatilityAccumulator, binStep, variableFeeControl } = dynamicFeeParams;
|
|
7462
7460
|
const dynamicFeeNumberator = getDynamicFeeNumerator(
|