@gmx-io/sdk 1.2.0 → 1.2.1

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.
Files changed (88) hide show
  1. package/build/cjs/src/abis/ClaimHandler.json +439 -0
  2. package/build/cjs/src/abis/index.js +4 -0
  3. package/build/cjs/src/configs/__tests__/markets.spec.js +1 -1
  4. package/build/cjs/src/configs/__tests__/tokens.spec.js +1 -1
  5. package/build/cjs/src/configs/batch.js +12 -0
  6. package/build/cjs/src/configs/contracts.js +2 -0
  7. package/build/cjs/src/configs/dataStore.js +13 -3
  8. package/build/cjs/src/configs/express.js +2 -1
  9. package/build/cjs/src/configs/markets.js +35 -0
  10. package/build/cjs/src/configs/oracleKeeper.js +19 -35
  11. package/build/cjs/src/configs/tokens.js +55 -0
  12. package/build/cjs/src/index.js +3 -3
  13. package/build/cjs/src/modules/orders/helpers.js +9 -0
  14. package/build/cjs/src/modules/orders/helpers.spec.js +1 -1
  15. package/build/cjs/src/modules/orders/orders.js +3 -3
  16. package/build/cjs/src/modules/utils/utils.js +3 -3
  17. package/build/cjs/src/prebuilt/hashedKinkModelMarketRatesKeys.json +40 -0
  18. package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +255 -0
  19. package/build/cjs/src/prebuilt/hashedMarketValuesKeys.json +75 -0
  20. package/build/cjs/src/types/subsquid.js +91 -1
  21. package/build/cjs/src/types/swapStrategy.js +2 -0
  22. package/build/cjs/src/types/trade.js +1 -0
  23. package/build/cjs/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +2 -0
  24. package/build/cjs/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +2 -0
  25. package/build/cjs/src/utils/__tests__/uiFeeReceiver.spec.js +10 -0
  26. package/build/cjs/src/utils/errors/transactionsErrors.js +7 -1
  27. package/build/cjs/src/utils/orderTransactions.js +0 -1
  28. package/build/cjs/src/utils/swap/botanixStaking.js +90 -0
  29. package/build/cjs/src/utils/swap/buildSwapStrategy.js +224 -0
  30. package/build/cjs/src/utils/swap/externalSwapPath.js +41 -0
  31. package/build/cjs/src/utils/swap/externalSwapQuoteByPath.js +27 -0
  32. package/build/cjs/src/utils/swap/swapValues.js +250 -11
  33. package/build/cjs/src/utils/trade/amounts.js +89 -41
  34. package/build/cjs/src/utils/trade/trade.js +2 -2
  35. package/build/cjs/src/utils/twap/uiFeeReceiver.js +9 -9
  36. package/build/esm/src/abis/ClaimHandler.json +439 -0
  37. package/build/esm/src/abis/index.js +4 -0
  38. package/build/esm/src/configs/__tests__/markets.spec.js +1 -1
  39. package/build/esm/src/configs/__tests__/tokens.spec.js +1 -1
  40. package/build/esm/src/configs/batch.js +13 -1
  41. package/build/esm/src/configs/contracts.js +2 -0
  42. package/build/esm/src/configs/dataStore.js +8 -0
  43. package/build/esm/src/configs/express.js +1 -0
  44. package/build/esm/src/configs/markets.js +35 -0
  45. package/build/esm/src/configs/oracleKeeper.js +17 -29
  46. package/build/esm/src/configs/tokens.js +55 -0
  47. package/build/esm/src/index.js +3 -3
  48. package/build/esm/src/modules/orders/helpers.js +9 -0
  49. package/build/esm/src/modules/orders/helpers.spec.js +1 -1
  50. package/build/esm/src/modules/orders/orders.js +3 -3
  51. package/build/esm/src/modules/utils/utils.js +3 -3
  52. package/build/esm/src/prebuilt/hashedKinkModelMarketRatesKeys.json +40 -0
  53. package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +255 -0
  54. package/build/esm/src/prebuilt/hashedMarketValuesKeys.json +75 -0
  55. package/build/esm/src/types/subsquid.js +90 -0
  56. package/build/esm/src/types/swapStrategy.js +1 -0
  57. package/build/esm/src/types/trade.js +1 -0
  58. package/build/esm/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +2 -0
  59. package/build/esm/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +2 -0
  60. package/build/esm/src/utils/__tests__/uiFeeReceiver.spec.js +11 -1
  61. package/build/esm/src/utils/errors/transactionsErrors.js +7 -1
  62. package/build/esm/src/utils/orderTransactions.js +0 -1
  63. package/build/esm/src/utils/swap/botanixStaking.js +83 -0
  64. package/build/esm/src/utils/swap/buildSwapStrategy.js +219 -0
  65. package/build/esm/src/utils/swap/externalSwapPath.js +37 -0
  66. package/build/esm/src/utils/swap/externalSwapQuoteByPath.js +23 -0
  67. package/build/esm/src/utils/swap/swapValues.js +248 -9
  68. package/build/esm/src/utils/trade/amounts.js +89 -41
  69. package/build/esm/src/utils/trade/trade.js +2 -2
  70. package/build/esm/src/utils/twap/uiFeeReceiver.js +9 -9
  71. package/build/types/src/abis/index.d.ts +1 -1
  72. package/build/types/src/configs/batch.d.ts +2 -1
  73. package/build/types/src/configs/contracts.d.ts +2 -0
  74. package/build/types/src/configs/dataStore.d.ts +4 -0
  75. package/build/types/src/configs/express.d.ts +1 -0
  76. package/build/types/src/configs/oracleKeeper.d.ts +2 -3
  77. package/build/types/src/types/subsquid.d.ts +303 -0
  78. package/build/types/src/types/swapStrategy.d.ts +33 -0
  79. package/build/types/src/types/tokens.d.ts +5 -0
  80. package/build/types/src/types/trade.d.ts +18 -4
  81. package/build/types/src/utils/swap/botanixStaking.d.ts +11 -0
  82. package/build/types/src/utils/swap/buildSwapStrategy.d.ts +22 -0
  83. package/build/types/src/utils/swap/externalSwapPath.d.ts +13 -0
  84. package/build/types/src/utils/swap/externalSwapQuoteByPath.d.ts +6 -0
  85. package/build/types/src/utils/swap/swapValues.d.ts +10 -3
  86. package/build/types/src/utils/trade/amounts.d.ts +5 -2
  87. package/build/types/src/utils/twap/uiFeeReceiver.d.ts +7 -7
  88. package/package.json +1 -1
