impermax-sdk 2.1.205 → 2.1.206
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.
|
@@ -2,7 +2,6 @@ import OnchainInteractionsNftlp from "./onchainInteractionsNftlp";
|
|
|
2
2
|
import { Permits } from "../../../onchainTypes";
|
|
3
3
|
import { OnchainAccountNftlpUniswapV3 } from "../../../account/lendingPool/nftlp";
|
|
4
4
|
import { BigNumber } from "ethers";
|
|
5
|
-
import UniswapV3Position from "../../../../utils/position/uniswapV3";
|
|
6
5
|
export default class OnchainInteractionsNftlpUniswapV3 extends OnchainInteractionsNftlp {
|
|
7
6
|
protected cache: {};
|
|
8
7
|
getUniswapV3Router: () => any;
|
|
@@ -29,13 +28,6 @@ export default class OnchainInteractionsNftlpUniswapV3 extends OnchainInteractio
|
|
|
29
28
|
withCollateralTransfer: boolean;
|
|
30
29
|
withCollateralApproval: boolean;
|
|
31
30
|
}>;
|
|
32
|
-
_getUpdatePositionActions
|
|
33
|
-
actions: any[];
|
|
34
|
-
ethValue: number;
|
|
35
|
-
approveA: number;
|
|
36
|
-
approveB: number;
|
|
37
|
-
withCollateralTransfer: boolean;
|
|
38
|
-
withCollateralApproval: boolean;
|
|
39
|
-
}>;
|
|
31
|
+
private _getUpdatePositionActions;
|
|
40
32
|
execute(tokenId: number, actions: Array<any>, permits: Permits, withCollateralTransfer: boolean, ethValue: BigNumber, onTransactionHash: Function): Promise<any>;
|
|
41
33
|
}
|
|
@@ -50,26 +50,28 @@ class UniswapV3Position {
|
|
|
50
50
|
/**
|
|
51
51
|
* PRIVATE SETTERS
|
|
52
52
|
*/
|
|
53
|
-
|
|
54
|
-
this.checkLock();
|
|
55
|
-
const { liquidity } = this.getOptimalLiquidity(amountX, amountY);
|
|
53
|
+
updateLiquidity(liquidity) {
|
|
56
54
|
if (Number.isNaN(liquidity) || liquidity === Infinity)
|
|
57
55
|
return;
|
|
58
56
|
this.liquidity = liquidity;
|
|
57
|
+
const percentageOfInitial = Math.min(liquidity / this.initialLiquidity, 1);
|
|
58
|
+
this.unclaimedFeesX = this.initialUnclaimedFeesX * percentageOfInitial;
|
|
59
|
+
this.unclaimedFeesY = this.initialUnclaimedFeesY * percentageOfInitial;
|
|
60
|
+
}
|
|
61
|
+
setRealXRealY(amountX, amountY) {
|
|
62
|
+
this.checkLock();
|
|
63
|
+
const { liquidity } = this.getOptimalLiquidity(amountX, amountY);
|
|
64
|
+
this.updateLiquidity(liquidity);
|
|
59
65
|
}
|
|
60
66
|
setRealX(amountX) {
|
|
61
67
|
this.checkLock();
|
|
62
68
|
const { liquidity } = this.getOptimalLiquidity(amountX, Infinity);
|
|
63
|
-
|
|
64
|
-
return;
|
|
65
|
-
this.liquidity = liquidity;
|
|
69
|
+
this.updateLiquidity(liquidity);
|
|
66
70
|
}
|
|
67
71
|
setRealY(amountY) {
|
|
68
72
|
this.checkLock();
|
|
69
73
|
const { liquidity } = this.getOptimalLiquidity(Infinity, amountY);
|
|
70
|
-
|
|
71
|
-
return;
|
|
72
|
-
this.liquidity = liquidity;
|
|
74
|
+
this.updateLiquidity(liquidity);
|
|
73
75
|
}
|
|
74
76
|
setDebtX(_debtX) {
|
|
75
77
|
if (Number.isNaN(_debtX))
|
|
@@ -249,7 +251,6 @@ class UniswapV3Position {
|
|
|
249
251
|
}
|
|
250
252
|
withdrawX(amount) {
|
|
251
253
|
this.setRealX(Math.max(this.getInitialRealX() - amount, 0));
|
|
252
|
-
// TODO set uncollected fees in proportion
|
|
253
254
|
}
|
|
254
255
|
withdrawY(amount) {
|
|
255
256
|
this.setRealY(Math.max(this.getInitialRealY() - amount, 0));
|