impermax-sdk 2.1.87 → 2.1.88
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.
|
@@ -42,7 +42,11 @@ class OnchainInteractionsNftlpUniswapV3 extends onchainInteractionsNftlp_1.defau
|
|
|
42
42
|
const priceB = yield this.getNftlp().tickToPrice(tickUpper);
|
|
43
43
|
const result = yield this._getUpdatePositionActions(-1, yield this.getAccountNftlp().createNewPositionObject(fee, priceA, priceB), depositADelta, depositBDelta, borrowADelta, borrowBDelta);
|
|
44
44
|
// TODO check fee and ticks encoding
|
|
45
|
-
result.actions.unshift(
|
|
45
|
+
/*result.actions.unshift(await actionsGetter.methods.getMintUniV3EmptyAction(
|
|
46
|
+
fee.toString(),
|
|
47
|
+
tickLower.toString(),
|
|
48
|
+
tickUpper.toString(),
|
|
49
|
+
).call());*/
|
|
46
50
|
return result;
|
|
47
51
|
});
|
|
48
52
|
}
|
|
@@ -115,10 +119,7 @@ class OnchainInteractionsNftlpUniswapV3 extends onchainInteractionsNftlp_1.defau
|
|
|
115
119
|
}
|
|
116
120
|
// Mint
|
|
117
121
|
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);
|
|
122
|
+
console.log("depositADelta, depositBDelta", depositADelta, depositBDelta);
|
|
122
123
|
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
124
|
if (isEthA) {
|
|
124
125
|
ethValue += depositADelta;
|
|
@@ -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
|
}
|