impermax-sdk 2.1.190 → 2.1.192
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.
|
@@ -27,6 +27,7 @@ export default class OnchainInteractionsNftlpUniswapV3 extends OnchainInteractio
|
|
|
27
27
|
approveA: number;
|
|
28
28
|
approveB: number;
|
|
29
29
|
withCollateralTransfer: boolean;
|
|
30
|
+
withCollateralApproval: boolean;
|
|
30
31
|
}>;
|
|
31
32
|
_getUpdatePositionActions(tokenId: number, positionObject: UniswapV3Position, depositADelta: number, depositBDelta: number, borrowADelta: number, borrowBDelta: number): Promise<{
|
|
32
33
|
actions: any[];
|
|
@@ -34,6 +35,7 @@ export default class OnchainInteractionsNftlpUniswapV3 extends OnchainInteractio
|
|
|
34
35
|
approveA: number;
|
|
35
36
|
approveB: number;
|
|
36
37
|
withCollateralTransfer: boolean;
|
|
38
|
+
withCollateralApproval: boolean;
|
|
37
39
|
}>;
|
|
38
40
|
execute(tokenId: number, actions: Array<any>, permits: Permits, withCollateralTransfer: boolean, ethValue: BigNumber, onTransactionHash: Function): Promise<any>;
|
|
39
41
|
}
|
|
@@ -50,7 +50,8 @@ class OnchainInteractionsNftlpUniswapV3 extends onchainInteractionsNftlp_1.defau
|
|
|
50
50
|
let ethValue = 0;
|
|
51
51
|
let approveA = 0;
|
|
52
52
|
let approveB = 0;
|
|
53
|
-
let withCollateralTransfer = tokenId != -1 && (borrowADelta > 0 || borrowBDelta > 0
|
|
53
|
+
let withCollateralTransfer = tokenId != -1 && (borrowADelta > 0 || borrowBDelta > 0);
|
|
54
|
+
let withCollateralApproval = tokenId != -1 && (borrowADelta > 0 || borrowBDelta > 0 || depositADelta < 0 || depositBDelta < 0);
|
|
54
55
|
let doWithdrawEth = false;
|
|
55
56
|
let actions = [];
|
|
56
57
|
if (depositADelta > 0 && depositBDelta < 0 || depositBDelta > 0 && depositADelta < 0)
|
|
@@ -213,6 +214,7 @@ class OnchainInteractionsNftlpUniswapV3 extends onchainInteractionsNftlp_1.defau
|
|
|
213
214
|
approveA,
|
|
214
215
|
approveB,
|
|
215
216
|
withCollateralTransfer,
|
|
217
|
+
withCollateralApproval,
|
|
216
218
|
};
|
|
217
219
|
// Interesting scenarios to consider:
|
|
218
220
|
// Borrow and mint + repay
|
|
@@ -53,21 +53,21 @@ class UniswapV3Position {
|
|
|
53
53
|
setRealXRealY(amountX, amountY) {
|
|
54
54
|
this.checkLock();
|
|
55
55
|
const { liquidity } = this.getOptimalLiquidity(amountX, amountY);
|
|
56
|
-
if (Number.isNaN(liquidity))
|
|
56
|
+
if (Number.isNaN(liquidity) || liquidity === Infinity)
|
|
57
57
|
return;
|
|
58
58
|
this.liquidity = liquidity;
|
|
59
59
|
}
|
|
60
60
|
setRealX(amountX) {
|
|
61
61
|
this.checkLock();
|
|
62
62
|
const { liquidity } = this.getOptimalLiquidity(amountX, Infinity);
|
|
63
|
-
if (Number.isNaN(liquidity))
|
|
63
|
+
if (Number.isNaN(liquidity) || liquidity === Infinity)
|
|
64
64
|
return;
|
|
65
65
|
this.liquidity = liquidity;
|
|
66
66
|
}
|
|
67
67
|
setRealY(amountY) {
|
|
68
68
|
this.checkLock();
|
|
69
69
|
const { liquidity } = this.getOptimalLiquidity(Infinity, amountY);
|
|
70
|
-
if (Number.isNaN(liquidity))
|
|
70
|
+
if (Number.isNaN(liquidity) || liquidity === Infinity)
|
|
71
71
|
return;
|
|
72
72
|
this.liquidity = liquidity;
|
|
73
73
|
}
|