@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.
- package/build/cjs/src/abis/ClaimHandler.json +439 -0
- package/build/cjs/src/abis/index.js +4 -0
- package/build/cjs/src/configs/__tests__/markets.spec.js +1 -1
- package/build/cjs/src/configs/__tests__/tokens.spec.js +1 -1
- package/build/cjs/src/configs/batch.js +12 -0
- package/build/cjs/src/configs/contracts.js +2 -0
- package/build/cjs/src/configs/dataStore.js +13 -3
- package/build/cjs/src/configs/express.js +2 -1
- package/build/cjs/src/configs/markets.js +35 -0
- package/build/cjs/src/configs/oracleKeeper.js +19 -35
- package/build/cjs/src/configs/tokens.js +55 -0
- package/build/cjs/src/index.js +3 -3
- package/build/cjs/src/modules/orders/helpers.js +9 -0
- package/build/cjs/src/modules/orders/helpers.spec.js +1 -1
- package/build/cjs/src/modules/orders/orders.js +3 -3
- package/build/cjs/src/modules/utils/utils.js +3 -3
- package/build/cjs/src/prebuilt/hashedKinkModelMarketRatesKeys.json +40 -0
- package/build/cjs/src/prebuilt/hashedMarketConfigKeys.json +255 -0
- package/build/cjs/src/prebuilt/hashedMarketValuesKeys.json +75 -0
- package/build/cjs/src/types/subsquid.js +91 -1
- package/build/cjs/src/types/swapStrategy.js +2 -0
- package/build/cjs/src/types/trade.js +1 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +2 -0
- package/build/cjs/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +2 -0
- package/build/cjs/src/utils/__tests__/uiFeeReceiver.spec.js +10 -0
- package/build/cjs/src/utils/errors/transactionsErrors.js +7 -1
- package/build/cjs/src/utils/orderTransactions.js +0 -1
- package/build/cjs/src/utils/swap/botanixStaking.js +90 -0
- package/build/cjs/src/utils/swap/buildSwapStrategy.js +224 -0
- package/build/cjs/src/utils/swap/externalSwapPath.js +41 -0
- package/build/cjs/src/utils/swap/externalSwapQuoteByPath.js +27 -0
- package/build/cjs/src/utils/swap/swapValues.js +250 -11
- package/build/cjs/src/utils/trade/amounts.js +89 -41
- package/build/cjs/src/utils/trade/trade.js +2 -2
- package/build/cjs/src/utils/twap/uiFeeReceiver.js +9 -9
- package/build/esm/src/abis/ClaimHandler.json +439 -0
- package/build/esm/src/abis/index.js +4 -0
- package/build/esm/src/configs/__tests__/markets.spec.js +1 -1
- package/build/esm/src/configs/__tests__/tokens.spec.js +1 -1
- package/build/esm/src/configs/batch.js +13 -1
- package/build/esm/src/configs/contracts.js +2 -0
- package/build/esm/src/configs/dataStore.js +8 -0
- package/build/esm/src/configs/express.js +1 -0
- package/build/esm/src/configs/markets.js +35 -0
- package/build/esm/src/configs/oracleKeeper.js +17 -29
- package/build/esm/src/configs/tokens.js +55 -0
- package/build/esm/src/index.js +3 -3
- package/build/esm/src/modules/orders/helpers.js +9 -0
- package/build/esm/src/modules/orders/helpers.spec.js +1 -1
- package/build/esm/src/modules/orders/orders.js +3 -3
- package/build/esm/src/modules/utils/utils.js +3 -3
- package/build/esm/src/prebuilt/hashedKinkModelMarketRatesKeys.json +40 -0
- package/build/esm/src/prebuilt/hashedMarketConfigKeys.json +255 -0
- package/build/esm/src/prebuilt/hashedMarketValuesKeys.json +75 -0
- package/build/esm/src/types/subsquid.js +90 -0
- package/build/esm/src/types/swapStrategy.js +1 -0
- package/build/esm/src/types/trade.js +1 -0
- package/build/esm/src/utils/__tests__/orderTransactions/exchangeRouterMulticall.spec.js +2 -0
- package/build/esm/src/utils/__tests__/orderTransactions/increaseOrders.spec.js +2 -0
- package/build/esm/src/utils/__tests__/uiFeeReceiver.spec.js +11 -1
- package/build/esm/src/utils/errors/transactionsErrors.js +7 -1
- package/build/esm/src/utils/orderTransactions.js +0 -1
- package/build/esm/src/utils/swap/botanixStaking.js +83 -0
- package/build/esm/src/utils/swap/buildSwapStrategy.js +219 -0
- package/build/esm/src/utils/swap/externalSwapPath.js +37 -0
- package/build/esm/src/utils/swap/externalSwapQuoteByPath.js +23 -0
- package/build/esm/src/utils/swap/swapValues.js +248 -9
- package/build/esm/src/utils/trade/amounts.js +89 -41
- package/build/esm/src/utils/trade/trade.js +2 -2
- package/build/esm/src/utils/twap/uiFeeReceiver.js +9 -9
- package/build/types/src/abis/index.d.ts +1 -1
- package/build/types/src/configs/batch.d.ts +2 -1
- package/build/types/src/configs/contracts.d.ts +2 -0
- package/build/types/src/configs/dataStore.d.ts +4 -0
- package/build/types/src/configs/express.d.ts +1 -0
- package/build/types/src/configs/oracleKeeper.d.ts +2 -3
- package/build/types/src/types/subsquid.d.ts +303 -0
- package/build/types/src/types/swapStrategy.d.ts +33 -0
- package/build/types/src/types/tokens.d.ts +5 -0
- package/build/types/src/types/trade.d.ts +18 -4
- package/build/types/src/utils/swap/botanixStaking.d.ts +11 -0
- package/build/types/src/utils/swap/buildSwapStrategy.d.ts +22 -0
- package/build/types/src/utils/swap/externalSwapPath.d.ts +13 -0
- package/build/types/src/utils/swap/externalSwapQuoteByPath.d.ts +6 -0
- package/build/types/src/utils/swap/swapValues.d.ts +10 -3
- package/build/types/src/utils/trade/amounts.d.ts +5 -2
- package/build/types/src/utils/twap/uiFeeReceiver.d.ts +7 -7
- 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
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { erc20Abi } from "viem";
|
|
2
2
|
import ArbitrumNodeInterface from "./ArbitrumNodeInterface.json";
|
|
3
|
+
import ClaimHandler from "./ClaimHandler.json";
|
|
3
4
|
import CustomErrors from "./CustomErrors.json";
|
|
4
5
|
import DataStore from "./DataStore.json";
|
|
5
6
|
import ERC20PermitInterface from "./ERC20PermitInterface.json";
|
|
@@ -28,6 +29,7 @@ import RewardRouter from "./RewardRouter.json";
|
|
|
28
29
|
import RewardTracker from "./RewardTracker.json";
|
|
29
30
|
import RouterV2 from "./Router-v2.json";
|
|
30
31
|
import Router from "./Router.json";
|
|
32
|
+
import StBTC from "./StBTC.json";
|
|
31
33
|
import SubaccountGelatoRelayRouter from "./SubaccountGelatoRelayRouter.json";
|
|
32
34
|
import SubaccountRouter from "./SubaccountRouter.json";
|
|
33
35
|
import SyntheticsReader from "./SyntheticsReader.json";
|
|
@@ -93,4 +95,6 @@ export const abis = {
|
|
|
93
95
|
SubaccountGelatoRelayRouter: SubaccountGelatoRelayRouter.abi,
|
|
94
96
|
GelatoRelayRouter: GelatoRelayRouter.abi,
|
|
95
97
|
ArbitrumNodeInterface: ArbitrumNodeInterface.abi,
|
|
98
|
+
StBTC: StBTC.abi,
|
|
99
|
+
ClaimHandler: ClaimHandler.abi,
|
|
96
100
|
};
|
|
@@ -4,7 +4,7 @@ import { SUPPORTED_CHAIN_IDS } from "../chains";
|
|
|
4
4
|
import { MARKETS } from "../markets";
|
|
5
5
|
import { getOracleKeeperUrl } from "../oracleKeeper";
|
|
6
6
|
const getKeeperMarkets = async (chainId) => {
|
|
7
|
-
const res = await fetch(`${getOracleKeeperUrl(chainId
|
|
7
|
+
const res = await fetch(`${getOracleKeeperUrl(chainId)}/markets`);
|
|
8
8
|
const data = (await res.json());
|
|
9
9
|
if (!data || !data.markets || data.markets.length === 0)
|
|
10
10
|
throw Error("No markets in response");
|
|
@@ -4,7 +4,7 @@ import { ARBITRUM, AVALANCHE, BOTANIX, getChainName, SUPPORTED_CHAIN_IDS } from
|
|
|
4
4
|
import { getOracleKeeperUrl } from "../oracleKeeper";
|
|
5
5
|
import { TOKENS } from "../tokens";
|
|
6
6
|
const getKeeperTokens = async (chainId) => {
|
|
7
|
-
const res = await fetch(`${getOracleKeeperUrl(chainId
|
|
7
|
+
const res = await fetch(`${getOracleKeeperUrl(chainId)}/tokens`);
|
|
8
8
|
const data = (await res.json());
|
|
9
9
|
if (!data || !data.tokens || data.tokens.length === 0)
|
|
10
10
|
throw Error("No tokens in response");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ARBITRUM, AVALANCHE, AVALANCHE_FUJI } from "./chains";
|
|
1
|
+
import { ARBITRUM, AVALANCHE, AVALANCHE_FUJI, BOTANIX } from "./chains";
|
|
2
2
|
export const BATCH_CONFIGS = {
|
|
3
3
|
[ARBITRUM]: {
|
|
4
4
|
http: {
|
|
@@ -36,4 +36,16 @@ export const BATCH_CONFIGS = {
|
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
|
+
[BOTANIX]: {
|
|
40
|
+
http: {
|
|
41
|
+
batchSize: 0,
|
|
42
|
+
wait: 0,
|
|
43
|
+
},
|
|
44
|
+
client: {
|
|
45
|
+
multicall: {
|
|
46
|
+
batchSize: 1024 * 1024,
|
|
47
|
+
wait: 0,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
39
51
|
};
|
|
@@ -60,6 +60,7 @@ export const CONTRACTS = {
|
|
|
60
60
|
ChainlinkPriceFeedProvider: "0x527FB0bCfF63C47761039bB386cFE181A92a4701",
|
|
61
61
|
Multicall: "0x842ec2c7d803033edf55e478f461fc547bc54eb2",
|
|
62
62
|
ArbitrumNodeInterface: "0x00000000000000000000000000000000000000C8",
|
|
63
|
+
ClaimHandler: "0xCF2b097517EEBD6c36756A82844D2ec21Ee4C025",
|
|
63
64
|
},
|
|
64
65
|
[AVALANCHE]: {
|
|
65
66
|
// avalanche
|
|
@@ -120,6 +121,7 @@ export const CONTRACTS = {
|
|
|
120
121
|
ChainlinkPriceFeedProvider: "0x713c6a2479f6C079055A6AD3690D95dEDCEf9e1e",
|
|
121
122
|
Multicall: "0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
122
123
|
ArbitrumNodeInterface: zeroAddress,
|
|
124
|
+
ClaimHandler: "0xF73CE08A22c67f19d75892457817e917cB3f9493",
|
|
123
125
|
},
|
|
124
126
|
[BOTANIX]: {
|
|
125
127
|
DataStore: "0xA23B81a89Ab9D7D89fF8fc1b5d8508fB75Cc094d",
|
|
@@ -95,6 +95,8 @@ export const GASLESS_FEATURE_DISABLED_KEY = hashString("GASLESS_FEATURE_DISABLED
|
|
|
95
95
|
export const GELATO_RELAY_FEE_MULTIPLIER_FACTOR_KEY = hashString("GELATO_RELAY_FEE_MULTIPLIER_FACTOR");
|
|
96
96
|
export const REQUEST_EXPIRATION_TIME_KEY = hashString("REQUEST_EXPIRATION_TIME");
|
|
97
97
|
export const GMX_SIMULATION_ORIGIN = "0x" + keccakString("GMX SIMULATION ORIGIN").slice(-40);
|
|
98
|
+
export const CLAIM_TERMS_KEY = hashString("CLAIM_TERMS");
|
|
99
|
+
export const GENERAL_CLAIM_FEATURE_DISABLED = hashString("GENERAL_CLAIM_FEATURE_DISABLED");
|
|
98
100
|
export function subaccountExpiresAtKey(account, subaccount, actionType) {
|
|
99
101
|
return hashData(["bytes32", "address", "address", "bytes32"], [SUBACCOUNT_EXPIRES_AT, account, subaccount, actionType]);
|
|
100
102
|
}
|
|
@@ -296,3 +298,9 @@ export function priceFeedKey(token) {
|
|
|
296
298
|
export function gaslessFeatureDisabledKey(module) {
|
|
297
299
|
return hashData(["bytes32", "address"], [GASLESS_FEATURE_DISABLED_KEY, module]);
|
|
298
300
|
}
|
|
301
|
+
export function claimTermsKey(distributionId) {
|
|
302
|
+
return hashData(["bytes32", "uint256"], [CLAIM_TERMS_KEY, distributionId]);
|
|
303
|
+
}
|
|
304
|
+
export function claimsDisabledKey(distributionId) {
|
|
305
|
+
return hashData(["bytes32", "uint256"], [GENERAL_CLAIM_FEATURE_DISABLED, distributionId]);
|
|
306
|
+
}
|
|
@@ -10,6 +10,7 @@ export const DEFAULT_PERMIT_DEADLINE_DURATION = periodToSeconds(1, "1h");
|
|
|
10
10
|
export const DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION = periodToSeconds(1, "1h");
|
|
11
11
|
export const MIN_GELATO_USD_BALANCE_FOR_SPONSORED_CALL = expandDecimals(100, USD_DECIMALS); // 100$
|
|
12
12
|
export const MIN_RELAYER_FEE_USD = 5n ** BigInt(USD_DECIMALS - 1); // 0.5$
|
|
13
|
+
export const EXPRESS_EXTRA_EXECUTION_FEE_BUFFER_BPS = 1000;
|
|
13
14
|
const GAS_PAYMENT_TOKENS = {
|
|
14
15
|
[ARBITRUM]: [getTokenBySymbol(ARBITRUM, "USDC").address, getTokenBySymbol(ARBITRUM, "WETH").address],
|
|
15
16
|
[AVALANCHE]: [getTokenBySymbol(AVALANCHE, "USDC").address, getTokenBySymbol(AVALANCHE, "WAVAX").address],
|
|
@@ -626,6 +626,20 @@ export const MARKETS = {
|
|
|
626
626
|
longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
627
627
|
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
628
628
|
},
|
|
629
|
+
// SPX6900/USD [WETH-USDC]
|
|
630
|
+
"0x8263bC3766a09f6dD4Bab04b4bf8D45F2B0973FF": {
|
|
631
|
+
marketTokenAddress: "0x8263bC3766a09f6dD4Bab04b4bf8D45F2B0973FF",
|
|
632
|
+
indexTokenAddress: "0xb736be525A65326513351058427d1f47B0CfB045",
|
|
633
|
+
longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
634
|
+
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
635
|
+
},
|
|
636
|
+
// MNT/USD [WETH-USDC]
|
|
637
|
+
"0x40dAEAc02dCf6b3c51F9151f532C21DCEF2F7E63": {
|
|
638
|
+
marketTokenAddress: "0x40dAEAc02dCf6b3c51F9151f532C21DCEF2F7E63",
|
|
639
|
+
indexTokenAddress: "0x955cd91eEaE618F5a7b49E1e3c7482833B10DAb4",
|
|
640
|
+
longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
641
|
+
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
642
|
+
},
|
|
629
643
|
// ARB/USD [ARB-ARB]
|
|
630
644
|
"0x672fEA44f4583DdaD620d60C1Ac31021F47558Cb": {
|
|
631
645
|
marketTokenAddress: "0x672fEA44f4583DdaD620d60C1Ac31021F47558Cb",
|
|
@@ -633,6 +647,27 @@ export const MARKETS = {
|
|
|
633
647
|
longTokenAddress: "0x912CE59144191C1204E64559FE8253a0e49E6548",
|
|
634
648
|
shortTokenAddress: "0x912CE59144191C1204E64559FE8253a0e49E6548",
|
|
635
649
|
},
|
|
650
|
+
// ALGO/USD [WBTC-USDC]
|
|
651
|
+
"0x3B7f4e4Cf2fa43df013d2B32673e6A01d29ab2Ac": {
|
|
652
|
+
marketTokenAddress: "0x3B7f4e4Cf2fa43df013d2B32673e6A01d29ab2Ac",
|
|
653
|
+
indexTokenAddress: "0x72Cd3a21aA7A898028d9501868Fbe6dED0020434",
|
|
654
|
+
longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
655
|
+
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
656
|
+
},
|
|
657
|
+
// CRO/USD [WBTC-USDC]
|
|
658
|
+
"0xa29FfE4152B65A0347512Ae5c6A4Bbc7a3d6d51B": {
|
|
659
|
+
marketTokenAddress: "0xa29FfE4152B65A0347512Ae5c6A4Bbc7a3d6d51B",
|
|
660
|
+
indexTokenAddress: "0xB7EfE7c7f059E84Ab87A83A169c583Fb4A54fAc3",
|
|
661
|
+
longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
662
|
+
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
663
|
+
},
|
|
664
|
+
// HBAR/USD [WBTC-USDC]
|
|
665
|
+
"0x9f0849FB830679829d1FB759b11236D375D15C78": {
|
|
666
|
+
marketTokenAddress: "0x9f0849FB830679829d1FB759b11236D375D15C78",
|
|
667
|
+
indexTokenAddress: "0xEb2A83b973f4dbB9511D92dd40d2ba4C683f0971",
|
|
668
|
+
longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
669
|
+
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
670
|
+
},
|
|
636
671
|
},
|
|
637
672
|
[AVALANCHE]: {
|
|
638
673
|
// BTC/USD [BTC-USDC]
|
|
@@ -1,37 +1,25 @@
|
|
|
1
|
-
import random from "lodash/random";
|
|
2
|
-
import sample from "lodash/sample";
|
|
3
1
|
import { ARBITRUM, AVALANCHE, AVALANCHE_FUJI, BOTANIX } from "./chains";
|
|
4
2
|
const ORACLE_KEEPER_URLS = {
|
|
5
|
-
[ARBITRUM]:
|
|
6
|
-
[AVALANCHE]:
|
|
3
|
+
[ARBITRUM]: "https://arbitrum-api.gmxinfra.io",
|
|
4
|
+
[AVALANCHE]: "https://avalanche-api.gmxinfra.io",
|
|
5
|
+
[AVALANCHE_FUJI]: "https://synthetics-api-avax-fuji-upovm.ondigitalocean.app",
|
|
6
|
+
[BOTANIX]: "https://botanix-api.gmxinfra.io",
|
|
7
|
+
};
|
|
8
|
+
const ORACLE_KEEPER_FALLBACK_URLS = {
|
|
9
|
+
[ARBITRUM]: ["https://arbitrum-api-fallback.gmxinfra.io", "https://arbitrum-api-fallback.gmxinfra2.io"],
|
|
10
|
+
[AVALANCHE]: ["https://avalanche-api-fallback.gmxinfra.io", "https://avalanche-api-fallback.gmxinfra2.io"],
|
|
7
11
|
[AVALANCHE_FUJI]: ["https://synthetics-api-avax-fuji-upovm.ondigitalocean.app"],
|
|
8
|
-
[BOTANIX]: ["https://botanix-api.gmxinfra.io", "https://botanix-api.gmxinfra2.io"],
|
|
12
|
+
[BOTANIX]: ["https://botanix-api-fallback.gmxinfra.io", "https://botanix-api-fallback.gmxinfra2.io"],
|
|
9
13
|
};
|
|
10
|
-
export function getOracleKeeperUrl(chainId
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
throw new Error(`No oracle keeper urls for chain ${chainId}`);
|
|
14
|
-
}
|
|
15
|
-
return urls[index] || urls[0];
|
|
16
|
-
}
|
|
17
|
-
export function getOracleKeeperNextIndex(chainId, currentIndex) {
|
|
18
|
-
const urls = ORACLE_KEEPER_URLS[chainId];
|
|
19
|
-
if (!urls.length) {
|
|
20
|
-
throw new Error(`No oracle keeper urls for chain ${chainId}`);
|
|
14
|
+
export function getOracleKeeperUrl(chainId) {
|
|
15
|
+
if (!ORACLE_KEEPER_URLS[chainId]) {
|
|
16
|
+
throw new Error(`No oracle keeper url for chain ${chainId}`);
|
|
21
17
|
}
|
|
22
|
-
return
|
|
18
|
+
return ORACLE_KEEPER_URLS[chainId];
|
|
23
19
|
}
|
|
24
|
-
export function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const filteredUrls = urls.filter((url, i) => !bannedIndexes.includes(i));
|
|
28
|
-
if (filteredUrls.length) {
|
|
29
|
-
const url = sample(filteredUrls);
|
|
30
|
-
if (!url) {
|
|
31
|
-
throw new Error(`No oracle keeper urls for chain ${chainId}`);
|
|
32
|
-
}
|
|
33
|
-
return urls.indexOf(url);
|
|
34
|
-
}
|
|
20
|
+
export function getOracleKeeperFallbackUrls(chainId) {
|
|
21
|
+
if (!ORACLE_KEEPER_FALLBACK_URLS[chainId]) {
|
|
22
|
+
throw new Error(`No oracle keeper fallback urls for chain ${chainId}`);
|
|
35
23
|
}
|
|
36
|
-
return
|
|
24
|
+
return ORACLE_KEEPER_FALLBACK_URLS[chainId];
|
|
37
25
|
}
|