impermax-sdk 1.1.66 → 1.1.67

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.
@@ -208,6 +208,7 @@ class OnchainAccountLendingPool {
208
208
  else {
209
209
  priceSwingA = (0, lliquidity_math_1.uniswapV2_getLiquidatableXPriceDecrease)(collateralA, collateralB, debtA, debtB) * safetyMargin;
210
210
  priceSwingB = (0, lliquidity_math_1.uniswapV2_getLiquidatableXPriceDecrease)(collateralB, collateralA, debtB, debtA) * safetyMargin;
211
+ console.log(priceSwingA, priceSwingB);
211
212
  }
212
213
  const twapPrice = yield this.lendingPool.getTWAPPrice();
213
214
  return !this.account.getOnchain().priceInverted
@@ -268,7 +269,7 @@ class OnchainAccountLendingPool {
268
269
  changeBorrowedA: changeBorrowedA,
269
270
  changeBorrowedB: changeBorrowedB,
270
271
  });
271
- if (liqPriceA > twapPrice || liqPriceB < twapPrice)
272
+ if (liqPriceA > twapPrice || liqPriceB < twapPrice || !liqPriceA || !liqPriceB)
272
273
  addLev -= jump;
273
274
  else
274
275
  addLev += jump;
@@ -20,6 +20,7 @@ function uniswapV2_getLiquidatableXPriceDecrease(x0, y0, debtX, debtY) {
20
20
  if (x == Infinity)
21
21
  return 0;
22
22
  const y = k / x;
23
+ console.log(x0, y0, debtX, debtY, x, y);
23
24
  const price0 = uniswapV2_getPriceFromReserves(x0, y0);
24
25
  const price = uniswapV2_getPriceFromReserves(x, y);
25
26
  if (price >= price0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impermax-sdk",
3
- "version": "1.1.66",
3
+ "version": "1.1.67",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",