@@ -0,0 +1,439 @@
1
+ {
2
+ "abi": [
3
+ {
4
+ "inputs": [
5
+ {
6
+ "internalType": "contract RoleStore",
7
+ "name": "_roleStore",
8
+ "type": "address"
9
+ },
10
+ {
11
+ "internalType": "contract DataStore",
12
+ "name": "_dataStore",
13
+ "type": "address"
14
+ },
15
+ {
16
+ "internalType": "contract EventEmitter",
17
+ "name": "_eventEmitter",
18
+ "type": "address"
19
+ },
20
+ {
21
+ "internalType": "contract ClaimVault",
22
+ "name": "_claimVault",
23
+ "type": "address"
24
+ }
25
+ ],
26
+ "stateMutability": "nonpayable",
27
+ "type": "constructor"
28
+ },
29
+ {
30
+ "inputs": [
31
+ {
32
+ "internalType": "bytes32",
33
+ "name": "key",
34
+ "type": "bytes32"
35
+ }
36
+ ],
37
+ "name": "DisabledFeature",
38
+ "type": "error"
39
+ },
40
+ {
41
+ "inputs": [
42
+ {
43
+ "internalType": "uint256",
44
+ "name": "existingDistributionId",
45
+ "type": "uint256"
46
+ }
47
+ ],
48
+ "name": "DuplicateClaimTerms",
49
+ "type": "error"
50
+ },
51
+ {
52
+ "inputs": [],
53
+ "name": "EmptyAccount",
54
+ "type": "error"
55
+ },
56
+ {
57
+ "inputs": [],
58
+ "name": "EmptyAmount",
59
+ "type": "error"
60
+ },
61
+ {
62
+ "inputs": [
63
+ {
64
+ "internalType": "address",
65
+ "name": "token",
66
+ "type": "address"
67
+ }
68
+ ],
69
+ "name": "EmptyClaimableAmount",
70
+ "type": "error"
71
+ },
72
+ {
73
+ "inputs": [],
74
+ "name": "EmptyReceiver",
75
+ "type": "error"
76
+ },
77
+ {
78
+ "inputs": [],
79
+ "name": "EmptyToken",
80
+ "type": "error"
81
+ },
82
+ {
83
+ "inputs": [
84
+ {
85
+ "internalType": "address",
86
+ "name": "token",
87
+ "type": "address"
88
+ }
89
+ ],
90
+ "name": "InsufficientFunds",
91
+ "type": "error"
92
+ },
93
+ {
94
+ "inputs": [
95
+ {
96
+ "internalType": "address",
97
+ "name": "recoveredSigner",
98
+ "type": "address"
99
+ },
100
+ {
101
+ "internalType": "address",
102
+ "name": "expectedSigner",
103
+ "type": "address"
104
+ }
105
+ ],
106
+ "name": "InvalidClaimTermsSignature",
107
+ "type": "error"
108
+ },
109
+ {
110
+ "inputs": [
111
+ {
112
+ "internalType": "address",
113
+ "name": "expectedSigner",
114
+ "type": "address"
115
+ }
116
+ ],
117
+ "name": "InvalidClaimTermsSignatureForContract",
118
+ "type": "error"
119
+ },
120
+ {
121
+ "inputs": [
122
+ {
123
+ "internalType": "string",
124
+ "name": "reason",
125
+ "type": "string"
126
+ }
127
+ ],
128
+ "name": "InvalidParams",
129
+ "type": "error"
130
+ },
131
+ {
132
+ "inputs": [
133
+ {
134
+ "internalType": "address",
135
+ "name": "msgSender",
136
+ "type": "address"
137
+ },
138
+ {
139
+ "internalType": "string",
140
+ "name": "role",
141
+ "type": "string"
142
+ }
143
+ ],
144
+ "name": "Unauthorized",
145
+ "type": "error"
146
+ },
147
+ {
148
+ "inputs": [
149
+ {
150
+ "components": [
151
+ {
152
+ "internalType": "address",
153
+ "name": "token",
154
+ "type": "address"
155
+ },
156
+ {
157
+ "internalType": "uint256",
158
+ "name": "distributionId",
159
+ "type": "uint256"
160
+ },
161
+ {
162
+ "internalType": "bytes",
163
+ "name": "termsSignature",
164
+ "type": "bytes"
165
+ }
166
+ ],
167
+ "internalType": "struct ClaimHandler.ClaimParam[]",
168
+ "name": "params",
169
+ "type": "tuple[]"
170
+ },
171
+ {
172
+ "internalType": "address",
173
+ "name": "receiver",
174
+ "type": "address"
175
+ }
176
+ ],
177
+ "name": "claimFunds",
178
+ "outputs": [],
179
+ "stateMutability": "nonpayable",
180
+ "type": "function"
181
+ },
182
+ {
183
+ "inputs": [],
184
+ "name": "claimVault",
185
+ "outputs": [
186
+ {
187
+ "internalType": "contract ClaimVault",
188
+ "name": "",
189
+ "type": "address"
190
+ }
191
+ ],
192
+ "stateMutability": "view",
193
+ "type": "function"
194
+ },
195
+ {
196
+ "inputs": [],
197
+ "name": "dataStore",
198
+ "outputs": [
199
+ {
200
+ "internalType": "contract DataStore",
201
+ "name": "",
202
+ "type": "address"
203
+ }
204
+ ],
205
+ "stateMutability": "view",
206
+ "type": "function"
207
+ },
208
+ {
209
+ "inputs": [
210
+ {
211
+ "internalType": "address",
212
+ "name": "token",
213
+ "type": "address"
214
+ },
215
+ {
216
+ "internalType": "uint256",
217
+ "name": "distributionId",
218
+ "type": "uint256"
219
+ },
220
+ {
221
+ "components": [
222
+ {
223
+ "internalType": "address",
224
+ "name": "account",
225
+ "type": "address"
226
+ },
227
+ {
228
+ "internalType": "uint256",
229
+ "name": "amount",
230
+ "type": "uint256"
231
+ }
232
+ ],
233
+ "internalType": "struct ClaimHandler.DepositParam[]",
234
+ "name": "params",
235
+ "type": "tuple[]"
236
+ }
237
+ ],
238
+ "name": "depositFunds",
239
+ "outputs": [],
240
+ "stateMutability": "nonpayable",
241
+ "type": "function"
242
+ },
243
+ {
244
+ "inputs": [],
245
+ "name": "eventEmitter",
246
+ "outputs": [
247
+ {
248
+ "internalType": "contract EventEmitter",
249
+ "name": "",
250
+ "type": "address"
251
+ }
252
+ ],
253
+ "stateMutability": "view",
254
+ "type": "function"
255
+ },
256
+ {
257
+ "inputs": [
258
+ {
259
+ "internalType": "address",
260
+ "name": "account",
261
+ "type": "address"
262
+ },
263
+ {
264
+ "internalType": "address",
265
+ "name": "token",
266
+ "type": "address"
267
+ },
268
+ {
269
+ "internalType": "uint256[]",
270
+ "name": "distributionIds",
271
+ "type": "uint256[]"
272
+ }
273
+ ],
274
+ "name": "getClaimableAmount",
275
+ "outputs": [
276
+ {
277
+ "internalType": "uint256",
278
+ "name": "",
279
+ "type": "uint256"
280
+ }
281
+ ],
282
+ "stateMutability": "view",
283
+ "type": "function"
284
+ },
285
+ {
286
+ "inputs": [
287
+ {
288
+ "internalType": "address",
289
+ "name": "token",
290
+ "type": "address"
291
+ }
292
+ ],
293
+ "name": "getTotalClaimableAmount",
294
+ "outputs": [
295
+ {
296
+ "internalType": "uint256",
297
+ "name": "",
298
+ "type": "uint256"
299
+ }
300
+ ],
301
+ "stateMutability": "view",
302
+ "type": "function"
303
+ },
304
+ {
305
+ "inputs": [
306
+ {
307
+ "internalType": "uint256",
308
+ "name": "distributionId",
309
+ "type": "uint256"
310
+ }
311
+ ],
312
+ "name": "removeTerms",
313
+ "outputs": [],
314
+ "stateMutability": "nonpayable",
315
+ "type": "function"
316
+ },
317
+ {
318
+ "inputs": [],
319
+ "name": "roleStore",
320
+ "outputs": [
321
+ {
322
+ "internalType": "contract RoleStore",
323
+ "name": "",
324
+ "type": "address"
325
+ }
326
+ ],
327
+ "stateMutability": "view",
328
+ "type": "function"
329
+ },
330
+ {
331
+ "inputs": [
332
+ {
333
+ "internalType": "uint256",
334
+ "name": "distributionId",
335
+ "type": "uint256"
336
+ },
337
+ {
338
+ "internalType": "string",
339
+ "name": "terms",
340
+ "type": "string"
341
+ }
342
+ ],
343
+ "name": "setTerms",
344
+ "outputs": [],
345
+ "stateMutability": "nonpayable",
346
+ "type": "function"
347
+ },
348
+ {
349
+ "inputs": [
350
+ {
351
+ "internalType": "address",
352
+ "name": "token",
353
+ "type": "address"
354
+ },
355
+ {
356
+ "components": [
357
+ {
358
+ "internalType": "address",
359
+ "name": "token",
360
+ "type": "address"
361
+ },
362
+ {
363
+ "internalType": "uint256",
364
+ "name": "distributionId",
365
+ "type": "uint256"
366
+ },
367
+ {
368
+ "internalType": "address",
369
+ "name": "fromAccount",
370
+ "type": "address"
371
+ },
372
+ {
373
+ "internalType": "address",
374
+ "name": "toAccount",
375
+ "type": "address"
376
+ }
377
+ ],
378
+ "internalType": "struct ClaimHandler.TransferClaimParam[]",
379
+ "name": "params",
380
+ "type": "tuple[]"
381
+ }
382
+ ],
383
+ "name": "transferClaim",
384
+ "outputs": [],
385
+ "stateMutability": "nonpayable",
386
+ "type": "function"
387
+ },
388
+ {
389
+ "inputs": [
390
+ {
391
+ "internalType": "address",
392
+ "name": "token",
393
+ "type": "address"
394
+ },
395
+ {
396
+ "components": [
397
+ {
398
+ "internalType": "address",
399
+ "name": "account",
400
+ "type": "address"
401
+ },
402
+ {
403
+ "internalType": "uint256",
404
+ "name": "distributionId",
405
+ "type": "uint256"
406
+ }
407
+ ],
408
+ "internalType": "struct ClaimHandler.WithdrawParam[]",
409
+ "name": "params",
410
+ "type": "tuple[]"
411
+ },
412
+ {
413
+ "internalType": "address",
414
+ "name": "receiver",
415
+ "type": "address"
416
+ }
417
+ ],
418
+ "name": "withdrawFunds",
419
+ "outputs": [],
420
+ "stateMutability": "nonpayable",
421
+ "type": "function"
422
+ }
423
+ ],
424
+ "libraries": {},
425
+ "devdoc": {
426
+ "kind": "dev",
427
+ "methods": {},
428
+ "version": 1
429
+ },
430
+ "userdoc": {
431
+ "kind": "user",
432
+ "methods": {},
433
+ "version": 1
434
+ },
435
+ "storageLayout": {
436
+ "storage": [],
437
+ "types": null
438
+ }
439
+ }
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.abis = void 0;
7
7
  const viem_1 = require("viem");
