impermax-sdk 2.1.158 → 2.1.160
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.
|
@@ -287,6 +287,11 @@ class UniswapV3Position {
|
|
|
287
287
|
if (this.isLiquidatable())
|
|
288
288
|
return currentLeverage;
|
|
289
289
|
const highLeverage = 100; // we assume the position is liquidatable with this leverage
|
|
290
|
+
let setLiquidityToZero = false;
|
|
291
|
+
if (this.liquidity === 0) {
|
|
292
|
+
this.liquidity = 0.000001;
|
|
293
|
+
setLiquidityToZero = true;
|
|
294
|
+
}
|
|
290
295
|
const realX = this.getRealX();
|
|
291
296
|
const realY = this.getRealY();
|
|
292
297
|
const projectedRealX = realX * highLeverage / currentLeverage;
|
|
@@ -299,6 +304,8 @@ class UniswapV3Position {
|
|
|
299
304
|
const collateralValue = this.getCollateralValue();
|
|
300
305
|
const debtValue = this.getValueGivenAmounts(this.debtX + deltaDebtX, this.debtY + deltaDebtY);
|
|
301
306
|
const equityValue = collateralValue - debtValue;
|
|
307
|
+
if (setLiquidityToZero)
|
|
308
|
+
this.liquidity = 0;
|
|
302
309
|
return collateralValue / equityValue;
|
|
303
310
|
}
|
|
304
311
|
getMinLeverage() {
|