impermax-sdk 2.1.147 → 2.1.149
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.
|
@@ -1,31 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Common interface to represent collateral positions across different
|
|
2
|
+
* Common interface to represent collateral positions across different dexes.
|
|
3
3
|
*/
|
|
4
4
|
export interface Position {
|
|
5
|
-
/** Whether the class is locked to state changes or not */
|
|
6
5
|
readonly lockStateChange: boolean;
|
|
7
|
-
readonly initialLiquidity: number;
|
|
8
6
|
readonly initialDebtX: number;
|
|
9
7
|
readonly initialDebtY: number;
|
|
10
|
-
/** The current market price, derived from offchain USD sources */
|
|
11
8
|
readonly marketPrice: number;
|
|
12
|
-
/** The current price that is reporting from our oracle, taken from onchain or offchain */
|
|
13
9
|
readonly oraclePrice: number;
|
|
14
|
-
/** The safety margin of the lending pool */
|
|
15
10
|
readonly safetyMargin: number;
|
|
16
|
-
/** The liqudation penalty of the lending pool */
|
|
17
11
|
readonly liquidationPenalty: number;
|
|
18
|
-
/** The current liquidity of the position */
|
|
19
|
-
liquidity: number;
|
|
20
|
-
/** The current debt of token0 of the position */
|
|
21
12
|
debtX: number;
|
|
22
|
-
/** The current debt of token1 of the position */
|
|
23
13
|
debtY: number;
|
|
24
14
|
setRealX(amountX: number): void;
|
|
25
15
|
setRealY(amountY: number): void;
|
|
26
16
|
setDebtX(debtX: number): void;
|
|
27
17
|
setDebtY(debtY: number): void;
|
|
28
|
-
setLiquidity(liquidity: number): void;
|
|
29
18
|
setRealXRealY(amountX: number, amountY: number): void;
|
|
30
19
|
depositX(amount: number): void;
|
|
31
20
|
depositY(amount: number): void;
|
|
@@ -35,42 +24,23 @@ export interface Position {
|
|
|
35
24
|
borrowY(amount: number): void;
|
|
36
25
|
repayX(amount: number): void;
|
|
37
26
|
repayY(amount: number): void;
|
|
38
|
-
/** Whether the position is underwater or not */
|
|
39
27
|
isUnderwater(): boolean;
|
|
40
|
-
/** Whether the position is liquidatable or not */
|
|
41
28
|
isLiquidatable(): boolean;
|
|
42
|
-
/** Returns the total amount of token0 in a position */
|
|
43
29
|
getRealX(): number;
|
|
44
|
-
/** Returns the total amount of token1 in a position */
|
|
45
30
|
getRealY(): number;
|
|
46
|
-
/** Returns the net amount of token0 in a position taking into account current debt */
|
|
47
31
|
getNetX(): number;
|
|
48
|
-
/** Returns the net amount of token1 in a position taking into account current debt */
|
|
49
32
|
getNetY(): number;
|
|
50
|
-
/** Returns the position's current leverage */
|
|
51
33
|
getLeverage(): number;
|
|
52
|
-
/** Returns the max leverage the position can take */
|
|
53
|
-
getMaxLeverage(): number;
|
|
54
|
-
/** Returns the min leverage the position can take */
|
|
55
|
-
getMinLeverage(): number;
|
|
56
|
-
/** Returns the liquidation range of the position, undefined if liquidatable */
|
|
57
34
|
getLiquidationRange(): {
|
|
58
35
|
priceA: number;
|
|
59
36
|
priceB: number;
|
|
60
37
|
} | undefined;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
amountY: number;
|
|
66
|
-
};
|
|
67
|
-
/** Returns the max withdrawable of token0 and token1 from the position */
|
|
38
|
+
getMaxBorrowableX(): number;
|
|
39
|
+
getMaxBorrowableY(): number;
|
|
40
|
+
getMaxLeverage(): number;
|
|
41
|
+
getMinLeverage(): number;
|
|
68
42
|
getMaxWithdrawable(): {
|
|
69
43
|
amountX: number;
|
|
70
44
|
amountY: number;
|
|
71
45
|
};
|
|
72
|
-
/** Returns the maximum about of token0 the position can currently borrow */
|
|
73
|
-
getMaxBorrowableX(): number;
|
|
74
|
-
/** Returns the maximum about of token1 the position can currently borrow */
|
|
75
|
-
getMaxBorrowableY(): number;
|
|
76
46
|
}
|