@strkfarm/sdk 1.1.56 → 1.1.57

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.
@@ -95005,9 +95005,12 @@ spurious results.`);
95005
95005
  const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
95006
95006
  logger2.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
95007
95007
  logger2.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
95008
- const debtAmount = x_debt_usd.dividedBy(debtPrice);
95008
+ let debtAmount = x_debt_usd.dividedBy(debtPrice);
95009
95009
  const marginAmount = addedCollateral;
95010
95010
  logger2.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
95011
+ if (marginAmount.lt(0) && debtAmount.gt(0)) {
95012
+ debtAmount = Web3Number.fromWei(0, this.asset().decimals);
95013
+ }
95011
95014
  return this.getModifyLeverCall({
95012
95015
  marginAmount,
95013
95016
  debtAmount,
@@ -31098,9 +31098,12 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
31098
31098
  const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
31099
31099
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
31100
31100
  logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
31101
- const debtAmount = x_debt_usd.dividedBy(debtPrice);
31101
+ let debtAmount = x_debt_usd.dividedBy(debtPrice);
31102
31102
  const marginAmount = addedCollateral;
31103
31103
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
31104
+ if (marginAmount.lt(0) && debtAmount.gt(0)) {
31105
+ debtAmount = Web3Number.fromWei(0, this.asset().decimals);
31106
+ }
31104
31107
  return this.getModifyLeverCall({
31105
31108
  marginAmount,
31106
31109
  debtAmount,
package/dist/index.js CHANGED
@@ -31098,9 +31098,12 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
31098
31098
  const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
31099
31099
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
31100
31100
  logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
31101
- const debtAmount = x_debt_usd.dividedBy(debtPrice);
31101
+ let debtAmount = x_debt_usd.dividedBy(debtPrice);
31102
31102
  const marginAmount = addedCollateral;
31103
31103
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
31104
+ if (marginAmount.lt(0) && debtAmount.gt(0)) {
31105
+ debtAmount = Web3Number.fromWei(0, this.asset().decimals);
31106
+ }
31104
31107
  return this.getModifyLeverCall({
31105
31108
  marginAmount,
31106
31109
  debtAmount,
package/dist/index.mjs CHANGED
@@ -30996,9 +30996,12 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
30996
30996
  const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
30997
30997
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
30998
30998
  logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
30999
- const debtAmount = x_debt_usd.dividedBy(debtPrice);
30999
+ let debtAmount = x_debt_usd.dividedBy(debtPrice);
31000
31000
  const marginAmount = addedCollateral;
31001
31001
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
31002
+ if (marginAmount.lt(0) && debtAmount.gt(0)) {
31003
+ debtAmount = Web3Number.fromWei(0, this.asset().decimals);
31004
+ }
31002
31005
  return this.getModifyLeverCall({
31003
31006
  marginAmount,
31004
31007
  debtAmount,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strkfarm/sdk",
3
- "version": "1.1.56",
3
+ "version": "1.1.57",
4
4
  "description": "STRKFarm TS SDK (Meant for our internal use, but feel free to use it)",
5
5
  "typings": "dist/index.d.ts",
6
6
  "types": "dist/index.d.ts",
@@ -485,10 +485,17 @@ export class UniversalLstMultiplierStrategy extends UniversalStrategy<HyperLSTSt
485
485
  logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
486
486
 
487
487
  // both in underlying
488
- const debtAmount = x_debt_usd.dividedBy(debtPrice);
488
+ let debtAmount = x_debt_usd.dividedBy(debtPrice);
489
489
  const marginAmount = addedCollateral;
490
490
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
491
491
 
492
+ if (marginAmount.lt(0) && debtAmount.gt(0)) {
493
+ // if we want to withdraw, but debt can go high, its conflicting between
494
+ // increasing and reducing lever. and in this case, the HF will go high,
495
+ // which is ok.
496
+ debtAmount = Web3Number.fromWei(0, this.asset().decimals);
497
+ }
498
+
492
499
  // Cases of lever increase (within the scopr of this function)
493
500
  // 1. debtAmount > 0 and marginAmount > 0
494
501
  // 2. debtAmount > 0 and marginAmount < 0