@gmx-io/sdk 0.1.1-alpha-1 → 0.1.2
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.
- package/build/src/configs/chains.d.ts +3 -0
- package/build/src/configs/chains.js +6 -0
- package/build/src/configs/contracts.d.ts +220 -1
- package/build/src/configs/contracts.js +67 -8
- package/build/src/configs/markets.js +14 -0
- package/build/src/configs/tokens.js +40 -5
- package/build/src/modules/markets/index.js +1 -7
- package/build/src/modules/markets/query-builders.d.ts +1 -1
- package/build/src/modules/markets/types.d.ts +4 -1
- package/build/src/modules/orders/utils.js +1 -1
- package/build/src/modules/positions/positions.js +17 -4
- package/build/src/modules/utils/utils.d.ts +1 -1
- package/build/src/modules/utils/utils.js +1 -1
- package/build/src/prebuilt/hashedKinkModelMarketRatesKeys.json +16 -0
- package/build/src/prebuilt/hashedMarketConfigKeys.json +100 -0
- package/build/src/prebuilt/hashedMarketValuesKeys.json +30 -0
- package/build/src/types/common.d.ts +1 -0
- package/build/src/types/fees.d.ts +2 -1
- package/build/src/types/markets.d.ts +7 -19
- package/build/src/types/orders.d.ts +3 -5
- package/build/src/types/positions.d.ts +11 -4
- package/build/src/types/trade.d.ts +1 -0
- package/build/src/types/tradeHistory.d.ts +4 -1
- package/build/src/utils/__tests__/LruCache.spec.d.ts +1 -0
- package/build/src/utils/__tests__/LruCache.spec.js +42 -0
- package/build/src/utils/__tests__/bigmath.spec.d.ts +1 -0
- package/build/src/utils/__tests__/bigmath.spec.js +37 -0
- package/build/src/utils/__tests__/hash.spec.d.ts +1 -0
- package/build/src/utils/__tests__/hash.spec.js +40 -0
- package/build/src/utils/__tests__/markets.spec.d.ts +1 -0
- package/build/src/utils/__tests__/markets.spec.js +264 -0
- package/build/src/utils/__tests__/numbers.spec.d.ts +1 -0
- package/build/src/utils/__tests__/numbers.spec.js +56 -0
- package/build/src/utils/__tests__/objects.spec.d.ts +1 -0
- package/build/src/utils/__tests__/objects.spec.js +58 -0
- package/build/src/utils/__tests__/positions.spec.d.ts +1 -0
- package/build/src/utils/__tests__/positions.spec.js +177 -0
- package/build/src/utils/__tests__/prices.spec.d.ts +1 -0
- package/build/src/utils/__tests__/prices.spec.js +58 -0
- package/build/src/utils/__tests__/referrals.spec.d.ts +1 -0
- package/build/src/utils/__tests__/referrals.spec.js +17 -0
- package/build/src/utils/__tests__/subgraph.spec.d.ts +1 -0
- package/build/src/utils/__tests__/subgraph.spec.js +162 -0
- package/build/src/utils/__tests__/tokens.spec.d.ts +1 -0
- package/build/src/utils/__tests__/tokens.spec.js +82 -0
- package/build/src/utils/__tests__/trade.spec.d.ts +1 -0
- package/build/src/utils/__tests__/trade.spec.js +35 -0
- package/build/src/utils/bigmath.d.ts +1 -1
- package/build/src/utils/bigmath.js +6 -1
- package/build/src/utils/callContract.js +5 -1
- package/build/src/utils/contracts.d.ts +4 -0
- package/build/src/utils/contracts.js +2 -0
- package/build/src/utils/fees/executionFee.d.ts +1 -33
- package/build/src/utils/fees/executionFee.js +2 -48
- package/build/src/utils/fees/executionFee.spec.d.ts +1 -0
- package/build/src/utils/fees/executionFee.spec.js +64 -0
- package/build/src/utils/fees/index.d.ts +2 -0
- package/build/src/utils/fees/index.js +5 -0
- package/build/src/utils/markets.d.ts +9 -2
- package/build/src/utils/markets.js +33 -10
- package/build/src/utils/orders.js +0 -8
- package/build/src/utils/positions.js +3 -3
- package/build/src/utils/prices.d.ts +1 -6
- package/build/src/utils/prices.js +0 -9
- package/build/src/utils/referrals.d.ts +2 -0
- package/build/src/utils/referrals.js +17 -15
- package/build/src/utils/swapStats.d.ts +1 -0
- package/build/src/utils/swapStats.js +12 -1
- package/build/src/utils/testUtil.d.ts +5 -5
- package/build/src/utils/tokens.d.ts +4 -0
- package/build/src/utils/tokens.js +4 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -3
- package/build/src/types/amounts.d.ts +0 -223
- package/build/src/types/amounts.js +0 -17
- package/build/src/types/syntheticsEvents.d.ts +0 -88
- /package/build/src/types/{syntheticsEvents.js → common.js} +0 -0
|
@@ -2,6 +2,9 @@ import { Chain } from "viem/chains";
|
|
|
2
2
|
export declare const AVALANCHE = 43114;
|
|
3
3
|
export declare const AVALANCHE_FUJI = 43113;
|
|
4
4
|
export declare const ARBITRUM = 42161;
|
|
5
|
+
export declare const BSС_MAINNET = 56;
|
|
6
|
+
export declare const BSС_TESTNET = 97;
|
|
7
|
+
export declare const ETH_MAINNET = 1;
|
|
5
8
|
export declare const SUPPORTED_CHAIN_IDS: number[];
|
|
6
9
|
export declare const HIGH_EXECUTION_FEES_MAP: {
|
|
7
10
|
42161: number;
|
|
@@ -2,12 +2,18 @@ import { arbitrum, avalanche, avalancheFuji } from "viem/chains";
|
|
|
2
2
|
export const AVALANCHE = 43114;
|
|
3
3
|
export const AVALANCHE_FUJI = 43113;
|
|
4
4
|
export const ARBITRUM = 42161;
|
|
5
|
+
export const BSС_MAINNET = 56;
|
|
6
|
+
export const BSС_TESTNET = 97;
|
|
7
|
+
export const ETH_MAINNET = 1;
|
|
5
8
|
export const SUPPORTED_CHAIN_IDS = [ARBITRUM, AVALANCHE];
|
|
6
9
|
export const HIGH_EXECUTION_FEES_MAP = {
|
|
7
10
|
[ARBITRUM]: 5, // 5 USD
|
|
8
11
|
[AVALANCHE]: 5, // 5 USD
|
|
9
12
|
[AVALANCHE_FUJI]: 5, // 5 USD
|
|
10
13
|
};
|
|
14
|
+
// added to maxPriorityFeePerGas
|
|
15
|
+
// applied to EIP-1559 transactions only
|
|
16
|
+
// is not applied to execution fee calculation
|
|
11
17
|
export const MAX_FEE_PER_GAS_MAP = {
|
|
12
18
|
[AVALANCHE]: 200000000000n, // 200 gwei
|
|
13
19
|
};
|
|
@@ -1,3 +1,222 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const CONTRACTS: {
|
|
3
|
+
56: {
|
|
4
|
+
Treasury: string;
|
|
5
|
+
BUSD: string;
|
|
6
|
+
GMT: string;
|
|
7
|
+
Vault: string;
|
|
8
|
+
Router: string;
|
|
9
|
+
Reader: string;
|
|
10
|
+
AmmFactory: string;
|
|
11
|
+
AmmFactoryV2: string;
|
|
12
|
+
OrderBook: string;
|
|
13
|
+
OrderBookReader: string;
|
|
14
|
+
GmxMigrator: string;
|
|
15
|
+
USDG: string;
|
|
16
|
+
NATIVE_TOKEN: string;
|
|
17
|
+
XGMT: string;
|
|
18
|
+
GMT_USDG_PAIR: string;
|
|
19
|
+
XGMT_USDG_PAIR: string;
|
|
20
|
+
GMT_USDG_FARM: string;
|
|
21
|
+
XGMT_USDG_FARM: string;
|
|
22
|
+
USDG_YIELD_TRACKER: string;
|
|
23
|
+
XGMT_YIELD_TRACKER: string;
|
|
24
|
+
GMT_USDG_FARM_TRACKER_XGMT: string;
|
|
25
|
+
GMT_USDG_FARM_TRACKER_NATIVE: string;
|
|
26
|
+
XGMT_USDG_FARM_TRACKER_XGMT: string;
|
|
27
|
+
XGMT_USDG_FARM_TRACKER_NATIVE: string;
|
|
28
|
+
AUTO: string;
|
|
29
|
+
AUTO_USDG_PAIR: string;
|
|
30
|
+
AUTO_USDG_FARM: string;
|
|
31
|
+
AUTO_USDG_FARM_TRACKER_XGMT: string;
|
|
32
|
+
AUTO_USDG_FARM_TRACKER_NATIVE: string;
|
|
33
|
+
GMT_GMX_IOU: string;
|
|
34
|
+
XGMT_GMX_IOU: string;
|
|
35
|
+
GMT_USDG_GMX_IOU: string;
|
|
36
|
+
XGMT_USDG_GMX_IOU: string;
|
|
37
|
+
};
|
|
38
|
+
97: {
|
|
39
|
+
Vault: string;
|
|
40
|
+
Router: string;
|
|
41
|
+
Reader: string;
|
|
42
|
+
AmmFactory: string;
|
|
43
|
+
AmmFactoryV2: string;
|
|
44
|
+
OrderBook: string;
|
|
45
|
+
OrderBookReader: string;
|
|
46
|
+
GmxMigrator: string;
|
|
47
|
+
USDG: string;
|
|
48
|
+
GMT: string;
|
|
49
|
+
NATIVE_TOKEN: string;
|
|
50
|
+
XGMT: string;
|
|
51
|
+
GMT_USDG_PAIR: string;
|
|
52
|
+
XGMT_USDG_PAIR: string;
|
|
53
|
+
GMT_USDG_FARM: string;
|
|
54
|
+
XGMT_USDG_FARM: string;
|
|
55
|
+
USDG_YIELD_TRACKER: string;
|
|
56
|
+
XGMT_YIELD_TRACKER: string;
|
|
57
|
+
GMT_USDG_FARM_TRACKER_XGMT: string;
|
|
58
|
+
GMT_USDG_FARM_TRACKER_NATIVE: string;
|
|
59
|
+
XGMT_USDG_FARM_TRACKER_XGMT: string;
|
|
60
|
+
XGMT_USDG_FARM_TRACKER_NATIVE: string;
|
|
61
|
+
GMT_GMX_IOU: string;
|
|
62
|
+
XGMT_GMX_IOU: string;
|
|
63
|
+
GMT_USDG_GMX_IOU: string;
|
|
64
|
+
XGMT_USDG_GMX_IOU: string;
|
|
65
|
+
};
|
|
66
|
+
42161: {
|
|
67
|
+
Vault: string;
|
|
68
|
+
Router: string;
|
|
69
|
+
VaultReader: string;
|
|
70
|
+
Reader: string;
|
|
71
|
+
GlpManager: string;
|
|
72
|
+
RewardRouter: string;
|
|
73
|
+
GlpRewardRouter: string;
|
|
74
|
+
RewardReader: string;
|
|
75
|
+
GovToken: string;
|
|
76
|
+
NATIVE_TOKEN: string;
|
|
77
|
+
GLP: string;
|
|
78
|
+
GMX: string;
|
|
79
|
+
ES_GMX: string;
|
|
80
|
+
BN_GMX: string;
|
|
81
|
+
USDG: string;
|
|
82
|
+
ES_GMX_IOU: string;
|
|
83
|
+
StakedGmxTracker: string;
|
|
84
|
+
BonusGmxTracker: string;
|
|
85
|
+
FeeGmxTracker: string;
|
|
86
|
+
StakedGlpTracker: string;
|
|
87
|
+
FeeGlpTracker: string;
|
|
88
|
+
ExtendedGmxTracker: string;
|
|
89
|
+
StakedGmxDistributor: string;
|
|
90
|
+
StakedGlpDistributor: string;
|
|
91
|
+
GmxVester: string;
|
|
92
|
+
GlpVester: string;
|
|
93
|
+
AffiliateVester: string;
|
|
94
|
+
OrderBook: string;
|
|
95
|
+
OrderExecutor: string;
|
|
96
|
+
OrderBookReader: string;
|
|
97
|
+
PositionRouter: string;
|
|
98
|
+
PositionManager: string;
|
|
99
|
+
UniswapGmxEthPool: string;
|
|
100
|
+
ReferralStorage: string;
|
|
101
|
+
ReferralReader: string;
|
|
102
|
+
Timelock: string;
|
|
103
|
+
DataStore: string;
|
|
104
|
+
EventEmitter: string;
|
|
105
|
+
SubaccountRouter: string;
|
|
106
|
+
ExchangeRouter: string;
|
|
107
|
+
DepositVault: string;
|
|
108
|
+
WithdrawalVault: string;
|
|
109
|
+
OrderVault: string;
|
|
110
|
+
ShiftVault: string;
|
|
111
|
+
SyntheticsReader: string;
|
|
112
|
+
SyntheticsRouter: string;
|
|
113
|
+
GlvReader: string;
|
|
114
|
+
GlvRouter: string;
|
|
115
|
+
GlvVault: string;
|
|
116
|
+
Multicall: string;
|
|
117
|
+
};
|
|
118
|
+
43114: {
|
|
119
|
+
Vault: string;
|
|
120
|
+
Router: string;
|
|
121
|
+
VaultReader: string;
|
|
122
|
+
Reader: string;
|
|
123
|
+
GlpManager: string;
|
|
124
|
+
RewardRouter: string;
|
|
125
|
+
GlpRewardRouter: string;
|
|
126
|
+
RewardReader: string;
|
|
127
|
+
GovToken: string;
|
|
128
|
+
NATIVE_TOKEN: string;
|
|
129
|
+
GLP: string;
|
|
130
|
+
GMX: string;
|
|
131
|
+
ES_GMX: string;
|
|
132
|
+
BN_GMX: string;
|
|
133
|
+
USDG: string;
|
|
134
|
+
ES_GMX_IOU: string;
|
|
135
|
+
StakedGmxTracker: string;
|
|
136
|
+
BonusGmxTracker: string;
|
|
137
|
+
FeeGmxTracker: string;
|
|
138
|
+
StakedGlpTracker: string;
|
|
139
|
+
FeeGlpTracker: string;
|
|
140
|
+
ExtendedGmxTracker: string;
|
|
141
|
+
StakedGmxDistributor: string;
|
|
142
|
+
StakedGlpDistributor: string;
|
|
143
|
+
GmxVester: string;
|
|
144
|
+
GlpVester: string;
|
|
145
|
+
AffiliateVester: string;
|
|
146
|
+
OrderBook: string;
|
|
147
|
+
OrderExecutor: string;
|
|
148
|
+
OrderBookReader: string;
|
|
149
|
+
PositionRouter: string;
|
|
150
|
+
PositionManager: string;
|
|
151
|
+
TraderJoeGmxAvaxPool: string;
|
|
152
|
+
ReferralStorage: string;
|
|
153
|
+
ReferralReader: string;
|
|
154
|
+
Timelock: string;
|
|
155
|
+
DataStore: string;
|
|
156
|
+
EventEmitter: string;
|
|
157
|
+
SubaccountRouter: string;
|
|
158
|
+
ExchangeRouter: string;
|
|
159
|
+
DepositVault: string;
|
|
160
|
+
WithdrawalVault: string;
|
|
161
|
+
OrderVault: string;
|
|
162
|
+
ShiftVault: string;
|
|
163
|
+
SyntheticsReader: string;
|
|
164
|
+
SyntheticsRouter: string;
|
|
165
|
+
GlvReader: string;
|
|
166
|
+
GlvRouter: string;
|
|
167
|
+
GlvVault: string;
|
|
168
|
+
Multicall: string;
|
|
169
|
+
};
|
|
170
|
+
43113: {
|
|
171
|
+
Vault: "0x0000000000000000000000000000000000000000";
|
|
172
|
+
Router: "0x0000000000000000000000000000000000000000";
|
|
173
|
+
VaultReader: "0x0000000000000000000000000000000000000000";
|
|
174
|
+
Reader: "0x0000000000000000000000000000000000000000";
|
|
175
|
+
GlpManager: "0x0000000000000000000000000000000000000000";
|
|
176
|
+
RewardRouter: "0x0000000000000000000000000000000000000000";
|
|
177
|
+
RewardReader: "0x0000000000000000000000000000000000000000";
|
|
178
|
+
GlpRewardRouter: "0x0000000000000000000000000000000000000000";
|
|
179
|
+
NATIVE_TOKEN: string;
|
|
180
|
+
GLP: "0x0000000000000000000000000000000000000000";
|
|
181
|
+
GMX: "0x0000000000000000000000000000000000000000";
|
|
182
|
+
ES_GMX: "0x0000000000000000000000000000000000000000";
|
|
183
|
+
BN_GMX: "0x0000000000000000000000000000000000000000";
|
|
184
|
+
USDG: "0x0000000000000000000000000000000000000000";
|
|
185
|
+
ES_GMX_IOU: "0x0000000000000000000000000000000000000000";
|
|
186
|
+
StakedGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
187
|
+
BonusGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
188
|
+
FeeGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
189
|
+
StakedGlpTracker: "0x0000000000000000000000000000000000000000";
|
|
190
|
+
FeeGlpTracker: "0x0000000000000000000000000000000000000000";
|
|
191
|
+
ExtendedGmxTracker: "0x0000000000000000000000000000000000000000";
|
|
192
|
+
StakedGmxDistributor: "0x0000000000000000000000000000000000000000";
|
|
193
|
+
StakedGlpDistributor: "0x0000000000000000000000000000000000000000";
|
|
194
|
+
GmxVester: "0x0000000000000000000000000000000000000000";
|
|
195
|
+
GlpVester: "0x0000000000000000000000000000000000000000";
|
|
196
|
+
AffiliateVester: "0x0000000000000000000000000000000000000000";
|
|
197
|
+
OrderBook: "0x0000000000000000000000000000000000000000";
|
|
198
|
+
OrderExecutor: "0x0000000000000000000000000000000000000000";
|
|
199
|
+
OrderBookReader: "0x0000000000000000000000000000000000000000";
|
|
200
|
+
PositionRouter: "0x0000000000000000000000000000000000000000";
|
|
201
|
+
PositionManager: "0x0000000000000000000000000000000000000000";
|
|
202
|
+
TraderJoeGmxAvaxPool: "0x0000000000000000000000000000000000000000";
|
|
203
|
+
ReferralStorage: string;
|
|
204
|
+
ReferralReader: "0x0000000000000000000000000000000000000000";
|
|
205
|
+
DataStore: string;
|
|
206
|
+
EventEmitter: string;
|
|
207
|
+
ExchangeRouter: string;
|
|
208
|
+
SubaccountRouter: string;
|
|
209
|
+
DepositVault: string;
|
|
210
|
+
WithdrawalVault: string;
|
|
211
|
+
OrderVault: string;
|
|
212
|
+
ShiftVault: string;
|
|
213
|
+
SyntheticsReader: string;
|
|
214
|
+
SyntheticsRouter: string;
|
|
215
|
+
Timelock: "0x0000000000000000000000000000000000000000";
|
|
216
|
+
GlvReader: string;
|
|
217
|
+
GlvRouter: string;
|
|
218
|
+
GlvVault: string;
|
|
219
|
+
Multicall: string;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
3
222
|
export declare function getContract(chainId: number, name: string): Address;
|
|
@@ -1,12 +1,71 @@
|
|
|
1
1
|
import { zeroAddress } from "viem";
|
|
2
|
-
import { ARBITRUM, AVALANCHE, AVALANCHE_FUJI } from "./chains";
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { ARBITRUM, AVALANCHE, AVALANCHE_FUJI, BSС_MAINNET, BSС_TESTNET } from "./chains";
|
|
3
|
+
export const CONTRACTS = {
|
|
4
|
+
[BSС_MAINNET]: {
|
|
5
|
+
// bsc mainnet
|
|
6
|
+
Treasury: "0xa44E7252a0C137748F523F112644042E5987FfC7",
|
|
7
|
+
BUSD: "0xe9e7cea3dedca5984780bafc599bd69add087d56",
|
|
8
|
+
GMT: "0x99e92123eB77Bc8f999316f622e5222498438784",
|
|
9
|
+
Vault: "0xc73A8DcAc88498FD4b4B1b2AaA37b0a2614Ff67B",
|
|
10
|
+
Router: "0xD46B23D042E976F8666F554E928e0Dc7478a8E1f",
|
|
11
|
+
Reader: "0x087A618fD25c92B61254DBe37b09E5E8065FeaE7",
|
|
12
|
+
AmmFactory: "0xBCfCcbde45cE874adCB698cC183deBcF17952812",
|
|
13
|
+
AmmFactoryV2: "0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73",
|
|
14
|
+
OrderBook: "0x1111111111111111111111111111111111111111",
|
|
15
|
+
OrderBookReader: "0x1111111111111111111111111111111111111111",
|
|
16
|
+
GmxMigrator: "0xDEF2af818514c1Ca1A9bBe2a4D45E28f260063f9",
|
|
17
|
+
USDG: "0x85E76cbf4893c1fbcB34dCF1239A91CE2A4CF5a7",
|
|
18
|
+
NATIVE_TOKEN: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
|
|
19
|
+
XGMT: "0xe304ff0983922787Fd84BC9170CD21bF78B16B10",
|
|
20
|
+
GMT_USDG_PAIR: "0xa41e57459f09a126F358E118b693789d088eA8A0",
|
|
21
|
+
XGMT_USDG_PAIR: "0x0b622208fc0691C2486A3AE6B7C875b4A174b317",
|
|
22
|
+
GMT_USDG_FARM: "0x3E8B08876c791dC880ADC8f965A02e53Bb9C0422",
|
|
23
|
+
XGMT_USDG_FARM: "0x68D7ee2A16AB7c0Ee1D670BECd144166d2Ae0759",
|
|
24
|
+
USDG_YIELD_TRACKER: "0x0EF0Cf825B8e9F89A43FfD392664131cFB4cfA89",
|
|
25
|
+
XGMT_YIELD_TRACKER: "0x82A012A9b3003b18B6bCd6052cbbef7Fa4892e80",
|
|
26
|
+
GMT_USDG_FARM_TRACKER_XGMT: "0x08FAb024BEfcb6068847726b2eccEAd18b6c23Cd",
|
|
27
|
+
GMT_USDG_FARM_TRACKER_NATIVE: "0xd8E26637B34B2487Cad1f91808878a391134C5c2",
|
|
28
|
+
XGMT_USDG_FARM_TRACKER_XGMT: "0x026A02F7F26C1AFccb9Cba7C4df3Dc810F4e92e8",
|
|
29
|
+
XGMT_USDG_FARM_TRACKER_NATIVE: "0x22458CEbD14a9679b2880147d08CA1ce5aa40E84",
|
|
30
|
+
AUTO: "0xa184088a740c695E156F91f5cC086a06bb78b827",
|
|
31
|
+
AUTO_USDG_PAIR: "0x0523FD5C53ea5419B4DAF656BC1b157dDFE3ce50",
|
|
32
|
+
AUTO_USDG_FARM: "0xE6958298328D02051769282628a3b4178D0F3A47",
|
|
33
|
+
AUTO_USDG_FARM_TRACKER_XGMT: "0x093b8be41c1A30704De84a9521632f9a139c08bd",
|
|
34
|
+
AUTO_USDG_FARM_TRACKER_NATIVE: "0x23ed48E5dce3acC7704d0ce275B7b9a0e346b63A",
|
|
35
|
+
GMT_GMX_IOU: "0x47052469970C2484729875CC9E2dd2683fcE71fb",
|
|
36
|
+
XGMT_GMX_IOU: "0xeB3733DFe3b68C9d26898De2493A3Bb59FDb4A7B",
|
|
37
|
+
GMT_USDG_GMX_IOU: "0x481312655F81b5e249780A6a49735335BF6Ca7f4",
|
|
38
|
+
XGMT_USDG_GMX_IOU: "0x8095F1A92526C304623483018aA28cC6E62EB1e1",
|
|
39
|
+
},
|
|
40
|
+
[BSС_TESTNET]: {
|
|
41
|
+
// bsc testnet
|
|
42
|
+
Vault: "0x1B183979a5cd95FAF392c8002dbF0D5A1C687D9a",
|
|
43
|
+
Router: "0x10800f683aa564534497a5b67F45bE3556a955AB",
|
|
44
|
+
Reader: "0x98D4742F1B6a821bae672Cd8721283b91996E454",
|
|
45
|
+
AmmFactory: "0x6725f303b657a9451d8ba641348b6761a6cc7a17",
|
|
46
|
+
AmmFactoryV2: "0x1111111111111111111111111111111111111111",
|
|
47
|
+
OrderBook: "0x9afD7B4f0b58d65F6b2978D3581383a06b2ac4e9",
|
|
48
|
+
OrderBookReader: "0x0713562970D1A802Fa3FeB1D15F9809943982Ea9",
|
|
49
|
+
GmxMigrator: "0xDEF2af818514c1Ca1A9bBe2a4D45E28f260063f9",
|
|
50
|
+
USDG: "0x2D549bdBf810523fe9cd660cC35fE05f0FcAa028",
|
|
51
|
+
GMT: "0xedba0360a44f885ed390fad01aa34d00d2532817",
|
|
52
|
+
NATIVE_TOKEN: "0x612777Eea37a44F7a95E3B101C39e1E2695fa6C2",
|
|
53
|
+
XGMT: "0x28cba798eca1a3128ffd1b734afb93870f22e613",
|
|
54
|
+
GMT_USDG_PAIR: "0xe0b0a315746f51932de033ab27223d85114c6b85",
|
|
55
|
+
XGMT_USDG_PAIR: "0x0108de1eea192ce8448080c3d90a1560cf643fa0",
|
|
56
|
+
GMT_USDG_FARM: "0xbe3cB06CE03cA692b77902040479572Ba8D01b0B",
|
|
57
|
+
XGMT_USDG_FARM: "0x138E92195D4B99CE3618092D3F9FA830d9A69B4b",
|
|
58
|
+
USDG_YIELD_TRACKER: "0x62B49Bc3bF252a5DB26D88ccc7E61119e3179B4f",
|
|
59
|
+
XGMT_YIELD_TRACKER: "0x5F235A582e0993eE9466FeEb8F7B4682993a57d0",
|
|
60
|
+
GMT_USDG_FARM_TRACKER_XGMT: "0x4f8EE3aE1152422cbCaFACd4e3041ba2D859913C",
|
|
61
|
+
GMT_USDG_FARM_TRACKER_NATIVE: "0xd691B26E544Fe370f39A776964c991363aF72e56",
|
|
62
|
+
XGMT_USDG_FARM_TRACKER_XGMT: "0xfd5617CFB082Ba9bcD62d654603972AE312bC695",
|
|
63
|
+
XGMT_USDG_FARM_TRACKER_NATIVE: "0x0354387DD85b7D8aaD1611B3D167A384d6AE0c28",
|
|
64
|
+
GMT_GMX_IOU: "0x47052469970C2484729875CC9E2dd2683fcE71fb",
|
|
65
|
+
XGMT_GMX_IOU: "0xeB3733DFe3b68C9d26898De2493A3Bb59FDb4A7B",
|
|
66
|
+
GMT_USDG_GMX_IOU: "0x481312655F81b5e249780A6a49735335BF6Ca7f4",
|
|
67
|
+
XGMT_USDG_GMX_IOU: "0x8095F1A92526C304623483018aA28cC6E62EB1e1",
|
|
68
|
+
},
|
|
10
69
|
[ARBITRUM]: {
|
|
11
70
|
// arbitrum mainnet
|
|
12
71
|
Vault: "0x489ee077994B6658eAfA855C308275EAd8097C4A",
|
|
@@ -429,6 +429,20 @@ export const MARKETS = {
|
|
|
429
429
|
longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
430
430
|
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
431
431
|
},
|
|
432
|
+
// DYDX/USD [WBTC-USDC]
|
|
433
|
+
"0x467C4A46287F6C4918dDF780D4fd7b46419c2291": {
|
|
434
|
+
marketTokenAddress: "0x467C4A46287F6C4918dDF780D4fd7b46419c2291",
|
|
435
|
+
indexTokenAddress: "0x0739Ad7AeA69aD36EdEb91b0e55cAC140427c632",
|
|
436
|
+
longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
437
|
+
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
438
|
+
},
|
|
439
|
+
// INJ/USD [WBTC-USDC]
|
|
440
|
+
"0x16466a03449CB9218EB6A980Aa4a44aaCEd27C25": {
|
|
441
|
+
marketTokenAddress: "0x16466a03449CB9218EB6A980Aa4a44aaCEd27C25",
|
|
442
|
+
indexTokenAddress: "0xfdE73EddbE6c5712A12B72c470F8FE5c77A7fF17",
|
|
443
|
+
longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
444
|
+
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
445
|
+
},
|
|
432
446
|
},
|
|
433
447
|
[AVALANCHE]: {
|
|
434
448
|
// BTC/USD [BTC-USDC]
|
|
@@ -280,6 +280,7 @@ export const TOKENS = {
|
|
|
280
280
|
priceDecimals: 4,
|
|
281
281
|
address: "0x565609fAF65B92F7be02468acF86f8979423e514",
|
|
282
282
|
decimals: 18,
|
|
283
|
+
categories: ["layer1"],
|
|
283
284
|
imageUrl: "https://assets.coingecko.com/coins/images/12559/small/coin-round-red.png?1604021818",
|
|
284
285
|
coingeckoUrl: "https://www.coingecko.com/en/coins/avalanche",
|
|
285
286
|
coingeckoSymbol: "AVAX",
|
|
@@ -300,7 +301,7 @@ export const TOKENS = {
|
|
|
300
301
|
symbol: "PEPE",
|
|
301
302
|
address: "0x25d887Ce7a35172C62FeBFD67a1856F20FaEbB00",
|
|
302
303
|
decimals: 18,
|
|
303
|
-
priceDecimals:
|
|
304
|
+
priceDecimals: 8,
|
|
304
305
|
categories: ["meme"],
|
|
305
306
|
imageUrl: "https://assets.coingecko.com/coins/images/29850/standard/pepe-token.jpeg?1696528776",
|
|
306
307
|
coingeckoUrl: "https://www.coingecko.com/en/coins/pepe",
|
|
@@ -359,7 +360,7 @@ export const TOKENS = {
|
|
|
359
360
|
assetSymbol: "SHIB",
|
|
360
361
|
address: "0x3E57D02f9d196873e55727382974b02EdebE6bfd",
|
|
361
362
|
decimals: 18,
|
|
362
|
-
priceDecimals:
|
|
363
|
+
priceDecimals: 9,
|
|
363
364
|
categories: ["meme"],
|
|
364
365
|
imageUrl: "https://assets.coingecko.com/coins/images/11939/standard/shiba.png?1696511800",
|
|
365
366
|
coingeckoUrl: "https://www.coingecko.com/en/coins/shiba-inu",
|
|
@@ -389,7 +390,7 @@ export const TOKENS = {
|
|
|
389
390
|
symbol: "SATS",
|
|
390
391
|
address: "0x2cD2eB61D17b78239Fcd19aafF72981B5D5eF319",
|
|
391
392
|
decimals: 6,
|
|
392
|
-
priceDecimals:
|
|
393
|
+
priceDecimals: 11,
|
|
393
394
|
categories: ["meme"],
|
|
394
395
|
imageUrl: "https://assets.coingecko.com/coins/images/30666/standard/_dD8qr3M_400x400.png?1702913020",
|
|
395
396
|
coingeckoUrl: "https://www.coingecko.com/en/coins/sats-ordinals",
|
|
@@ -498,7 +499,7 @@ export const TOKENS = {
|
|
|
498
499
|
symbol: "BONK",
|
|
499
500
|
address: "0x1FD10E767187A92f0AB2ABDEEF4505e319cA06B2",
|
|
500
501
|
decimals: 5,
|
|
501
|
-
priceDecimals:
|
|
502
|
+
priceDecimals: 9,
|
|
502
503
|
categories: ["meme"],
|
|
503
504
|
imageUrl: "https://assets.coingecko.com/coins/images/28600/standard/bonk.jpg?1696527587",
|
|
504
505
|
coingeckoUrl: "https://www.coingecko.com/en/coins/bonk",
|
|
@@ -532,7 +533,7 @@ export const TOKENS = {
|
|
|
532
533
|
symbol: "FLOKI",
|
|
533
534
|
address: "0x6792c5B8962ffbDD020c6b6FD0Be7b182e0e33a3",
|
|
534
535
|
decimals: 9,
|
|
535
|
-
priceDecimals:
|
|
536
|
+
priceDecimals: 8,
|
|
536
537
|
categories: ["meme"],
|
|
537
538
|
imageUrl: "https://assets.coingecko.com/coins/images/16746/standard/PNG_image.png?1696516318",
|
|
538
539
|
coingeckoUrl: "https://www.coingecko.com/en/coins/floki",
|
|
@@ -635,6 +636,39 @@ export const TOKENS = {
|
|
|
635
636
|
coingeckoUrl: "https://www.coingecko.com/en/coins/render",
|
|
636
637
|
isSynthetic: true,
|
|
637
638
|
},
|
|
639
|
+
{
|
|
640
|
+
name: "Filecoin",
|
|
641
|
+
symbol: "FIL",
|
|
642
|
+
address: "0x3AeBb98f57081DcBEb0B8EA823Cf84900A31e5D8",
|
|
643
|
+
decimals: 18,
|
|
644
|
+
categories: ["layer1"],
|
|
645
|
+
priceDecimals: 4,
|
|
646
|
+
imageUrl: "https://assets.coingecko.com/coins/images/12817/standard/filecoin.png?1696512609",
|
|
647
|
+
coingeckoUrl: "https://www.coingecko.com/en/coins/filecoin",
|
|
648
|
+
isSynthetic: true,
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
name: "dYdX",
|
|
652
|
+
symbol: "DYDX",
|
|
653
|
+
address: "0x0739Ad7AeA69aD36EdEb91b0e55cAC140427c632",
|
|
654
|
+
decimals: 18,
|
|
655
|
+
priceDecimals: 4,
|
|
656
|
+
categories: ["layer1", "defi"],
|
|
657
|
+
imageUrl: "https://assets.coingecko.com/coins/images/32594/standard/dydx.png?1698673495",
|
|
658
|
+
coingeckoUrl: "https://www.coingecko.com/en/coins/dydx-chain",
|
|
659
|
+
isSynthetic: true,
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
name: "Injective",
|
|
663
|
+
symbol: "INJ",
|
|
664
|
+
address: "0xfdE73EddbE6c5712A12B72c470F8FE5c77A7fF17",
|
|
665
|
+
decimals: 18,
|
|
666
|
+
priceDecimals: 4,
|
|
667
|
+
categories: ["layer1"],
|
|
668
|
+
imageUrl: "https://assets.coingecko.com/coins/images/12882/standard/Secondary_Symbol.png?1696512670",
|
|
669
|
+
coingeckoUrl: "https://www.coingecko.com/en/coins/injective",
|
|
670
|
+
isSynthetic: true,
|
|
671
|
+
},
|
|
638
672
|
{
|
|
639
673
|
name: "GMX LP",
|
|
640
674
|
symbol: "GLP",
|
|
@@ -682,6 +716,7 @@ export const TOKENS = {
|
|
|
682
716
|
address: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
|
|
683
717
|
isWrapped: true,
|
|
684
718
|
baseSymbol: "AVAX",
|
|
719
|
+
categories: ["layer1"],
|
|
685
720
|
imageUrl: "https://assets.coingecko.com/coins/images/12559/small/coin-round-red.png?1604021818",
|
|
686
721
|
coingeckoUrl: "https://www.coingecko.com/en/coins/avalanche",
|
|
687
722
|
explorerUrl: "https://snowtrace.io/address/0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
|
|
@@ -90,12 +90,6 @@ export class Markets extends Module {
|
|
|
90
90
|
positionImpactPoolAmount: dataStoreValues.positionImpactPoolAmount.returnValues[0],
|
|
91
91
|
swapImpactPoolAmountLong: dataStoreValues.swapImpactPoolAmountLong.returnValues[0],
|
|
92
92
|
swapImpactPoolAmountShort: dataStoreValues.swapImpactPoolAmountShort.returnValues[0],
|
|
93
|
-
pnlLongMax: poolValueInfoMax.longPnl,
|
|
94
|
-
pnlLongMin: poolValueInfoMin.longPnl,
|
|
95
|
-
pnlShortMax: poolValueInfoMax.shortPnl,
|
|
96
|
-
pnlShortMin: poolValueInfoMin.shortPnl,
|
|
97
|
-
netPnlMax: poolValueInfoMax.netPnl,
|
|
98
|
-
netPnlMin: poolValueInfoMin.netPnl,
|
|
99
93
|
borrowingFactorPerSecondForLongs: readerValues.marketInfo.returnValues.borrowingFactorPerSecondForLongs,
|
|
100
94
|
borrowingFactorPerSecondForShorts: readerValues.marketInfo.returnValues.borrowingFactorPerSecondForShorts,
|
|
101
95
|
fundingFactorPerSecond: nextFunding.fundingFactorPerSecond,
|
|
@@ -320,7 +314,7 @@ export class Markets extends Module {
|
|
|
320
314
|
return data?.positionsVolume.length
|
|
321
315
|
? data?.positionsVolume.reduce((acc, { market, volume }) => {
|
|
322
316
|
return { ...acc, [market]: BigInt(volume) };
|
|
323
|
-
})
|
|
317
|
+
}, {})
|
|
324
318
|
: {};
|
|
325
319
|
});
|
|
326
320
|
}
|
|
@@ -32,7 +32,7 @@ export declare function buildMarketsConfigsRequest(chainId: number, { marketsDat
|
|
|
32
32
|
dataStoreAddress: string;
|
|
33
33
|
}): Promise<import("./types").MarketValuesMulticallRequestConfig<{
|
|
34
34
|
[key: `${string}-dataStore`]: {
|
|
35
|
-
calls: Record<"isDisabled" | "maxLongPoolAmount" | "maxShortPoolAmount" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "longPoolAmountAdjustment" | "shortPoolAmountAdjustment" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForStableFunding" | "thresholdForDecreaseFunding" | "minFundingFactorPerSecond" | "
|
|
35
|
+
calls: Record<"maxFundingFactorPerSecond" | "isDisabled" | "maxLongPoolAmount" | "maxShortPoolAmount" | "maxLongPoolUsdForDeposit" | "maxShortPoolUsdForDeposit" | "longPoolAmountAdjustment" | "shortPoolAmountAdjustment" | "reserveFactorLong" | "reserveFactorShort" | "openInterestReserveFactorLong" | "openInterestReserveFactorShort" | "maxOpenInterestLong" | "maxOpenInterestShort" | "borrowingFactorLong" | "borrowingFactorShort" | "borrowingExponentFactorLong" | "borrowingExponentFactorShort" | "fundingFactor" | "fundingExponentFactor" | "fundingIncreaseFactorPerSecond" | "fundingDecreaseFactorPerSecond" | "thresholdForStableFunding" | "thresholdForDecreaseFunding" | "minFundingFactorPerSecond" | "minPositionImpactPoolAmount" | "positionImpactPoolDistributionRate" | "minCollateralFactor" | "minCollateralFactorForOpenInterestLong" | "minCollateralFactorForOpenInterestShort" | "maxPnlFactorForTradersLong" | "maxPnlFactorForTradersShort" | "positionFeeFactorForPositiveImpact" | "positionFeeFactorForNegativeImpact" | "positionImpactFactorPositive" | "positionImpactFactorNegative" | "maxPositionImpactFactorPositive" | "maxPositionImpactFactorNegative" | "maxPositionImpactFactorForLiquidations" | "positionImpactExponentFactor" | "swapFeeFactorForPositiveImpact" | "swapFeeFactorForNegativeImpact" | "swapImpactFactorPositive" | "swapImpactFactorNegative" | "swapImpactExponentFactor" | "virtualMarketId" | "virtualLongTokenId" | "virtualShortTokenId", {
|
|
36
36
|
methodName: string;
|
|
37
37
|
params: any[];
|
|
38
38
|
}>;
|
|
@@ -11,7 +11,10 @@ export type MarketsInfoResult = {
|
|
|
11
11
|
tokensData?: TokensData;
|
|
12
12
|
pricesUpdatedAt?: number;
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Updates frequently
|
|
16
|
+
*/
|
|
17
|
+
export type MarketValues = Pick<MarketInfo, "longInterestUsd" | "shortInterestUsd" | "longInterestInTokens" | "shortInterestInTokens" | "longPoolAmount" | "shortPoolAmount" | "poolValueMin" | "poolValueMax" | "totalBorrowingFees" | "positionImpactPoolAmount" | "swapImpactPoolAmountLong" | "swapImpactPoolAmountShort" | "borrowingFactorPerSecondForLongs" | "borrowingFactorPerSecondForShorts" | "fundingFactorPerSecond" | "longsPayShorts" | "virtualPoolAmountForLongToken" | "virtualPoolAmountForShortToken" | "virtualInventoryForPositions">;
|
|
15
18
|
/**
|
|
16
19
|
* Updates seldom
|
|
17
20
|
*/
|
|
@@ -16,7 +16,7 @@ export const getOrderExecutionFee = (sdk, swapsCount, decreasePositionSwapType,
|
|
|
16
16
|
swapsCount: swapsCount ?? 0,
|
|
17
17
|
});
|
|
18
18
|
const oraclePriceCount = estimateOrderOraclePriceCount(swapsCount);
|
|
19
|
-
return getExecutionFee(sdk, gasLimits, tokensData, estimatedGas, gasPrice, oraclePriceCount);
|
|
19
|
+
return getExecutionFee(sdk.chainId, gasLimits, tokensData, estimatedGas, gasPrice, oraclePriceCount);
|
|
20
20
|
};
|
|
21
21
|
export const getExecutionFeeAmountForEntry = (sdk, entry, gasLimits, tokensData, gasPrice) => {
|
|
22
22
|
if (!entry.txnType || entry.txnType === "cancel")
|
|
@@ -4,7 +4,7 @@ import ReferralStorage from "../../abis/ReferralStorage.json";
|
|
|
4
4
|
import SyntheticsReader from "../../abis/SyntheticsReader.json";
|
|
5
5
|
import { getContract } from "../../configs/contracts";
|
|
6
6
|
import { hashedPositionKey, MAX_AUTO_CANCEL_ORDERS_KEY, MIN_COLLATERAL_USD_KEY, MIN_POSITION_SIZE_USD_KEY, uiFeeFactorKey, } from "../../configs/dataStore";
|
|
7
|
-
import { getContractMarketPrices, getMaxAllowedLeverageByMinCollateralFactor } from "../../utils/markets";
|
|
7
|
+
import { getContractMarketPrices, getMarketIndexName, getMarketPoolName, getMaxAllowedLeverageByMinCollateralFactor, } from "../../utils/markets";
|
|
8
8
|
import { getByKey } from "../../utils/objects";
|
|
9
9
|
import { getEntryPrice, getLeverage, getLiquidationPrice, getPositionKey, getPositionNetValue, getPositionPnlUsd, } from "../../utils/positions";
|
|
10
10
|
import { Module } from "../base";
|
|
@@ -97,11 +97,11 @@ export class Positions extends Module {
|
|
|
97
97
|
const positions = await this.sdk.executeMulticall(request).then((res) => {
|
|
98
98
|
const positions = res.data.reader.positions.returnValues;
|
|
99
99
|
return positions.reduce((positionsMap, positionInfo) => {
|
|
100
|
-
const { position, fees } = positionInfo;
|
|
100
|
+
const { position, fees, basePnlUsd } = positionInfo;
|
|
101
101
|
const { addresses, numbers, flags, data } = position;
|
|
102
102
|
const { account, market: marketAddress, collateralToken: collateralTokenAddress } = addresses;
|
|
103
103
|
// Empty position
|
|
104
|
-
if (
|
|
104
|
+
if (numbers.increasedAtTime == 0n) {
|
|
105
105
|
return positionsMap;
|
|
106
106
|
}
|
|
107
107
|
const positionKey = getPositionKey(account, marketAddress, collateralTokenAddress, flags.isLong);
|
|
@@ -122,6 +122,10 @@ export class Positions extends Module {
|
|
|
122
122
|
fundingFeeAmount: fees.funding.fundingFeeAmount,
|
|
123
123
|
claimableLongTokenAmount: fees.funding.claimableLongTokenAmount,
|
|
124
124
|
claimableShortTokenAmount: fees.funding.claimableShortTokenAmount,
|
|
125
|
+
pnl: basePnlUsd,
|
|
126
|
+
positionFeeAmount: fees.positionFeeAmount,
|
|
127
|
+
traderDiscountAmount: fees.referral.traderDiscountAmount,
|
|
128
|
+
uiFeeAmount: fees.ui.uiFeeAmount,
|
|
125
129
|
data,
|
|
126
130
|
};
|
|
127
131
|
return positionsMap;
|
|
@@ -380,9 +384,11 @@ export class Positions extends Module {
|
|
|
380
384
|
const position = getByKey(positionsData, positionKey);
|
|
381
385
|
const marketInfo = getByKey(marketsInfoData, position.marketAddress);
|
|
382
386
|
const indexToken = marketInfo?.indexToken;
|
|
387
|
+
const longToken = getByKey(tokensData, marketInfo?.longTokenAddress);
|
|
388
|
+
const shortToken = getByKey(tokensData, marketInfo?.shortTokenAddress);
|
|
383
389
|
const pnlToken = position.isLong ? marketInfo?.longToken : marketInfo?.shortToken;
|
|
384
390
|
const collateralToken = getByKey(tokensData, position.collateralTokenAddress);
|
|
385
|
-
if (!marketInfo || !indexToken || !pnlToken || !collateralToken) {
|
|
391
|
+
if (!marketInfo || !indexToken || !pnlToken || !collateralToken || !longToken || !shortToken) {
|
|
386
392
|
return acc;
|
|
387
393
|
}
|
|
388
394
|
const markPrice = getMarkPrice({ prices: indexToken.prices, isLong: position.isLong, isIncrease: false });
|
|
@@ -454,12 +460,19 @@ export class Positions extends Module {
|
|
|
454
460
|
pendingFundingFeesUsd,
|
|
455
461
|
isLong: position.isLong,
|
|
456
462
|
});
|
|
463
|
+
const indexName = getMarketIndexName({ indexToken, isSpotOnly: false });
|
|
464
|
+
const poolName = getMarketPoolName({ longToken, shortToken });
|
|
457
465
|
acc[positionKey] = {
|
|
458
466
|
...position,
|
|
467
|
+
market: marketInfo,
|
|
459
468
|
marketInfo,
|
|
469
|
+
indexName,
|
|
470
|
+
poolName,
|
|
460
471
|
indexToken,
|
|
461
472
|
collateralToken,
|
|
462
473
|
pnlToken,
|
|
474
|
+
longToken,
|
|
475
|
+
shortToken,
|
|
463
476
|
markPrice,
|
|
464
477
|
entryPrice,
|
|
465
478
|
liquidationPrice,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IncreasePositionAmounts } from "../../types/
|
|
1
|
+
import type { IncreasePositionAmounts } from "../../types/trade";
|
|
2
2
|
import type { GasLimitsConfig } from "../../types/fees";
|
|
3
3
|
import type { DecreasePositionAmounts, SwapAmounts, TradeFeesType } from "../../types/trade";
|
|
4
4
|
import { TokensData } from "../../types/tokens";
|
|
@@ -157,7 +157,7 @@ export class Utils extends Module {
|
|
|
157
157
|
if (gasPrice === undefined)
|
|
158
158
|
return undefined;
|
|
159
159
|
const oraclePriceCount = estimateOrderOraclePriceCount(swapsCount);
|
|
160
|
-
return getExecutionFee(this.
|
|
160
|
+
return getExecutionFee(this.chainId, gasLimits, tokensData, estimatedGas, gasPrice, oraclePriceCount);
|
|
161
161
|
}
|
|
162
162
|
async getGasPrice() {
|
|
163
163
|
const executionFeeConfig = EXECUTION_FEE_CONFIG_V2[this.chainId];
|
|
@@ -479,6 +479,22 @@
|
|
|
479
479
|
"baseBorrowingFactorShort": "0x488ad2e07ed1c47aa04dd86e97f77426c6197bfa6cff17a8b805a1cd15dd2d90",
|
|
480
480
|
"aboveOptimalUsageBorrowingFactorLong": "0x09bb0347a83fe3a7c85be68bdd48acc437af0a5df63af4d71f89958060a5183b",
|
|
481
481
|
"aboveOptimalUsageBorrowingFactorShort": "0xf537f2f92d9f7d503800034e53ed5df8212d23c932b380ad03aa870876595a35"
|
|
482
|
+
},
|
|
483
|
+
"0x467C4A46287F6C4918dDF780D4fd7b46419c2291": {
|
|
484
|
+
"optimalUsageFactorLong": "0x964962aaee802042c5a9840c0ccec35a3c08b7c3a99b7acec279fdfd6d0f5602",
|
|
485
|
+
"optimalUsageFactorShort": "0x9497c0e6a7adc621b90db81d6d028f6f5b1583b345b578cfcc4833e7d1279906",
|
|
486
|
+
"baseBorrowingFactorLong": "0x1640108e55e6399e5b8517089cb4f7862284b1a447a5547af7daa4aa0f6f164c",
|
|
487
|
+
"baseBorrowingFactorShort": "0x3c5f5cf695ab4f79a081f2a1136a0fd87e68f0a2c119db8c2805f8ca0ece90c6",
|
|
488
|
+
"aboveOptimalUsageBorrowingFactorLong": "0x5e9f8c8af639f59403d5633aefaa65be94ee1ac99b0910b200b02283d34f2e85",
|
|
489
|
+
"aboveOptimalUsageBorrowingFactorShort": "0x278832c9b87471c0f856e3f31aa6f860be363c8ebaa0397627c85081e39b12fc"
|
|
490
|
+
},
|
|
491
|
+
"0x16466a03449CB9218EB6A980Aa4a44aaCEd27C25": {
|
|
492
|
+
"optimalUsageFactorLong": "0x9e8b87143824c5582617f91611124f33711bb42d4018d803aa1d9450ad89043d",
|
|
493
|
+
"optimalUsageFactorShort": "0xaddecfb296f8550d3cbdbe1b9d83a97c06ff83f1fbd39396ff2ac28b43671a66",
|
|
494
|
+
"baseBorrowingFactorLong": "0x5537e1948501ad11928dc214dc0d165620884e871e9cbbcf5bc4ce6144ff3a11",
|
|
495
|
+
"baseBorrowingFactorShort": "0xc756628a72705a8f2ba1b0737509bc1e2e38afc2559cf5369c055de4e159007d",
|
|
496
|
+
"aboveOptimalUsageBorrowingFactorLong": "0xc60421377286117683d89fd5d15804d8e99a3d162b76d2bf5b70c22b1342f0cb",
|
|
497
|
+
"aboveOptimalUsageBorrowingFactorShort": "0x408b169f8bb5ede6252afb6fc2febaf67d40eb8856da18f261c616a86f65d233"
|
|
482
498
|
}
|
|
483
499
|
},
|
|
484
500
|
"43113": {
|