impermax-sdk 2.1.263 → 2.1.264
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.
|
@@ -16,12 +16,6 @@ class UniswapV3Position extends genericPosition_1.default {
|
|
|
16
16
|
this.priceA = params.priceA;
|
|
17
17
|
this.priceB = params.priceB;
|
|
18
18
|
}
|
|
19
|
-
checkLock() {
|
|
20
|
-
if (this.lockStateChange)
|
|
21
|
-
throw Error("Can't change state of original position object");
|
|
22
|
-
else
|
|
23
|
-
this.state++;
|
|
24
|
-
}
|
|
25
19
|
/**
|
|
26
20
|
* protected SETTERS
|
|
27
21
|
*/
|
|
@@ -43,13 +37,13 @@ class UniswapV3Position extends genericPosition_1.default {
|
|
|
43
37
|
return liquidity * Math.sqrt(price);
|
|
44
38
|
}
|
|
45
39
|
getRealXGivenLiquidityAndPrice(liquidity, price) {
|
|
46
|
-
const surplusX = this.getVirtualX(liquidity, this.
|
|
47
|
-
const virtualX = this.getVirtualX(liquidity, Math.max(price, this.
|
|
40
|
+
const surplusX = this.getVirtualX(liquidity, this.priceB);
|
|
41
|
+
const virtualX = this.getVirtualX(liquidity, Math.max(price, this.priceA));
|
|
48
42
|
return Math.max(virtualX - surplusX, 0);
|
|
49
43
|
}
|
|
50
44
|
getRealYGivenLiquidityAndPrice(liquidity, price) {
|
|
51
45
|
const surplusY = this.getVirtualY(liquidity, this.priceA);
|
|
52
|
-
const virtualY = this.getVirtualY(liquidity, Math.min(price, this.
|
|
46
|
+
const virtualY = this.getVirtualY(liquidity, Math.min(price, this.priceB));
|
|
53
47
|
return Math.max(virtualY - surplusY, 0);
|
|
54
48
|
}
|
|
55
49
|
getInitialCollateralValue() {
|