impermax-sdk 2.1.87 → 2.1.89

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.
@@ -52,6 +52,7 @@ class OnchainInteractionsNftlpUniswapV3 extends onchainInteractionsNftlp_1.defau
52
52
  });
53
53
  }
54
54
  _getUpdatePositionActions(tokenId, positionObject, depositADelta, depositBDelta, borrowADelta, borrowBDelta) {
55
+ var _a, _b, _c, _d;
55
56
  return __awaiter(this, void 0, void 0, function* () {
56
57
  let ethValue = 0;
57
58
  let approveA = 0;
@@ -115,10 +116,8 @@ class OnchainInteractionsNftlpUniswapV3 extends onchainInteractionsNftlp_1.defau
115
116
  }
116
117
  // Mint
117
118
  if (depositADelta > 0 || depositBDelta > 0) {
118
- console.log(depositADelta, depositBDelta);
119
- console.log(yield borrowableA.toBigNumber(depositADelta), yield borrowableB.toBigNumber(depositBDelta), yield borrowableA.toBigNumber(depositADelta / this.getUiMargin()), yield borrowableB.toBigNumber(depositBDelta / this.getUiMargin()));
120
- console.log(yield actionsGetter.methods.getMintUniV3Action(yield borrowableA.toBigNumber(depositADelta), yield borrowableB.toBigNumber(depositBDelta), yield borrowableA.toBigNumber(depositADelta / this.getUiMargin()), yield borrowableB.toBigNumber(depositBDelta / this.getUiMargin())).call());
121
- console.log(actions);
119
+ console.log("depositADelta, depositBDelta", depositADelta, depositBDelta);
120
+ console.log((_a = (yield borrowableA.toBigNumber(depositADelta))) === null || _a === void 0 ? void 0 : _a.toNumber(), (_b = (yield borrowableA.toBigNumber(depositBDelta))) === null || _b === void 0 ? void 0 : _b.toNumber(), (_c = (yield borrowableA.toBigNumber(depositADelta / this.getUiMargin()))) === null || _c === void 0 ? void 0 : _c.toNumber(), (_d = (yield borrowableA.toBigNumber(depositBDelta / this.getUiMargin()))) === null || _d === void 0 ? void 0 : _d.toNumber());
122
121
  actions.push(yield actionsGetter.methods.getMintUniV3Action(yield borrowableA.toBigNumber(depositADelta), yield borrowableB.toBigNumber(depositBDelta), yield borrowableA.toBigNumber(depositADelta / this.getUiMargin()), yield borrowableB.toBigNumber(depositBDelta / this.getUiMargin())).call());
123
122
  if (isEthA) {
124
123
  ethValue += depositADelta;
@@ -215,17 +214,17 @@ class OnchainInteractionsNftlpUniswapV3 extends onchainInteractionsNftlp_1.defau
215
214
  approveB,
216
215
  withCollateralTransfer,
217
216
  };
218
- // Interesting scenarios to consider:
219
- // Borrow and mint + repay
220
- // mint + repay
221
- // redeem + repay cap and withdraw the rest
222
- // redeem + repay more than redeemed
223
- // deleverage and repay exactly what we're redeeming
224
217
  });
225
218
  }
226
219
  execute(tokenId, actions, permits, withCollateralTransfer, ethValue, onTransactionHash) {
227
220
  return __awaiter(this, void 0, void 0, function* () {
228
221
  const router = this.getUniswapV3Router();
222
+ console.log("router", router._address);
223
+ console.log("tokenId", tokenId);
224
+ console.log("actions", actions);
225
+ console.log("permits", permits);
226
+ console.log("withCollateralTransfer", withCollateralTransfer);
227
+ console.log("ethValue", ethValue.toNumber());
229
228
  return this.getLendingPool().send(router.methods.execute(yield this.getNftlp().getNftlpAddress(), tokenId == -1 ? general_1.MAX_UINT : tokenId.toString(), this.encodeActions(actions), this.encodePermits(permits), withCollateralTransfer), onTransactionHash, ethValue);
230
229
  });
231
230
  }
@@ -10,7 +10,6 @@ class UniswapV3Position {
10
10
  this.oraclePrice = _oraclePrice;
11
11
  this.priceA = _priceA;
12
12
  this.priceB = _priceB;
13
- console.log("PRICES", _marketPrice, _oraclePrice, _priceA, _priceB);
14
13
  this.safetyMargin = _safetyMargin;
15
14
  this.liquidationPenalty = _liquidationPenalty;
16
15
  this.lockStateChange = _lockStateChange;
@@ -59,11 +58,9 @@ class UniswapV3Position {
59
58
  // amountX and amountY are expected to have the same sign
60
59
  getOptimalLiquidityAtMarketPrice(amountX, amountY) {
61
60
  let liquidity;
62
- console.log("initial", amountX, amountY);
63
61
  if (amountX != 0 && amountY != 0) {
64
62
  const sampleX = this.getRealX(this.marketPrice);
65
63
  const sampleY = this.getRealY(this.marketPrice);
66
- console.log("sample", sampleX, sampleY);
67
64
  if (sampleX == 0)
68
65
  amountX = 0;
69
66
  else if (sampleX == 0)
@@ -76,7 +73,6 @@ class UniswapV3Position {
76
73
  }
77
74
  }
78
75
  liquidity = this.getLiquidity(this.marketPrice, amountX, amountY);
79
- console.log("final", amountX, amountY, liquidity);
80
76
  return { liquidity, amountX, amountY };
81
77
  }
82
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "2.1.87",
3
+ "version": "2.1.89",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",