8
8
  const ArbitrumNodeInterface_json_1 = __importDefault(require("./ArbitrumNodeInterface.json"));
9
+ const ClaimHandler_json_1 = __importDefault(require("./ClaimHandler.json"));
9
10
  const CustomErrors_json_1 = __importDefault(require("./CustomErrors.json"));
10
11
  const DataStore_json_1 = __importDefault(require("./DataStore.json"));
11
12
  const ERC20PermitInterface_json_1 = __importDefault(require("./ERC20PermitInterface.json"));
@@ -34,6 +35,7 @@ const RewardRouter_json_1 = __importDefault(require("./RewardRouter.json"));
34
35
  const RewardTracker_json_1 = __importDefault(require("./RewardTracker.json"));
35
36
  const Router_v2_json_1 = __importDefault(require("./Router-v2.json"));
36
37
  const Router_json_1 = __importDefault(require("./Router.json"));
38
+ const StBTC_json_1 = __importDefault(require("./StBTC.json"));
37
39
  const SubaccountGelatoRelayRouter_json_1 = __importDefault(require("./SubaccountGelatoRelayRouter.json"));
38
40
  const SubaccountRouter_json_1 = __importDefault(require("./SubaccountRouter.json"));
39
41
  const SyntheticsReader_json_1 = __importDefault(require("./SyntheticsReader.json"));
