@gainsnetwork/sdk 0.2.57-rc1 → 0.2.59-rc1
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.
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
"APE": {
|
|
19
19
|
"gTokenOpenPnlFeed": "0x0000000000000000000000000000000000000000",
|
|
20
20
|
"gToken": "0x0000000000000000000000000000000000000000"
|
|
21
|
+
},
|
|
22
|
+
"GNS": {
|
|
23
|
+
"gTokenOpenPnlFeed": "0x0000000000000000000000000000000000000000",
|
|
24
|
+
"gToken": "0x0000000000000000000000000000000000000000"
|
|
21
25
|
}
|
|
22
26
|
},
|
|
23
27
|
"42161": {
|
|
@@ -39,6 +43,10 @@
|
|
|
39
43
|
"APE": {
|
|
40
44
|
"gTokenOpenPnlFeed": "0x0000000000000000000000000000000000000000",
|
|
41
45
|
"gToken": "0x0000000000000000000000000000000000000000"
|
|
46
|
+
},
|
|
47
|
+
"GNS": {
|
|
48
|
+
"gTokenOpenPnlFeed": "0x0000000000000000000000000000000000000000",
|
|
49
|
+
"gToken": "0x0000000000000000000000000000000000000000"
|
|
42
50
|
}
|
|
43
51
|
},
|
|
44
52
|
"421614": {
|
|
@@ -60,6 +68,10 @@
|
|
|
60
68
|
"APE": {
|
|
61
69
|
"gTokenOpenPnlFeed": "0x0000000000000000000000000000000000000000",
|
|
62
70
|
"gToken": "0x0000000000000000000000000000000000000000"
|
|
71
|
+
},
|
|
72
|
+
"GNS": {
|
|
73
|
+
"gTokenOpenPnlFeed": "0x68F8D4ec2EF23a15e61e1642E730b6f69fB9A5De",
|
|
74
|
+
"gToken": "0x5ed4bEA869300DB39bE2a92a8B42e53453742a43"
|
|
63
75
|
}
|
|
64
76
|
},
|
|
65
77
|
"8453": {
|
|
@@ -81,6 +93,10 @@
|
|
|
81
93
|
"APE": {
|
|
82
94
|
"gTokenOpenPnlFeed": "0x0000000000000000000000000000000000000000",
|
|
83
95
|
"gToken": "0x0000000000000000000000000000000000000000"
|
|
96
|
+
},
|
|
97
|
+
"GNS": {
|
|
98
|
+
"gTokenOpenPnlFeed": "0x0000000000000000000000000000000000000000",
|
|
99
|
+
"gToken": "0x0000000000000000000000000000000000000000"
|
|
84
100
|
}
|
|
85
101
|
},
|
|
86
102
|
"33139": {
|
|
@@ -102,6 +118,10 @@
|
|
|
102
118
|
"APE": {
|
|
103
119
|
"gTokenOpenPnlFeed": "0x33FE6f374C4a44C50F4362c93372f0EB09d968F5",
|
|
104
120
|
"gToken": "0xDd9C98e5022AF88B9c991ab24F02B4A8Be81D860"
|
|
121
|
+
},
|
|
122
|
+
"GNS": {
|
|
123
|
+
"gTokenOpenPnlFeed": "0x0000000000000000000000000000000000000000",
|
|
124
|
+
"gToken": "0x0000000000000000000000000000000000000000"
|
|
105
125
|
}
|
|
106
126
|
}
|
|
107
127
|
}
|
package/lib/contracts/index.js
CHANGED
|
@@ -58,6 +58,7 @@ exports.COLLATERAL_TO_CHAIN_COLLATERAL_INDEX = {
|
|
|
58
58
|
[types_1.CollateralTypes.DAI]: 1,
|
|
59
59
|
[types_1.CollateralTypes.ETH]: 2,
|
|
60
60
|
[types_1.CollateralTypes.USDC]: 3,
|
|
61
|
+
[types_1.CollateralTypes.GNS]: 4,
|
|
61
62
|
},
|
|
62
63
|
[types_1.ChainId.BASE]: {
|
|
63
64
|
[types_1.CollateralTypes.USDC]: 1,
|
|
@@ -72,7 +73,8 @@ exports.COLLATERAL_TO_COLLATERAL_INDEX = {
|
|
|
72
73
|
[types_1.CollateralTypes.ETH]: 2,
|
|
73
74
|
[types_1.CollateralTypes.USDC]: 3,
|
|
74
75
|
[types_1.CollateralTypes.ARB]: 0,
|
|
75
|
-
[types_1.CollateralTypes.APE]: 0,
|
|
76
|
+
[types_1.CollateralTypes.APE]: 0,
|
|
77
|
+
[types_1.CollateralTypes.GNS]: 0, // not in use
|
|
76
78
|
};
|
|
77
79
|
__exportStar(require("./utils"), exports);
|
|
78
80
|
__exportStar(require("./addresses"), exports);
|
|
@@ -8,6 +8,7 @@ var CollateralTypes;
|
|
|
8
8
|
CollateralTypes["ARB"] = "ARB";
|
|
9
9
|
CollateralTypes["USDC"] = "USDC";
|
|
10
10
|
CollateralTypes["APE"] = "APE";
|
|
11
|
+
CollateralTypes["GNS"] = "GNS";
|
|
11
12
|
})(CollateralTypes = exports.CollateralTypes || (exports.CollateralTypes = {}));
|
|
12
13
|
var ContractsVersion;
|
|
13
14
|
(function (ContractsVersion) {
|
package/lib/trade/pnl.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { Fee, LiquidationParams, Trade, TradeInfo, TradeInitialAccFees } from ".
|
|
|
3
3
|
import { ContractsVersion } from "../contracts/types";
|
|
4
4
|
export type GetPnlContext = GetBorrowingFeeContext & {
|
|
5
5
|
fee: Fee | undefined;
|
|
6
|
-
maxGainP: number | undefined;
|
|
7
6
|
collateralPriceUsd: number | undefined;
|
|
8
7
|
contractsVersion: ContractsVersion | undefined;
|
|
9
8
|
feeMultiplier: number | undefined;
|
package/lib/trade/pnl.js
CHANGED
|
@@ -9,12 +9,10 @@ const getPnl = (price, trade, tradeInfo, initialAccFees, liquidationParams, useF
|
|
|
9
9
|
}
|
|
10
10
|
const posCollat = trade.collateralAmount;
|
|
11
11
|
const { openPrice, leverage } = trade;
|
|
12
|
-
const {
|
|
13
|
-
const maxGain = maxGainP === undefined ? Infinity : (maxGainP / 100) * posCollat;
|
|
12
|
+
const { fee } = context;
|
|
14
13
|
let pnlCollat = trade.long
|
|
15
14
|
? ((price - openPrice) / openPrice) * leverage * posCollat
|
|
16
15
|
: ((openPrice - price) / openPrice) * leverage * posCollat;
|
|
17
|
-
pnlCollat = pnlCollat > maxGain ? maxGain : pnlCollat;
|
|
18
16
|
if (useFees) {
|
|
19
17
|
pnlCollat -= (0, fees_1.getBorrowingFee)(posCollat * trade.leverage, trade.pairIndex, trade.long, initialAccFees, context);
|
|
20
18
|
}
|