@meteora-ag/dlmm 1.7.0 → 1.7.2

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.js CHANGED
@@ -12300,9 +12300,9 @@ function findBaseDeltaY(amountY, minDeltaId, maxDeltaId) {
12300
12300
  if (minDeltaId.eq(maxDeltaId)) {
12301
12301
  return amountY;
12302
12302
  }
12303
- const m1 = minDeltaId.neg().subn(1);
12303
+ const m1 = minDeltaId.neg();
12304
12304
  const m2 = maxDeltaId.neg();
12305
- const b = m2.neg().mul(m1.sub(m2).addn(1));
12305
+ const b = m2.neg().addn(1).mul(m1.sub(m2).addn(1));
12306
12306
  const c = m1.mul(m1.addn(1)).divn(2);
12307
12307
  const d = m2.mul(m2.subn(1)).divn(2);
12308
12308
  const a = b.add(c.sub(d));
@@ -12316,7 +12316,7 @@ function findY0AndDeltaY(amountY, minDeltaId, maxDeltaId, activeId) {
12316
12316
  };
12317
12317
  }
12318
12318
  let baseDeltaY = findBaseDeltaY(amountY, minDeltaId, maxDeltaId);
12319
- const y0 = baseDeltaY.neg().mul(maxDeltaId).add(baseDeltaY);
12319
+ const y0 = baseDeltaY.neg().mul(maxDeltaId.neg().subn(1));
12320
12320
  while (true) {
12321
12321
  const amountInBins = getAmountInBinsBidSide(
12322
12322
  activeId,
@@ -19459,13 +19459,13 @@ var DLMM = class {
19459
19459
  totalXAmount = totalXAmount.add(new (0, _decimaljs2.default)(positionXAmount.toString()));
19460
19460
  totalYAmount = totalYAmount.add(new (0, _decimaljs2.default)(positionYAmount.toString()));
19461
19461
  const feeInfo = feeInfos[idx];
19462
- const newFeeX = mulShr(
19462
+ const newFeeX = posShare.isZero() ? new (0, _anchor.BN)(0) : mulShr(
19463
19463
  posShares[idx].shrn(SCALE_OFFSET),
19464
19464
  bin.feeAmountXPerTokenStored.sub(feeInfo.feeXPerTokenComplete),
19465
19465
  SCALE_OFFSET,
19466
19466
  1 /* Down */
19467
19467
  );
19468
- const newFeeY = mulShr(
19468
+ const newFeeY = posShare.isZero() ? new (0, _anchor.BN)(0) : mulShr(
19469
19469
  posShares[idx].shrn(SCALE_OFFSET),
19470
19470
  bin.feeAmountYPerTokenStored.sub(feeInfo.feeYPerTokenComplete),
19471
19471
  SCALE_OFFSET,
@@ -19497,7 +19497,7 @@ var DLMM = class {
19497
19497
  const delta = rewardPerTokenStored.sub(
19498
19498
  posBinRewardInfo.rewardPerTokenCompletes[j]
19499
19499
  );
19500
- const newReward = mulShr(
19500
+ const newReward = posShares[idx].isZero() ? new (0, _anchor.BN)(0) : mulShr(
19501
19501
  delta,
19502
19502
  posShares[idx].shrn(SCALE_OFFSET),
19503
19503
  SCALE_OFFSET,