@@ -99,4 +101,6 @@ exports.abis = {
99
101
  SubaccountGelatoRelayRouter: SubaccountGelatoRelayRouter_json_1.default.abi,
100
102
  GelatoRelayRouter: GelatoRelayRouter_json_1.default.abi,
101
103
  ArbitrumNodeInterface: ArbitrumNodeInterface_json_1.default.abi,
104
+ StBTC: StBTC_json_1.default.abi,
105
+ ClaimHandler: ClaimHandler_json_1.default.abi,
102
106
  };
@@ -6,7 +6,7 @@ const chains_1 = require("../chains");
6
6
  const markets_1 = require("../markets");
7
7
  const oracleKeeper_1 = require("../oracleKeeper");
8
8
  const getKeeperMarkets = async (chainId) => {
9
- const res = await fetch(`${(0, oracleKeeper_1.getOracleKeeperUrl)(chainId, 0)}/markets`);
9
+ const res = await fetch(`${(0, oracleKeeper_1.getOracleKeeperUrl)(chainId)}/markets`);
10
10
  const data = (await res.json());
11
11
  if (!data || !data.markets || data.markets.length === 0)
12
12
  throw Error("No markets in response");
@@ -6,7 +6,7 @@ const chains_1 = require("../chains");
6
6
  const oracleKeeper_1 = require("../oracleKeeper");
7
7
  const tokens_1 = require("../tokens");
8
8
  const getKeeperTokens = async (chainId) => {
9
- const res = await fetch(`${(0, oracleKeeper_1.getOracleKeeperUrl)(chainId, 0)}/tokens`);
9
+ const res = await fetch(`${(0, oracleKeeper_1.getOracleKeeperUrl)(chainId)}/tokens`);
10
10
  const data = (await res.json());
11
11
  if (!data || !data.tokens || data.tokens.length === 0)
12
12
  throw Error("No tokens in response");
@@ -39,4 +39,16 @@ exports.BATCH_CONFIGS = {
39
39
  },
40
40
  },
41
41
  },
42
+ [chains_1.BOTANIX]: {
43
+ http: {
44
+ batchSize: 0,
45
+ wait: 0,
46
+ },
47
+ client: {
48
+ multicall: {
49
+ batchSize: 1024 * 1024,
50
+ wait: 0,
51
+ },
52
+ },
53
+ },
42
54
  };
@@ -63,6 +63,7 @@ exports.CONTRACTS = {
63
63
  ChainlinkPriceFeedProvider: "0x527FB0bCfF63C47761039bB386cFE181A92a4701",
64
64
  Multicall: "0x842ec2c7d803033edf55e478f461fc547bc54eb2",
65
65
  ArbitrumNodeInterface: "0x00000000000000000000000000000000000000C8",
66
+ ClaimHandler: "0xCF2b097517EEBD6c36756A82844D2ec21Ee4C025",
66
67
  },
