impermax-sdk 2.1.88 → 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.
|
@@ -42,11 +42,7 @@ 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
|
-
|
|
46
|
-
fee.toString(),
|
|
47
|
-
tickLower.toString(),
|
|
48
|
-
tickUpper.toString(),
|
|
49
|
-
).call());*/
|
|
45
|
+
result.actions.unshift(yield actionsGetter.methods.getMintUniV3EmptyAction(fee.toString(), tickLower.toString(), tickUpper.toString()).call());
|
|
50
46
|
return result;
|
|
51
47
|
});
|
|
52
48
|
}
|
|
@@ -56,6 +52,7 @@ class OnchainInteractionsNftlpUniswapV3 extends onchainInteractionsNftlp_1.defau
|
|
|
56
52
|
});
|
|
57
53
|
}
|
|
58
54
|
_getUpdatePositionActions(tokenId, positionObject, depositADelta, depositBDelta, borrowADelta, borrowBDelta) {
|
|
55
|
+
var _a, _b, _c, _d;
|
|
59
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
60
57
|
let ethValue = 0;
|
|
61
58
|
let approveA = 0;
|
|
@@ -120,6 +117,7 @@ class OnchainInteractionsNftlpUniswapV3 extends onchainInteractionsNftlp_1.defau
|
|
|
120
117
|
// Mint
|
|
121
118
|
if (depositADelta > 0 || depositBDelta > 0) {
|
|
122
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());
|
|
123
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());
|
|
124
122
|
if (isEthA) {
|
|
125
123
|
ethValue += depositADelta;
|
|
@@ -216,17 +214,17 @@ class OnchainInteractionsNftlpUniswapV3 extends onchainInteractionsNftlp_1.defau
|
|
|
216
214
|
approveB,
|
|
217
215
|
withCollateralTransfer,
|
|
218
216
|
};
|
|
219
|
-
// Interesting scenarios to consider:
|
|
220
|
-
// Borrow and mint + repay
|
|
221
|
-
// mint + repay
|
|
222
|
-
// redeem + repay cap and withdraw the rest
|
|
223
|
-
// redeem + repay more than redeemed
|
|
224
|
-
// deleverage and repay exactly what we're redeeming
|
|
225
217
|
});
|
|
226
218
|
}
|
|
227
219
|
execute(tokenId, actions, permits, withCollateralTransfer, ethValue, onTransactionHash) {
|
|
228
220
|
return __awaiter(this, void 0, void 0, function* () {
|
|
229
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());
|
|
230
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);
|
|
231
229
|
});
|
|
232
230
|
}
|