67
68
  [chains_1.AVALANCHE]: {
68
69
  // avalanche
@@ -123,6 +124,7 @@ exports.CONTRACTS = {
123
124
  ChainlinkPriceFeedProvider: "0x713c6a2479f6C079055A6AD3690D95dEDCEf9e1e",
124
125
  Multicall: "0xcA11bde05977b3631167028862bE2a173976CA11",
125
126
  ArbitrumNodeInterface: viem_1.zeroAddress,
127
+ ClaimHandler: "0xF73CE08A22c67f19d75892457817e917cB3f9493",
126
128
  },
127
129
  [chains_1.BOTANIX]: {
128
130
  DataStore: "0xA23B81a89Ab9D7D89fF8fc1b5d8508fB75Cc094d",
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WITHDRAWAL_GAS_LIMIT_KEY = exports.DEPOSIT_GAS_LIMIT_KEY = exports.MAX_LEVERAGE_KEY = exports.MIN_POSITION_SIZE_USD_KEY = exports.MIN_COLLATERAL_FACTOR_FOR_OPEN_INTEREST_MULTIPLIER_KEY = exports.MIN_COLLATERAL_FACTOR_KEY = exports.MIN_COLLATERAL_USD_KEY = exports.SWAP_IMPACT_POOL_AMOUNT_KEY = exports.POSITION_IMPACT_POOL_DISTRIBUTION_RATE_KEY = exports.MIN_POSITION_IMPACT_POOL_AMOUNT_KEY = exports.POSITION_IMPACT_POOL_AMOUNT_KEY = exports.MAX_POSITION_IMPACT_FACTOR_FOR_LIQUIDATIONS_KEY = exports.MAX_PNL_FACTOR_FOR_TRADERS_KEY = exports.MAX_PNL_FACTOR_FOR_DEPOSITS_KEY = exports.MAX_PNL_FACTOR_FOR_WITHDRAWALS_KEY = exports.MAX_PNL_FACTOR_KEY = exports.THRESHOLD_FOR_DECREASE_FUNDING = exports.THRESHOLD_FOR_STABLE_FUNDING = exports.MAX_FUNDING_FACTOR_PER_SECOND = exports.MIN_FUNDING_FACTOR_PER_SECOND = exports.FUNDING_DECREASE_FACTOR_PER_SECOND = exports.FUNDING_INCREASE_FACTOR_PER_SECOND = exports.FUNDING_EXPONENT_FACTOR_KEY = exports.FUNDING_FACTOR_KEY = exports.TOTAL_BORROWING_KEY = exports.CUMULATIVE_BORROWING_FACTOR_KEY = exports.BORROWING_EXPONENT_FACTOR_KEY = exports.BORROWING_FACTOR_KEY = exports.NONCE_KEY = exports.MAX_OPEN_INTEREST_KEY = exports.OPEN_INTEREST_RESERVE_FACTOR_KEY = exports.RESERVE_FACTOR_KEY = exports.MAX_POOL_AMOUNT_KEY = exports.MAX_POOL_USD_FOR_DEPOSIT_KEY = exports.POOL_AMOUNT_KEY = exports.OPEN_INTEREST_IN_TOKENS_KEY = exports.OPEN_INTEREST_KEY = exports.FEE_RECEIVER_POSITION_FACTOR_KEY = exports.FEE_RECEIVER_SWAP_FACTOR_KEY = exports.FEE_RECEIVER_WITHDRAWAL_FACTOR_KEY = exports.BORROWING_FEE_RECEIVER_FACTOR_KEY = exports.FEE_RECEIVER_DEPOSIT_FACTOR_KEY = exports.ATOMIC_SWAP_FEE_FACTOR_KEY = exports.SWAP_FEE_FACTOR_KEY = exports.SWAP_IMPACT_EXPONENT_FACTOR_KEY = exports.SWAP_IMPACT_FACTOR_KEY = exports.POSITION_FEE_FACTOR_KEY = exports.POSITION_IMPACT_EXPONENT_FACTOR_KEY = exports.MAX_POSITION_IMPACT_FACTOR_KEY = exports.POSITION_IMPACT_FACTOR_KEY = void 0;
4
- exports.glvMaxMarketTokenBalanceUsdKey = exports.glvShiftMinIntervalKey = exports.glvShiftLastExecutedAtKey = exports.subaccountExpiresAtKey = exports.GMX_SIMULATION_ORIGIN = exports.REQUEST_EXPIRATION_TIME_KEY = exports.GELATO_RELAY_FEE_MULTIPLIER_FACTOR_KEY = exports.GASLESS_FEATURE_DISABLED_KEY = exports.PRICE_FEED_KEY = exports.SUBACCOUNT_EXPIRES_AT = exports.ABOVE_OPTIMAL_USAGE_BORROWING_FACTOR = exports.BASE_BORROWING_FACTOR = exports.OPTIMAL_USAGE_FACTOR = exports.MAX_AUTO_CANCEL_ORDERS_KEY = exports.GLV_PER_MARKET_GAS_LIMIT = exports.GLV_WITHDRAWAL_GAS_LIMIT = exports.GLV_DEPOSIT_GAS_LIMIT = exports.GLV_SHIFT_MIN_INTERVAL = exports.GLV_SHIFT_LAST_EXECUTED_AT = exports.IS_GLV_MARKET_DISABLED = exports.GLV_MAX_MARKET_TOKEN_BALANCE_AMOUNT = exports.GLV_MAX_MARKET_TOKEN_BALANCE_USD = exports.SUBACCOUNT_AUTO_TOP_UP_AMOUNT = exports.SUBACCOUNT_ORDER_ACTION = exports.SUBACCOUNT_ACTION_COUNT = exports.MAX_ALLOWED_SUBACCOUNT_ACTION_COUNT = exports.SUBACCOUNT_LIST_KEY = exports.UI_FEE_FACTOR = exports.IS_MARKET_DISABLED_KEY = exports.AFFILIATE_REWARD_KEY = exports.POOL_AMOUNT_ADJUSTMENT_KEY = exports.VIRTUAL_INVENTORY_FOR_SWAPS_KEY = exports.VIRTUAL_INVENTORY_FOR_POSITIONS_KEY = exports.VIRTUAL_MARKET_ID_KEY = exports.VIRTUAL_TOKEN_ID_KEY = exports.CLAIMABLE_FUNDING_AMOUNT = exports.ACCOUNT_ORDER_LIST_KEY = exports.ORDER_LIST_KEY = exports.POSITION_LIST_KEY = exports.MARKET_LIST_KEY = exports.ESTIMATED_GAS_FEE_MULTIPLIER_FACTOR = exports.ESTIMATED_GAS_FEE_PER_ORACLE_PRICE = exports.ESTIMATED_GAS_FEE_BASE_AMOUNT_V2_1 = exports.NATIVE_TOKEN_TRANSFER_GAS_LIMIT_KEY = exports.TOKEN_TRANSFER_GAS_LIMIT_KEY = exports.SINGLE_SWAP_GAS_LIMIT_KEY = exports.SHIFT_GAS_LIMIT_KEY = exports.SWAP_ORDER_GAS_LIMIT_KEY = exports.DECREASE_ORDER_GAS_LIMIT_KEY = exports.INCREASE_ORDER_GAS_LIMIT_KEY = void 0;
5
- exports.virtualInventoryForSwapsKey = exports.virtualMarketIdKey = exports.virtualTokenIdKey = exports.claimableFundingAmountKey = exports.hashedPositionKey = exports.minCollateralFactorForOpenInterest = exports.minCollateralFactorKey = exports.accountOrderListKey = exports.swapOrderGasLimitKey = exports.decreaseOrderGasLimitKey = exports.increaseOrderGasLimitKey = exports.singleSwapGasLimitKey = exports.shiftGasLimitKey = exports.withdrawalGasLimitKey = exports.depositGasLimitKey = exports.orderKey = exports.swapImpactPoolAmountKey = exports.maxPositionImpactFactorForLiquidationsKey = exports.positionImpactPoolDistributionRateKey = exports.minPositionImpactPoolAmountKey = exports.positionImpactPoolAmountKey = exports.maxPnlFactorKey = exports.thresholdForDecreaseFundingKey = exports.thresholdForStableFundingKey = exports.maxFundingFactorPerSecondKey = exports.minFundingFactorPerSecondKey = exports.fundingDecreaseFactorPerSecondKey = exports.fundingIncreaseFactorPerSecondKey = exports.fundingExponentFactorKey = exports.fundingFactorKey = exports.totalBorrowingKey = exports.cumulativeBorrowingFactorKey = exports.borrowingExponentFactorKey = exports.borrowingFactorKey = exports.maxOpenInterestKey = exports.openInterestReserveFactorKey = exports.reserveFactorKey = exports.poolAmountKey = exports.openInterestInTokensKey = exports.openInterestKey = exports.atomicSwapFeeFactorKey = exports.swapFeeFactorKey = exports.swapImpactExponentFactorKey = exports.swapImpactFactorKey = exports.positionFeeFactorKey = exports.maxPositionImpactFactorKey = exports.positionImpactExponentFactorKey = exports.positionImpactFactorKey = exports.isGlvDisabledKey = exports.glvMaxMarketTokenBalanceAmountKey = void 0;
6
- exports.gaslessFeatureDisabledKey = exports.priceFeedKey = exports.subaccountAutoTopUpAmountKey = exports.subaccountActionCountKey = exports.maxAllowedSubaccountActionCountKey = exports.subaccountListKey = exports.uiFeeFactorKey = exports.maxPoolAmountKey = exports.maxPoolUsdForDepositKey = exports.isMarketDisabledKey = exports.affiliateRewardKey = exports.poolAmountAdjustmentKey = exports.virtualInventoryForPositionsKey = void 0;
4
+ exports.glvShiftLastExecutedAtKey = exports.subaccountExpiresAtKey = exports.GENERAL_CLAIM_FEATURE_DISABLED = exports.CLAIM_TERMS_KEY = exports.GMX_SIMULATION_ORIGIN = exports.REQUEST_EXPIRATION_TIME_KEY = exports.GELATO_RELAY_FEE_MULTIPLIER_FACTOR_KEY = exports.GASLESS_FEATURE_DISABLED_KEY = exports.PRICE_FEED_KEY = exports.SUBACCOUNT_EXPIRES_AT = exports.ABOVE_OPTIMAL_USAGE_BORROWING_FACTOR = exports.BASE_BORROWING_FACTOR = exports.OPTIMAL_USAGE_FACTOR = exports.MAX_AUTO_CANCEL_ORDERS_KEY = exports.GLV_PER_MARKET_GAS_LIMIT = exports.GLV_WITHDRAWAL_GAS_LIMIT = exports.GLV_DEPOSIT_GAS_LIMIT = exports.GLV_SHIFT_MIN_INTERVAL = exports.GLV_SHIFT_LAST_EXECUTED_AT = exports.IS_GLV_MARKET_DISABLED = exports.GLV_MAX_MARKET_TOKEN_BALANCE_AMOUNT = exports.GLV_MAX_MARKET_TOKEN_BALANCE_USD = exports.SUBACCOUNT_AUTO_TOP_UP_AMOUNT = exports.SUBACCOUNT_ORDER_ACTION = exports.SUBACCOUNT_ACTION_COUNT = exports.MAX_ALLOWED_SUBACCOUNT_ACTION_COUNT = exports.SUBACCOUNT_LIST_KEY = exports.UI_FEE_FACTOR = exports.IS_MARKET_DISABLED_KEY = exports.AFFILIATE_REWARD_KEY = exports.POOL_AMOUNT_ADJUSTMENT_KEY = exports.VIRTUAL_INVENTORY_FOR_SWAPS_KEY = exports.VIRTUAL_INVENTORY_FOR_POSITIONS_KEY = exports.VIRTUAL_MARKET_ID_KEY = exports.VIRTUAL_TOKEN_ID_KEY = exports.CLAIMABLE_FUNDING_AMOUNT = exports.ACCOUNT_ORDER_LIST_KEY = exports.ORDER_LIST_KEY = exports.POSITION_LIST_KEY = exports.MARKET_LIST_KEY = exports.ESTIMATED_GAS_FEE_MULTIPLIER_FACTOR = exports.ESTIMATED_GAS_FEE_PER_ORACLE_PRICE = exports.ESTIMATED_GAS_FEE_BASE_AMOUNT_V2_1 = exports.NATIVE_TOKEN_TRANSFER_GAS_LIMIT_KEY = exports.TOKEN_TRANSFER_GAS_LIMIT_KEY = exports.SINGLE_SWAP_GAS_LIMIT_KEY = exports.SHIFT_GAS_LIMIT_KEY = exports.SWAP_ORDER_GAS_LIMIT_KEY = exports.DECREASE_ORDER_GAS_LIMIT_KEY = exports.INCREASE_ORDER_GAS_LIMIT_KEY = void 0;
5
+ exports.virtualTokenIdKey = exports.claimableFundingAmountKey = exports.hashedPositionKey = exports.minCollateralFactorForOpenInterest = exports.minCollateralFactorKey = exports.accountOrderListKey = exports.swapOrderGasLimitKey = exports.decreaseOrderGasLimitKey = exports.increaseOrderGasLimitKey = exports.singleSwapGasLimitKey = exports.shiftGasLimitKey = exports.withdrawalGasLimitKey = exports.depositGasLimitKey = exports.orderKey = exports.swapImpactPoolAmountKey = exports.maxPositionImpactFactorForLiquidationsKey = exports.positionImpactPoolDistributionRateKey = exports.minPositionImpactPoolAmountKey = exports.positionImpactPoolAmountKey = exports.maxPnlFactorKey = exports.thresholdForDecreaseFundingKey = exports.thresholdForStableFundingKey = exports.maxFundingFactorPerSecondKey = exports.minFundingFactorPerSecondKey = exports.fundingDecreaseFactorPerSecondKey = exports.fundingIncreaseFactorPerSecondKey = exports.fundingExponentFactorKey = exports.fundingFactorKey = exports.totalBorrowingKey = exports.cumulativeBorrowingFactorKey = exports.borrowingExponentFactorKey = exports.borrowingFactorKey = exports.maxOpenInterestKey = exports.openInterestReserveFactorKey = exports.reserveFactorKey = exports.poolAmountKey = exports.openInterestInTokensKey = exports.openInterestKey = exports.atomicSwapFeeFactorKey = exports.swapFeeFactorKey = exports.swapImpactExponentFactorKey = exports.swapImpactFactorKey = exports.positionFeeFactorKey = exports.maxPositionImpactFactorKey = exports.positionImpactExponentFactorKey = exports.positionImpactFactorKey = exports.isGlvDisabledKey = exports.glvMaxMarketTokenBalanceAmountKey = exports.glvMaxMarketTokenBalanceUsdKey = exports.glvShiftMinIntervalKey = void 0;
6
+ exports.claimsDisabledKey = exports.claimTermsKey = exports.gaslessFeatureDisabledKey = exports.priceFeedKey = exports.subaccountAutoTopUpAmountKey = exports.subaccountActionCountKey = exports.maxAllowedSubaccountActionCountKey = exports.subaccountListKey = exports.uiFeeFactorKey = exports.maxPoolAmountKey = exports.maxPoolUsdForDepositKey = exports.isMarketDisabledKey = exports.affiliateRewardKey = exports.poolAmountAdjustmentKey = exports.virtualInventoryForPositionsKey = exports.virtualInventoryForSwapsKey = exports.virtualMarketIdKey = void 0;
7
7
  const hash_1 = require("../utils/hash");
8
8
  exports.POSITION_IMPACT_FACTOR_KEY = (0, hash_1.hashString)("POSITION_IMPACT_FACTOR");
9
9
  exports.MAX_POSITION_IMPACT_FACTOR_KEY = (0, hash_1.hashString)("MAX_POSITION_IMPACT_FACTOR");
@@ -101,6 +101,8 @@ exports.GASLESS_FEATURE_DISABLED_KEY = (0, hash_1.hashString)("GASLESS_FEATURE_D
101
101
  exports.GELATO_RELAY_FEE_MULTIPLIER_FACTOR_KEY = (0, hash_1.hashString)("GELATO_RELAY_FEE_MULTIPLIER_FACTOR");
102
102
  exports.REQUEST_EXPIRATION_TIME_KEY = (0, hash_1.hashString)("REQUEST_EXPIRATION_TIME");
103
103
  exports.GMX_SIMULATION_ORIGIN = "0x" + (0, hash_1.keccakString)("GMX SIMULATION ORIGIN").slice(-40);
104
+ exports.CLAIM_TERMS_KEY = (0, hash_1.hashString)("CLAIM_TERMS");
105
+ exports.GENERAL_CLAIM_FEATURE_DISABLED = (0, hash_1.hashString)("GENERAL_CLAIM_FEATURE_DISABLED");
104
106
  function subaccountExpiresAtKey(account, subaccount, actionType) {
105
107
  return (0, hash_1.hashData)(["bytes32", "address", "address", "bytes32"], [exports.SUBACCOUNT_EXPIRES_AT, account, subaccount, actionType]);
106
108
  }
@@ -369,3 +371,11 @@ function gaslessFeatureDisabledKey(module) {
369
371
  return (0, hash_1.hashData)(["bytes32", "address"], [exports.GASLESS_FEATURE_DISABLED_KEY, module]);
370
372
  }
371
373
  exports.gaslessFeatureDisabledKey = gaslessFeatureDisabledKey;
374
+ function claimTermsKey(distributionId) {
375
+ return (0, hash_1.hashData)(["bytes32", "uint256"], [exports.CLAIM_TERMS_KEY, distributionId]);
376
+ }
377
+ exports.claimTermsKey = claimTermsKey;
378
+ function claimsDisabledKey(distributionId) {
379
+ return (0, hash_1.hashData)(["bytes32", "uint256"], [exports.GENERAL_CLAIM_FEATURE_DISABLED, distributionId]);
380
+ }
381
+ exports.claimsDisabledKey = claimsDisabledKey;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRelayerFeeToken = exports.getDefaultGasPaymentToken = exports.getGasPaymentTokens = exports.MIN_RELAYER_FEE_USD = exports.MIN_GELATO_USD_BALANCE_FOR_SPONSORED_CALL = exports.DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION = exports.DEFAULT_PERMIT_DEADLINE_DURATION = exports.DEFAULT_SUBACCOUNT_MAX_ALLOWED_COUNT = exports.DEFAULT_SUBACCOUNT_EXPIRY_DURATION = exports.SUBACCOUNT_DOCS_URL = exports.SUBACCOUNT_MESSAGE = void 0;
3
+ exports.getRelayerFeeToken = exports.getDefaultGasPaymentToken = exports.getGasPaymentTokens = exports.EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = exports.MIN_RELAYER_FEE_USD = exports.MIN_GELATO_USD_BALANCE_FOR_SPONSORED_CALL = exports.DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION = exports.DEFAULT_PERMIT_DEADLINE_DURATION = exports.DEFAULT_SUBACCOUNT_MAX_ALLOWED_COUNT = exports.DEFAULT_SUBACCOUNT_EXPIRY_DURATION = exports.SUBACCOUNT_DOCS_URL = exports.SUBACCOUNT_MESSAGE = void 0;
4
4
  const numbers_1 = require("../utils/numbers");
5
5
  const time_1 = require("../utils/time");
6
6
  const chains_1 = require("./chains");
@@ -13,6 +13,7 @@ exports.DEFAULT_PERMIT_DEADLINE_DURATION = (0, time_1.periodToSeconds)(1, "1h");
13
13
  exports.DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION = (0, time_1.periodToSeconds)(1, "1h");
14
14
  exports.MIN_GELATO_USD_BALANCE_FOR_SPONSORED_CALL = (0, numbers_1.expandDecimals)(100, numbers_1.USD_DECIMALS); // 100$
15
15
  exports.MIN_RELAYER_FEE_USD = 5n ** BigInt(numbers_1.USD_DECIMALS - 1); // 0.5$
16
+ exports.EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = 1000;
16
17
  const GAS_PAYMENT_TOKENS = {
17
18
  [chains_1.ARBITRUM]: [(0, tokens_1.getTokenBySymbol)(chains_1.ARBITRUM, "USDC").address, (0, tokens_1.getTokenBySymbol)(chains_1.ARBITRUM, "WETH").address],
18
19
  [chains_1.AVALANCHE]: [(0, tokens_1.getTokenBySymbol)(chains_1.AVALANCHE, "USDC").address, (0, tokens_1.getTokenBySymbol)(chains_1.AVALANCHE, "WAVAX").address],
@@ -629,6 +629,20 @@ exports.MARKETS = {
629
629
  longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
630
630
  shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
631
631
  },
632
+ // SPX6900/USD [WETH-USDC]
633
+ "0x8263bC3766a09f6dD4Bab04b4bf8D45F2B0973FF": {
634
+ marketTokenAddress: "0x8263bC3766a09f6dD4Bab04b4bf8D45F2B0973FF",
635
+ indexTokenAddress: "0xb736be525A65326513351058427d1f47B0CfB045",
636
+ longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
637
+ shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
638
+ },
639
+ // MNT/USD [WETH-USDC]
640
+ "0x40dAEAc02dCf6b3c51F9151f532C21DCEF2F7E63": {
641
+ marketTokenAddress: "0x40dAEAc02dCf6b3c51F9151f532C21DCEF2F7E63",
642
+ indexTokenAddress: "0x955cd91eEaE618F5a7b49E1e3c7482833B10DAb4",
643
+ longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
644
+ shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
645
+ },
632
646
  // ARB/USD [ARB-ARB]
633
647
  "0x672fEA44f4583DdaD620d60C1Ac31021F47558Cb": {
634
648
  marketTokenAddress: "0x672fEA44f4583DdaD620d60C1Ac31021F47558Cb",
@@ -636,6 +650,27 @@ exports.MARKETS = {
636
650
  longTokenAddress: "0x912CE59144191C1204E64559FE8253a0e49E6548",
637
651
  shortTokenAddress: "0x912CE59144191C1204E64559FE8253a0e49E6548",
638
652
  },
653
+ // ALGO/USD [WBTC-USDC]
654
+ "0x3B7f4e4Cf2fa43df013d2B32673e6A01d29ab2Ac": {
655
+ marketTokenAddress: "0x3B7f4e4Cf2fa43df013d2B32673e6A01d29ab2Ac",
656
+ indexTokenAddress: "0x72Cd3a21aA7A898028d9501868Fbe6dED0020434",
657
+ longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
658
+ shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
659
+ },
660
+ // CRO/USD [WBTC-USDC]
661
+ "0xa29FfE4152B65A0347512Ae5c6A4Bbc7a3d6d51B": {
662
+ marketTokenAddress: "0xa29FfE4152B65A0347512Ae5c6A4Bbc7a3d6d51B",
663
+ indexTokenAddress: "0xB7EfE7c7f059E84Ab87A83A169c583Fb4A54fAc3",
664
+ longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
665
+ shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
666
+ },
667
+ // HBAR/USD [WBTC-USDC]
668
+ "0x9f0849FB830679829d1FB759b11236D375D15C78": {
669
+ marketTokenAddress: "0x9f0849FB830679829d1FB759b11236D375D15C78",
670
+ indexTokenAddress: "0xEb2A83b973f4dbB9511D92dd40d2ba4C683f0971",
671
+ longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
672
+ shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
673
+ },
639
674
  },
640
675
  [chains_1.AVALANCHE]: {
641
676
  // BTC/USD [BTC-USDC]