@bronlabs/intents-sdk 1.0.108 → 1.0.109
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/abi/Metadata.json +47 -0
- package/abi/OracleAggregator.json +593 -50
- package/dist/contracts.d.ts +3 -0
- package/dist/contracts.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/oracleAggregatorIndexer.d.ts +43 -0
- package/dist/oracleAggregatorIndexer.js +265 -0
- package/dist/oracleAggregatorIndexer.js.map +1 -0
- package/package.json +1 -1
package/abi/Metadata.json
CHANGED
|
@@ -296,6 +296,53 @@
|
|
|
296
296
|
"internalType": "uint128",
|
|
297
297
|
"name": "broadcasterFeeBps",
|
|
298
298
|
"type": "uint128"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"internalType": "uint128",
|
|
302
|
+
"name": "actualBlockTimestamp",
|
|
303
|
+
"type": "uint128"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"internalType": "uint128",
|
|
307
|
+
"name": "oraclesFee",
|
|
308
|
+
"type": "uint128"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"internalType": "uint128",
|
|
312
|
+
"name": "oraclesFeeBps",
|
|
313
|
+
"type": "uint128"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"components": [
|
|
317
|
+
{
|
|
318
|
+
"internalType": "string",
|
|
319
|
+
"name": "userSettlementFromAddress",
|
|
320
|
+
"type": "string"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"internalType": "string",
|
|
324
|
+
"name": "solverSettlementFromAddress",
|
|
325
|
+
"type": "string"
|
|
326
|
+
}
|
|
327
|
+
],
|
|
328
|
+
"internalType": "struct IOrderEngine.SettlementFromAddresses",
|
|
329
|
+
"name": "settlementFromAddresses",
|
|
330
|
+
"type": "tuple"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"internalType": "uint128",
|
|
334
|
+
"name": "solverFeePercent_e4",
|
|
335
|
+
"type": "uint128"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"internalType": "uint128",
|
|
339
|
+
"name": "broadcasterFeePercent_e4",
|
|
340
|
+
"type": "uint128"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"internalType": "uint128",
|
|
344
|
+
"name": "oraclesFeePercent_e4",
|
|
345
|
+
"type": "uint128"
|
|
299
346
|
}
|
|
300
347
|
],
|
|
301
348
|
"internalType": "struct IMetadata.OrderFullResponse",
|
|
@@ -11,27 +11,17 @@
|
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
"inputs": [],
|
|
14
|
-
"name": "
|
|
14
|
+
"name": "OA_INVALID_CALLER",
|
|
15
15
|
"type": "error"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"inputs": [],
|
|
19
|
-
"name": "
|
|
19
|
+
"name": "OA_INVALID_PARAMS",
|
|
20
20
|
"type": "error"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"inputs": [],
|
|
24
|
-
"name": "
|
|
25
|
-
"type": "error"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"inputs": [],
|
|
29
|
-
"name": "OA_ORACLE_ALREADY_INACTIVE",
|
|
30
|
-
"type": "error"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"inputs": [],
|
|
34
|
-
"name": "OA_ORACLE_ALREADY_REGISTERED",
|
|
24
|
+
"name": "OA_INVALID_STATUS",
|
|
35
25
|
"type": "error"
|
|
36
26
|
},
|
|
37
27
|
{
|
|
@@ -41,12 +31,12 @@
|
|
|
41
31
|
},
|
|
42
32
|
{
|
|
43
33
|
"inputs": [],
|
|
44
|
-
"name": "
|
|
34
|
+
"name": "OA_ORACLE_NOT_ASSIGNED",
|
|
45
35
|
"type": "error"
|
|
46
36
|
},
|
|
47
37
|
{
|
|
48
38
|
"inputs": [],
|
|
49
|
-
"name": "
|
|
39
|
+
"name": "OA_TIMEOUT",
|
|
50
40
|
"type": "error"
|
|
51
41
|
},
|
|
52
42
|
{
|
|
@@ -71,37 +61,389 @@
|
|
|
71
61
|
"name": "OwnableUnauthorizedAccount",
|
|
72
62
|
"type": "error"
|
|
73
63
|
},
|
|
64
|
+
{
|
|
65
|
+
"inputs": [
|
|
66
|
+
{
|
|
67
|
+
"internalType": "address",
|
|
68
|
+
"name": "token",
|
|
69
|
+
"type": "address"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"name": "SafeERC20FailedOperation",
|
|
73
|
+
"type": "error"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"anonymous": false,
|
|
77
|
+
"inputs": [
|
|
78
|
+
{
|
|
79
|
+
"indexed": false,
|
|
80
|
+
"internalType": "uint64",
|
|
81
|
+
"name": "version",
|
|
82
|
+
"type": "uint64"
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"name": "Initialized",
|
|
86
|
+
"type": "event"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"anonymous": false,
|
|
90
|
+
"inputs": [
|
|
91
|
+
{
|
|
92
|
+
"indexed": false,
|
|
93
|
+
"internalType": "string",
|
|
94
|
+
"name": "orderId",
|
|
95
|
+
"type": "string"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"indexed": false,
|
|
99
|
+
"internalType": "address[]",
|
|
100
|
+
"name": "oracles",
|
|
101
|
+
"type": "address[]"
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"name": "IntentOraclesInitialized",
|
|
105
|
+
"type": "event"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"anonymous": false,
|
|
109
|
+
"inputs": [
|
|
110
|
+
{
|
|
111
|
+
"indexed": false,
|
|
112
|
+
"internalType": "string",
|
|
113
|
+
"name": "orderId",
|
|
114
|
+
"type": "string"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"indexed": false,
|
|
118
|
+
"internalType": "uint256",
|
|
119
|
+
"name": "newRoundId",
|
|
120
|
+
"type": "uint256"
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"name": "OracleConsensusReset",
|
|
124
|
+
"type": "event"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"anonymous": false,
|
|
128
|
+
"inputs": [
|
|
129
|
+
{
|
|
130
|
+
"indexed": false,
|
|
131
|
+
"internalType": "address",
|
|
132
|
+
"name": "oracle",
|
|
133
|
+
"type": "address"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"indexed": false,
|
|
137
|
+
"internalType": "string",
|
|
138
|
+
"name": "networkId",
|
|
139
|
+
"type": "string"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"indexed": false,
|
|
143
|
+
"internalType": "uint256",
|
|
144
|
+
"name": "cooldownEndTime",
|
|
145
|
+
"type": "uint256"
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
"name": "OracleNetworkCooldown",
|
|
149
|
+
"type": "event"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"anonymous": false,
|
|
153
|
+
"inputs": [
|
|
154
|
+
{
|
|
155
|
+
"indexed": false,
|
|
156
|
+
"internalType": "address",
|
|
157
|
+
"name": "oracle",
|
|
158
|
+
"type": "address"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"indexed": false,
|
|
162
|
+
"internalType": "enum IOracleAggregator.OracleStatus",
|
|
163
|
+
"name": "status",
|
|
164
|
+
"type": "uint8"
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
"name": "OracleStatusChanged",
|
|
168
|
+
"type": "event"
|
|
169
|
+
},
|
|
74
170
|
{
|
|
75
171
|
"anonymous": false,
|
|
76
172
|
"inputs": [
|
|
77
173
|
{
|
|
78
|
-
"indexed":
|
|
79
|
-
"internalType": "
|
|
80
|
-
"name": "
|
|
81
|
-
"type": "
|
|
174
|
+
"indexed": true,
|
|
175
|
+
"internalType": "address",
|
|
176
|
+
"name": "previousOwner",
|
|
177
|
+
"type": "address"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"indexed": true,
|
|
181
|
+
"internalType": "address",
|
|
182
|
+
"name": "newOwner",
|
|
183
|
+
"type": "address"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"name": "OwnershipTransferred",
|
|
187
|
+
"type": "event"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"inputs": [
|
|
191
|
+
{
|
|
192
|
+
"internalType": "address",
|
|
193
|
+
"name": "_feeToken",
|
|
194
|
+
"type": "address"
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
"name": "claimOracleCollectedFees",
|
|
198
|
+
"outputs": [],
|
|
199
|
+
"stateMutability": "nonpayable",
|
|
200
|
+
"type": "function"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"inputs": [
|
|
204
|
+
{
|
|
205
|
+
"internalType": "address",
|
|
206
|
+
"name": "_oracle",
|
|
207
|
+
"type": "address"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"internalType": "string",
|
|
211
|
+
"name": "_networkId",
|
|
212
|
+
"type": "string"
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
"name": "cleanupExpiredNetworkCooldown",
|
|
216
|
+
"outputs": [],
|
|
217
|
+
"stateMutability": "nonpayable",
|
|
218
|
+
"type": "function"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"inputs": [
|
|
222
|
+
{
|
|
223
|
+
"internalType": "address",
|
|
224
|
+
"name": "_oracle",
|
|
225
|
+
"type": "address"
|
|
226
|
+
}
|
|
227
|
+
],
|
|
228
|
+
"name": "deactivateOracle",
|
|
229
|
+
"outputs": [],
|
|
230
|
+
"stateMutability": "nonpayable",
|
|
231
|
+
"type": "function"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"inputs": [
|
|
235
|
+
{
|
|
236
|
+
"internalType": "string",
|
|
237
|
+
"name": "_orderId",
|
|
238
|
+
"type": "string"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"internalType": "uint256",
|
|
242
|
+
"name": "_feesAmount",
|
|
243
|
+
"type": "uint256"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"internalType": "address",
|
|
247
|
+
"name": "_feeToken",
|
|
248
|
+
"type": "address"
|
|
249
|
+
}
|
|
250
|
+
],
|
|
251
|
+
"name": "distributeFees",
|
|
252
|
+
"outputs": [],
|
|
253
|
+
"stateMutability": "nonpayable",
|
|
254
|
+
"type": "function"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"inputs": [
|
|
258
|
+
{
|
|
259
|
+
"internalType": "string",
|
|
260
|
+
"name": "_orderId",
|
|
261
|
+
"type": "string"
|
|
262
|
+
}
|
|
263
|
+
],
|
|
264
|
+
"name": "getActualRoundOracleConsensus",
|
|
265
|
+
"outputs": [
|
|
266
|
+
{
|
|
267
|
+
"internalType": "uint256",
|
|
268
|
+
"name": "",
|
|
269
|
+
"type": "uint256"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"internalType": "uint256",
|
|
273
|
+
"name": "",
|
|
274
|
+
"type": "uint256"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"internalType": "uint256",
|
|
278
|
+
"name": "",
|
|
279
|
+
"type": "uint256"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"internalType": "uint256",
|
|
283
|
+
"name": "",
|
|
284
|
+
"type": "uint256"
|
|
285
|
+
}
|
|
286
|
+
],
|
|
287
|
+
"stateMutability": "view",
|
|
288
|
+
"type": "function"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"inputs": [
|
|
292
|
+
{
|
|
293
|
+
"internalType": "string",
|
|
294
|
+
"name": "_networkId",
|
|
295
|
+
"type": "string"
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
"name": "getEffectiveOraclesCount",
|
|
299
|
+
"outputs": [
|
|
300
|
+
{
|
|
301
|
+
"internalType": "uint256",
|
|
302
|
+
"name": "",
|
|
303
|
+
"type": "uint256"
|
|
304
|
+
}
|
|
305
|
+
],
|
|
306
|
+
"stateMutability": "view",
|
|
307
|
+
"type": "function"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"inputs": [
|
|
311
|
+
{
|
|
312
|
+
"internalType": "string",
|
|
313
|
+
"name": "_orderId",
|
|
314
|
+
"type": "string"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"internalType": "uint256",
|
|
318
|
+
"name": "_roundId",
|
|
319
|
+
"type": "uint256"
|
|
320
|
+
}
|
|
321
|
+
],
|
|
322
|
+
"name": "getOracleConsensusByRoundId",
|
|
323
|
+
"outputs": [
|
|
324
|
+
{
|
|
325
|
+
"internalType": "uint256",
|
|
326
|
+
"name": "",
|
|
327
|
+
"type": "uint256"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"internalType": "uint256",
|
|
331
|
+
"name": "",
|
|
332
|
+
"type": "uint256"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"internalType": "uint256",
|
|
336
|
+
"name": "",
|
|
337
|
+
"type": "uint256"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"internalType": "uint256",
|
|
341
|
+
"name": "",
|
|
342
|
+
"type": "uint256"
|
|
343
|
+
}
|
|
344
|
+
],
|
|
345
|
+
"stateMutability": "view",
|
|
346
|
+
"type": "function"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
"inputs": [
|
|
350
|
+
{
|
|
351
|
+
"internalType": "address",
|
|
352
|
+
"name": "_oracle",
|
|
353
|
+
"type": "address"
|
|
354
|
+
}
|
|
355
|
+
],
|
|
356
|
+
"name": "getOracleSubscribedNetworks",
|
|
357
|
+
"outputs": [
|
|
358
|
+
{
|
|
359
|
+
"internalType": "string[]",
|
|
360
|
+
"name": "",
|
|
361
|
+
"type": "string[]"
|
|
362
|
+
}
|
|
363
|
+
],
|
|
364
|
+
"stateMutability": "view",
|
|
365
|
+
"type": "function"
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
"inputs": [
|
|
369
|
+
{
|
|
370
|
+
"internalType": "contract IOrderEngine",
|
|
371
|
+
"name": "_orderEngine",
|
|
372
|
+
"type": "address"
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
"internalType": "address",
|
|
376
|
+
"name": "_owner",
|
|
377
|
+
"type": "address"
|
|
378
|
+
}
|
|
379
|
+
],
|
|
380
|
+
"name": "initialize",
|
|
381
|
+
"outputs": [],
|
|
382
|
+
"stateMutability": "nonpayable",
|
|
383
|
+
"type": "function"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"inputs": [
|
|
387
|
+
{
|
|
388
|
+
"internalType": "string",
|
|
389
|
+
"name": "_orderId",
|
|
390
|
+
"type": "string"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"internalType": "address",
|
|
394
|
+
"name": "_oracle",
|
|
395
|
+
"type": "address"
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"internalType": "bool",
|
|
399
|
+
"name": "_isUserTx",
|
|
400
|
+
"type": "bool"
|
|
401
|
+
}
|
|
402
|
+
],
|
|
403
|
+
"name": "isOracleVotedInActualRound",
|
|
404
|
+
"outputs": [
|
|
405
|
+
{
|
|
406
|
+
"internalType": "bool",
|
|
407
|
+
"name": "",
|
|
408
|
+
"type": "bool"
|
|
82
409
|
}
|
|
83
410
|
],
|
|
84
|
-
"
|
|
85
|
-
"type": "
|
|
411
|
+
"stateMutability": "view",
|
|
412
|
+
"type": "function"
|
|
86
413
|
},
|
|
87
414
|
{
|
|
88
|
-
"anonymous": false,
|
|
89
415
|
"inputs": [
|
|
90
416
|
{
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"type": "address"
|
|
417
|
+
"internalType": "string",
|
|
418
|
+
"name": "_orderId",
|
|
419
|
+
"type": "string"
|
|
95
420
|
},
|
|
96
421
|
{
|
|
97
|
-
"indexed": true,
|
|
98
422
|
"internalType": "address",
|
|
99
|
-
"name": "
|
|
423
|
+
"name": "_oracle",
|
|
100
424
|
"type": "address"
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"internalType": "bool",
|
|
428
|
+
"name": "_isUserTx",
|
|
429
|
+
"type": "bool"
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"internalType": "uint256",
|
|
433
|
+
"name": "_roundId",
|
|
434
|
+
"type": "uint256"
|
|
101
435
|
}
|
|
102
436
|
],
|
|
103
|
-
"name": "
|
|
104
|
-
"
|
|
437
|
+
"name": "isOracleVotedInRoundId",
|
|
438
|
+
"outputs": [
|
|
439
|
+
{
|
|
440
|
+
"internalType": "bool",
|
|
441
|
+
"name": "",
|
|
442
|
+
"type": "bool"
|
|
443
|
+
}
|
|
444
|
+
],
|
|
445
|
+
"stateMutability": "view",
|
|
446
|
+
"type": "function"
|
|
105
447
|
},
|
|
106
448
|
{
|
|
107
449
|
"inputs": [
|
|
@@ -111,33 +453,46 @@
|
|
|
111
453
|
"type": "address"
|
|
112
454
|
}
|
|
113
455
|
],
|
|
114
|
-
"name": "
|
|
456
|
+
"name": "kickOracle",
|
|
115
457
|
"outputs": [],
|
|
116
458
|
"stateMutability": "nonpayable",
|
|
117
459
|
"type": "function"
|
|
118
460
|
},
|
|
119
461
|
{
|
|
120
|
-
"inputs": [
|
|
462
|
+
"inputs": [],
|
|
463
|
+
"name": "maxNetworkCooldownsBeforeSuspend",
|
|
464
|
+
"outputs": [
|
|
121
465
|
{
|
|
122
|
-
"internalType": "
|
|
123
|
-
"name": "
|
|
124
|
-
"type": "
|
|
466
|
+
"internalType": "uint256",
|
|
467
|
+
"name": "",
|
|
468
|
+
"type": "uint256"
|
|
125
469
|
}
|
|
126
470
|
],
|
|
127
|
-
"
|
|
471
|
+
"stateMutability": "view",
|
|
472
|
+
"type": "function"
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
"inputs": [],
|
|
476
|
+
"name": "networkManager",
|
|
128
477
|
"outputs": [
|
|
129
478
|
{
|
|
130
|
-
"internalType": "
|
|
479
|
+
"internalType": "contract INetworkManager",
|
|
131
480
|
"name": "",
|
|
132
|
-
"type": "
|
|
481
|
+
"type": "address"
|
|
133
482
|
}
|
|
134
483
|
],
|
|
135
484
|
"stateMutability": "view",
|
|
136
485
|
"type": "function"
|
|
137
486
|
},
|
|
138
487
|
{
|
|
139
|
-
"inputs": [
|
|
140
|
-
|
|
488
|
+
"inputs": [
|
|
489
|
+
{
|
|
490
|
+
"internalType": "string",
|
|
491
|
+
"name": "",
|
|
492
|
+
"type": "string"
|
|
493
|
+
}
|
|
494
|
+
],
|
|
495
|
+
"name": "networkOraclesCount",
|
|
141
496
|
"outputs": [
|
|
142
497
|
{
|
|
143
498
|
"internalType": "uint256",
|
|
@@ -151,19 +506,25 @@
|
|
|
151
506
|
{
|
|
152
507
|
"inputs": [
|
|
153
508
|
{
|
|
154
|
-
"internalType": "
|
|
155
|
-
"name": "
|
|
509
|
+
"internalType": "address",
|
|
510
|
+
"name": "",
|
|
156
511
|
"type": "address"
|
|
157
512
|
},
|
|
158
513
|
{
|
|
159
514
|
"internalType": "address",
|
|
160
|
-
"name": "
|
|
515
|
+
"name": "",
|
|
161
516
|
"type": "address"
|
|
162
517
|
}
|
|
163
518
|
],
|
|
164
|
-
"name": "
|
|
165
|
-
"outputs": [
|
|
166
|
-
|
|
519
|
+
"name": "oracleCollectedFees",
|
|
520
|
+
"outputs": [
|
|
521
|
+
{
|
|
522
|
+
"internalType": "uint256",
|
|
523
|
+
"name": "",
|
|
524
|
+
"type": "uint256"
|
|
525
|
+
}
|
|
526
|
+
],
|
|
527
|
+
"stateMutability": "view",
|
|
167
528
|
"type": "function"
|
|
168
529
|
},
|
|
169
530
|
{
|
|
@@ -202,6 +563,92 @@
|
|
|
202
563
|
"stateMutability": "nonpayable",
|
|
203
564
|
"type": "function"
|
|
204
565
|
},
|
|
566
|
+
{
|
|
567
|
+
"inputs": [
|
|
568
|
+
{
|
|
569
|
+
"internalType": "address",
|
|
570
|
+
"name": "",
|
|
571
|
+
"type": "address"
|
|
572
|
+
}
|
|
573
|
+
],
|
|
574
|
+
"name": "oracleLatestConfirmationTime",
|
|
575
|
+
"outputs": [
|
|
576
|
+
{
|
|
577
|
+
"internalType": "uint256",
|
|
578
|
+
"name": "",
|
|
579
|
+
"type": "uint256"
|
|
580
|
+
}
|
|
581
|
+
],
|
|
582
|
+
"stateMutability": "view",
|
|
583
|
+
"type": "function"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"inputs": [
|
|
587
|
+
{
|
|
588
|
+
"internalType": "string",
|
|
589
|
+
"name": "",
|
|
590
|
+
"type": "string"
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
"internalType": "address",
|
|
594
|
+
"name": "",
|
|
595
|
+
"type": "address"
|
|
596
|
+
}
|
|
597
|
+
],
|
|
598
|
+
"name": "oracleNetworkCooldownEndTime",
|
|
599
|
+
"outputs": [
|
|
600
|
+
{
|
|
601
|
+
"internalType": "uint256",
|
|
602
|
+
"name": "",
|
|
603
|
+
"type": "uint256"
|
|
604
|
+
}
|
|
605
|
+
],
|
|
606
|
+
"stateMutability": "view",
|
|
607
|
+
"type": "function"
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
"inputs": [
|
|
611
|
+
{
|
|
612
|
+
"internalType": "string",
|
|
613
|
+
"name": "",
|
|
614
|
+
"type": "string"
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"internalType": "address",
|
|
618
|
+
"name": "",
|
|
619
|
+
"type": "address"
|
|
620
|
+
}
|
|
621
|
+
],
|
|
622
|
+
"name": "oracleNetworkSubscription",
|
|
623
|
+
"outputs": [
|
|
624
|
+
{
|
|
625
|
+
"internalType": "bool",
|
|
626
|
+
"name": "",
|
|
627
|
+
"type": "bool"
|
|
628
|
+
}
|
|
629
|
+
],
|
|
630
|
+
"stateMutability": "view",
|
|
631
|
+
"type": "function"
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
"inputs": [
|
|
635
|
+
{
|
|
636
|
+
"internalType": "address",
|
|
637
|
+
"name": "",
|
|
638
|
+
"type": "address"
|
|
639
|
+
}
|
|
640
|
+
],
|
|
641
|
+
"name": "oracleWrongDecisionCooldownEndTime",
|
|
642
|
+
"outputs": [
|
|
643
|
+
{
|
|
644
|
+
"internalType": "uint256",
|
|
645
|
+
"name": "",
|
|
646
|
+
"type": "uint256"
|
|
647
|
+
}
|
|
648
|
+
],
|
|
649
|
+
"stateMutability": "view",
|
|
650
|
+
"type": "function"
|
|
651
|
+
},
|
|
205
652
|
{
|
|
206
653
|
"inputs": [
|
|
207
654
|
{
|
|
@@ -313,12 +760,64 @@
|
|
|
313
760
|
{
|
|
314
761
|
"inputs": [
|
|
315
762
|
{
|
|
316
|
-
"internalType": "
|
|
317
|
-
"name": "
|
|
763
|
+
"internalType": "string",
|
|
764
|
+
"name": "_orderId",
|
|
765
|
+
"type": "string"
|
|
766
|
+
}
|
|
767
|
+
],
|
|
768
|
+
"name": "resetOracleConsensusOnSolverTx",
|
|
769
|
+
"outputs": [],
|
|
770
|
+
"stateMutability": "nonpayable",
|
|
771
|
+
"type": "function"
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
"inputs": [
|
|
775
|
+
{
|
|
776
|
+
"internalType": "uint256",
|
|
777
|
+
"name": "_max",
|
|
778
|
+
"type": "uint256"
|
|
779
|
+
}
|
|
780
|
+
],
|
|
781
|
+
"name": "setMaxNetworkCooldownsBeforeSuspend",
|
|
782
|
+
"outputs": [],
|
|
783
|
+
"stateMutability": "nonpayable",
|
|
784
|
+
"type": "function"
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
"inputs": [
|
|
788
|
+
{
|
|
789
|
+
"internalType": "uint256",
|
|
790
|
+
"name": "_cooldown",
|
|
791
|
+
"type": "uint256"
|
|
792
|
+
}
|
|
793
|
+
],
|
|
794
|
+
"name": "setWrongOracleDecisionCooldown",
|
|
795
|
+
"outputs": [],
|
|
796
|
+
"stateMutability": "nonpayable",
|
|
797
|
+
"type": "function"
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
"inputs": [],
|
|
801
|
+
"name": "solverRegister",
|
|
802
|
+
"outputs": [
|
|
803
|
+
{
|
|
804
|
+
"internalType": "address",
|
|
805
|
+
"name": "",
|
|
318
806
|
"type": "address"
|
|
319
807
|
}
|
|
320
808
|
],
|
|
321
|
-
"
|
|
809
|
+
"stateMutability": "view",
|
|
810
|
+
"type": "function"
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
"inputs": [
|
|
814
|
+
{
|
|
815
|
+
"internalType": "string",
|
|
816
|
+
"name": "_networkId",
|
|
817
|
+
"type": "string"
|
|
818
|
+
}
|
|
819
|
+
],
|
|
820
|
+
"name": "subscribeToNetwork",
|
|
322
821
|
"outputs": [],
|
|
323
822
|
"stateMutability": "nonpayable",
|
|
324
823
|
"type": "function"
|
|
@@ -335,5 +834,49 @@
|
|
|
335
834
|
"outputs": [],
|
|
336
835
|
"stateMutability": "nonpayable",
|
|
337
836
|
"type": "function"
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
"inputs": [
|
|
840
|
+
{
|
|
841
|
+
"internalType": "string",
|
|
842
|
+
"name": "_networkId",
|
|
843
|
+
"type": "string"
|
|
844
|
+
}
|
|
845
|
+
],
|
|
846
|
+
"name": "unsubscribeFromNetwork",
|
|
847
|
+
"outputs": [],
|
|
848
|
+
"stateMutability": "nonpayable",
|
|
849
|
+
"type": "function"
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
"inputs": [
|
|
853
|
+
{
|
|
854
|
+
"internalType": "address",
|
|
855
|
+
"name": "_oracle",
|
|
856
|
+
"type": "address"
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
"internalType": "bool",
|
|
860
|
+
"name": "_isSuspend",
|
|
861
|
+
"type": "bool"
|
|
862
|
+
}
|
|
863
|
+
],
|
|
864
|
+
"name": "updateSuspendOracleStatus",
|
|
865
|
+
"outputs": [],
|
|
866
|
+
"stateMutability": "nonpayable",
|
|
867
|
+
"type": "function"
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
"inputs": [],
|
|
871
|
+
"name": "wrongOracleDecisionCooldown",
|
|
872
|
+
"outputs": [
|
|
873
|
+
{
|
|
874
|
+
"internalType": "uint256",
|
|
875
|
+
"name": "",
|
|
876
|
+
"type": "uint256"
|
|
877
|
+
}
|
|
878
|
+
],
|
|
879
|
+
"stateMutability": "view",
|
|
880
|
+
"type": "function"
|
|
338
881
|
}
|
|
339
|
-
]
|
|
882
|
+
]
|
package/dist/contracts.d.ts
CHANGED
|
@@ -77,6 +77,9 @@ export interface OrderEngineContract {
|
|
|
77
77
|
export interface OracleAggregatorContract {
|
|
78
78
|
oracleConfirmUserTx(orderId: string, isConfirmed: boolean, params?: NetworkParams): Promise<ethers.ContractTransactionResponse>;
|
|
79
79
|
oracleConfirmSolverTx(orderId: string, isConfirmed: boolean, params?: NetworkParams): Promise<ethers.ContractTransactionResponse>;
|
|
80
|
+
getOracleSubscribedNetworks(oracle: string): Promise<string[]>;
|
|
81
|
+
subscribeToNetwork(networkId: string): Promise<ethers.ContractTransactionResponse>;
|
|
82
|
+
unsubscribeFromNetwork(networkId: string): Promise<ethers.ContractTransactionResponse>;
|
|
80
83
|
}
|
|
81
84
|
export declare function initOrderEngine(orderEngineAddress: string, provider: ethers.JsonRpcProvider | ethers.Signer): OrderEngineContract & ethers.Contract;
|
|
82
85
|
export declare function initOracleAggregator(oracleAggregatorAddress: string, provider: ethers.JsonRpcProvider | ethers.Signer): OracleAggregatorContract & ethers.Contract;
|
package/dist/contracts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"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CAAC,SAAS;YAC/B,YAAY,EAAE,UAAU,CAAC,YAAY;YACrC,aAAa,EAAE,UAAU,CAAC,aAAa;YACvC,UAAU,EAAE,UAAU,CAAC,UAAU;SAClC;QACD,WAAW,EAAE;YACX,SAAS,EAAE,WAAW,CAAC,SAAS;YAChC,YAAY,EAAE,WAAW,CAAC,YAAY;YACtC,WAAW,EAAE,WAAW,CAAC,WAAW;YACpC,YAAY,EAAE,WAAW,CAAC,YAAY;SACvC;QACD,aAAa,EAAE;YACb,UAAU,EAAE,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE;YAC/C,WAAW,EAAE,aAAa,CAAC,WAAW,CAAC,QAAQ,EAAE;YACjD,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,QAAQ,EAAE;YAC7C,YAAY,EAAE,aAAa,CAAC,YAAY,CAAC,QAAQ,EAAE;YACnD,mBAAmB,EAAE,aAAa,CAAC,mBAAmB,CAAC,QAAQ,EAAE;SAClE;KACF,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACd,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,uCAAuC;AACtC,MAAM,CAAC,SAAiB,CAAC,MAAM,GAAG;IACjC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;AACzB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,uCAAuC;AACtC,MAAM,CAAC,SAAiB,CAAC,MAAM,GAAG;IACjC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;AACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
import { IntentsConfig } from './config.js';
|
|
3
|
+
export interface OracleAggregatorIndexerConfig extends IntentsConfig {
|
|
4
|
+
oracleAggregatorAddress: string;
|
|
5
|
+
}
|
|
6
|
+
export interface OracleConsensusResetEvent {
|
|
7
|
+
type: 'OracleConsensusReset';
|
|
8
|
+
data: {
|
|
9
|
+
orderId: string;
|
|
10
|
+
newRoundId: number;
|
|
11
|
+
};
|
|
12
|
+
event: ethers.EventLog;
|
|
13
|
+
retries: number;
|
|
14
|
+
}
|
|
15
|
+
type EventProcessor = (event: OracleConsensusResetEvent) => Promise<void>;
|
|
16
|
+
export declare class OracleAggregatorIndexer {
|
|
17
|
+
private readonly config;
|
|
18
|
+
private readonly httpProvider;
|
|
19
|
+
private wsProvider;
|
|
20
|
+
private wsOracleAggregator;
|
|
21
|
+
private readonly oracleAggregator;
|
|
22
|
+
private readonly eventQueue;
|
|
23
|
+
private readonly processors;
|
|
24
|
+
private isRunning;
|
|
25
|
+
private lastProcessedBlock;
|
|
26
|
+
private readonly rpcTimeoutMs;
|
|
27
|
+
private isProcessingQueue;
|
|
28
|
+
private reconnectTimeout;
|
|
29
|
+
private healthCheckInterval;
|
|
30
|
+
constructor(config: OracleAggregatorIndexerConfig);
|
|
31
|
+
addProcessor(processor: EventProcessor): void;
|
|
32
|
+
start(): Promise<void>;
|
|
33
|
+
stop(): Promise<void>;
|
|
34
|
+
private processHistoricalEvents;
|
|
35
|
+
private startWebSocketListener;
|
|
36
|
+
private monitorWebSocketHealth;
|
|
37
|
+
private reconnectWebSocket;
|
|
38
|
+
private withTimeout;
|
|
39
|
+
private processBlockRange;
|
|
40
|
+
private processEventQueue;
|
|
41
|
+
private debugTrace;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { ethers, FetchRequest } from 'ethers';
|
|
2
|
+
import WebSocket from 'ws';
|
|
3
|
+
import { sleep, log } from './utils.js';
|
|
4
|
+
import { EventQueue } from './eventQueue.js';
|
|
5
|
+
import { initOracleAggregator } from './contracts.js';
|
|
6
|
+
import { configureProxy, getProxyAgent } from './proxy.js';
|
|
7
|
+
export class OracleAggregatorIndexer {
|
|
8
|
+
constructor(config) {
|
|
9
|
+
this.debugTrace = (prefix) => (info) => {
|
|
10
|
+
if (info.action !== 'receiveRpcResult') {
|
|
11
|
+
log.debug(`OracleAggregator ${prefix}: ${info.action} -> ${info.payload?.method}`);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
this.config = config;
|
|
15
|
+
configureProxy(config.proxyUrl);
|
|
16
|
+
const req = new FetchRequest(config.rpcUrl);
|
|
17
|
+
if (config.rpcAuthToken) {
|
|
18
|
+
req.setHeader('x-api-key', config.rpcAuthToken);
|
|
19
|
+
}
|
|
20
|
+
const agent = getProxyAgent();
|
|
21
|
+
if (agent) {
|
|
22
|
+
req.getUrlFunc = FetchRequest.createGetUrlFunc({ agent });
|
|
23
|
+
}
|
|
24
|
+
this.httpProvider = new ethers.JsonRpcProvider(req, undefined, { staticNetwork: true });
|
|
25
|
+
void this.httpProvider.on('debug', this.debugTrace('RPC'));
|
|
26
|
+
this.wsProvider = null;
|
|
27
|
+
this.wsOracleAggregator = null;
|
|
28
|
+
this.oracleAggregator = initOracleAggregator(config.oracleAggregatorAddress, this.httpProvider);
|
|
29
|
+
this.eventQueue = new EventQueue();
|
|
30
|
+
this.processors = [];
|
|
31
|
+
this.isRunning = false;
|
|
32
|
+
this.lastProcessedBlock = 0;
|
|
33
|
+
this.isProcessingQueue = false;
|
|
34
|
+
this.reconnectTimeout = null;
|
|
35
|
+
this.rpcTimeoutMs = 15_000;
|
|
36
|
+
this.healthCheckInterval = null;
|
|
37
|
+
}
|
|
38
|
+
addProcessor(processor) {
|
|
39
|
+
this.processors.push(processor);
|
|
40
|
+
}
|
|
41
|
+
async start() {
|
|
42
|
+
if (this.isRunning) {
|
|
43
|
+
log.warn('OracleAggregator indexer is already running');
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
this.isRunning = true;
|
|
47
|
+
log.info(`Starting OracleAggregator indexer with offset -${this.config.startBlockOffset} blocks`);
|
|
48
|
+
try {
|
|
49
|
+
await this.startWebSocketListener();
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
log.error('Error starting OracleAggregator indexer:', error);
|
|
53
|
+
this.isRunning = false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async stop() {
|
|
57
|
+
if (!this.isRunning) {
|
|
58
|
+
log.warn('OracleAggregator indexer is not running');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
log.info('Stopping OracleAggregator indexer...');
|
|
62
|
+
this.isRunning = false;
|
|
63
|
+
if (this.healthCheckInterval) {
|
|
64
|
+
clearInterval(this.healthCheckInterval);
|
|
65
|
+
this.healthCheckInterval = null;
|
|
66
|
+
}
|
|
67
|
+
if (this.reconnectTimeout) {
|
|
68
|
+
clearTimeout(this.reconnectTimeout);
|
|
69
|
+
this.reconnectTimeout = null;
|
|
70
|
+
}
|
|
71
|
+
if (this.wsOracleAggregator) {
|
|
72
|
+
void this.wsOracleAggregator.removeAllListeners();
|
|
73
|
+
this.wsOracleAggregator = null;
|
|
74
|
+
}
|
|
75
|
+
if (this.wsProvider) {
|
|
76
|
+
void this.wsProvider.removeAllListeners();
|
|
77
|
+
void this.wsProvider.destroy();
|
|
78
|
+
this.wsProvider = null;
|
|
79
|
+
}
|
|
80
|
+
const maxWaitTime = 30000;
|
|
81
|
+
const startTime = Date.now();
|
|
82
|
+
while (!this.eventQueue.isEmpty() && (Date.now() - startTime) < maxWaitTime) {
|
|
83
|
+
log.info(`Waiting for ${this.eventQueue.size()} OracleAggregator events to complete before stopping`);
|
|
84
|
+
await sleep(1000);
|
|
85
|
+
}
|
|
86
|
+
if (!this.eventQueue.isEmpty()) {
|
|
87
|
+
log.warn(`Stopping OracleAggregator indexer with ${this.eventQueue.size()} unprocessed events after timeout`);
|
|
88
|
+
}
|
|
89
|
+
log.info('OracleAggregator indexer stopped');
|
|
90
|
+
}
|
|
91
|
+
async processHistoricalEvents() {
|
|
92
|
+
const currentBlock = await this.withTimeout(this.httpProvider.getBlockNumber(), 'httpProvider.getBlockNumber');
|
|
93
|
+
if (!this.lastProcessedBlock) {
|
|
94
|
+
this.lastProcessedBlock = currentBlock - this.config.startBlockOffset;
|
|
95
|
+
}
|
|
96
|
+
if (currentBlock > this.lastProcessedBlock) {
|
|
97
|
+
log.info(`Processing historical OracleAggregator events from ${this.lastProcessedBlock + 1} to ${currentBlock}`);
|
|
98
|
+
await this.processBlockRange(this.lastProcessedBlock + 1, currentBlock);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async startWebSocketListener() {
|
|
102
|
+
await this.processHistoricalEvents();
|
|
103
|
+
try {
|
|
104
|
+
const wsAgent = getProxyAgent();
|
|
105
|
+
const wsOptions = wsAgent ? { agent: wsAgent } : undefined;
|
|
106
|
+
const ws = new WebSocket(this.config.rpcUrl.replace(/^https?:\/\//, 'wss://'), wsOptions);
|
|
107
|
+
ws.on('error', error => {
|
|
108
|
+
if (!this.isRunning)
|
|
109
|
+
return;
|
|
110
|
+
log.error('OracleAggregator WebSocket transport error:', error);
|
|
111
|
+
this.reconnectWebSocket();
|
|
112
|
+
});
|
|
113
|
+
ws.on('close', (code, reason) => {
|
|
114
|
+
if (!this.isRunning)
|
|
115
|
+
return;
|
|
116
|
+
log.warn(`OracleAggregator WebSocket transport closed: ${code} ${reason?.toString?.() ?? ''}`);
|
|
117
|
+
this.reconnectWebSocket();
|
|
118
|
+
});
|
|
119
|
+
this.wsProvider = new ethers.WebSocketProvider(ws, undefined, { staticNetwork: true });
|
|
120
|
+
void this.wsProvider.on('debug', this.debugTrace('WS'));
|
|
121
|
+
this.wsOracleAggregator = new ethers.Contract(this.config.oracleAggregatorAddress, this.oracleAggregator.interface, this.wsProvider);
|
|
122
|
+
void this.wsOracleAggregator.on('OracleConsensusReset', async (orderId, newRoundId, event) => {
|
|
123
|
+
if (!this.isRunning)
|
|
124
|
+
return;
|
|
125
|
+
this.eventQueue.add({
|
|
126
|
+
type: 'OracleConsensusReset',
|
|
127
|
+
data: {
|
|
128
|
+
orderId,
|
|
129
|
+
newRoundId: Number(newRoundId)
|
|
130
|
+
},
|
|
131
|
+
event,
|
|
132
|
+
retries: 0
|
|
133
|
+
});
|
|
134
|
+
this.lastProcessedBlock = event.blockNumber;
|
|
135
|
+
if (this.isRunning && !this.eventQueue.isEmpty()) {
|
|
136
|
+
await this.processEventQueue();
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
this.monitorWebSocketHealth();
|
|
140
|
+
log.info('OracleAggregator WebSocket listener started');
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
log.error('Error starting OracleAggregator WebSocket:', error);
|
|
144
|
+
this.reconnectWebSocket();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
monitorWebSocketHealth() {
|
|
148
|
+
if (this.healthCheckInterval) {
|
|
149
|
+
clearInterval(this.healthCheckInterval);
|
|
150
|
+
}
|
|
151
|
+
this.healthCheckInterval = setInterval(async () => {
|
|
152
|
+
if (!this.isRunning || !this.wsProvider) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
try {
|
|
156
|
+
await this.withTimeout(this.wsProvider.getBlockNumber(), 'wsProvider.getBlockNumber (health check)');
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
log.warn('OracleAggregator WebSocket health check failed:', error);
|
|
160
|
+
this.reconnectWebSocket();
|
|
161
|
+
}
|
|
162
|
+
}, 60_000);
|
|
163
|
+
}
|
|
164
|
+
reconnectWebSocket() {
|
|
165
|
+
if (!this.isRunning || this.reconnectTimeout)
|
|
166
|
+
return;
|
|
167
|
+
if (this.wsOracleAggregator) {
|
|
168
|
+
void this.wsOracleAggregator.removeAllListeners();
|
|
169
|
+
this.wsOracleAggregator = null;
|
|
170
|
+
}
|
|
171
|
+
if (this.wsProvider) {
|
|
172
|
+
void this.wsProvider.removeAllListeners();
|
|
173
|
+
void this.wsProvider.destroy();
|
|
174
|
+
this.wsProvider = null;
|
|
175
|
+
}
|
|
176
|
+
log.info('Reconnecting OracleAggregator WebSocket in 5 seconds...');
|
|
177
|
+
this.reconnectTimeout = setTimeout(async () => {
|
|
178
|
+
this.reconnectTimeout = null;
|
|
179
|
+
if (this.isRunning) {
|
|
180
|
+
try {
|
|
181
|
+
await this.startWebSocketListener();
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
log.error('Error reconnecting OracleAggregator WebSocket:', error);
|
|
185
|
+
this.reconnectWebSocket();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}, 5000);
|
|
189
|
+
}
|
|
190
|
+
async withTimeout(promise, label) {
|
|
191
|
+
return await Promise.race([
|
|
192
|
+
promise,
|
|
193
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error(`RPC timeout in ${label} after ${this.rpcTimeoutMs}ms`)), this.rpcTimeoutMs))
|
|
194
|
+
]);
|
|
195
|
+
}
|
|
196
|
+
async processBlockRange(fromBlock, toBlock) {
|
|
197
|
+
const chunkSize = 2000;
|
|
198
|
+
for (let from = fromBlock; from <= toBlock; from += chunkSize) {
|
|
199
|
+
if (!this.isRunning)
|
|
200
|
+
break;
|
|
201
|
+
const to = Math.min(from + chunkSize - 1, toBlock);
|
|
202
|
+
try {
|
|
203
|
+
const events = await this.withTimeout(this.oracleAggregator.queryFilter(this.oracleAggregator.filters.OracleConsensusReset(), from, to), `oracleAggregator.queryFilter ${from}-${to}`);
|
|
204
|
+
for (const event of events) {
|
|
205
|
+
const { args: { orderId, newRoundId } } = this.oracleAggregator.interface.parseLog({
|
|
206
|
+
topics: event.topics,
|
|
207
|
+
data: event.data
|
|
208
|
+
});
|
|
209
|
+
this.eventQueue.add({
|
|
210
|
+
type: 'OracleConsensusReset',
|
|
211
|
+
data: {
|
|
212
|
+
orderId,
|
|
213
|
+
newRoundId: Number(newRoundId)
|
|
214
|
+
},
|
|
215
|
+
event: event,
|
|
216
|
+
retries: 0
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
this.lastProcessedBlock = to;
|
|
220
|
+
if (this.isRunning && !this.eventQueue.isEmpty()) {
|
|
221
|
+
await this.processEventQueue();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
log.error(`Error processing OracleAggregator block range ${from}-${to}:`, error);
|
|
226
|
+
throw error;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
async processEventQueue() {
|
|
231
|
+
if (this.isProcessingQueue || this.eventQueue.isEmpty() || this.processors.length === 0) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
this.isProcessingQueue = true;
|
|
235
|
+
try {
|
|
236
|
+
while (!this.eventQueue.isEmpty()) {
|
|
237
|
+
const event = this.eventQueue.peek();
|
|
238
|
+
if (!event)
|
|
239
|
+
continue;
|
|
240
|
+
try {
|
|
241
|
+
for (const processor of this.processors) {
|
|
242
|
+
await processor(event);
|
|
243
|
+
}
|
|
244
|
+
this.eventQueue.remove();
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
log.error(`Error processing OracleAggregator event:`, error);
|
|
248
|
+
if (event.retries < this.config.maxRetries) {
|
|
249
|
+
event.retries++;
|
|
250
|
+
log.info(`Retrying OracleAggregator event processing (${event.retries}/${this.config.maxRetries})`);
|
|
251
|
+
await sleep(this.config.retryDelay);
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
log.error(`Max retries reached for OracleAggregator event, removing from queue:`, event);
|
|
255
|
+
this.eventQueue.remove();
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
finally {
|
|
261
|
+
this.isProcessingQueue = false;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=oracleAggregatorIndexer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oracleAggregatorIndexer.js","sourceRoot":"","sources":["../src/oracleAggregatorIndexer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA4B,YAAY,EAAE,MAAM,QAAQ,CAAC;AACxE,OAAO,SAAS,MAAM,IAAI,CAAC;AAE3B,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAA4B,MAAM,gBAAgB,CAAC;AAEhF,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAkB3D,MAAM,OAAO,uBAAuB;IAgBlC,YAAY,MAAqC;QA+TzC,eAAU,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,IAAS,EAAE,EAAE;YACrD,IAAI,IAAI,CAAC,MAAM,KAAK,kBAAkB,EAAE,CAAC;gBACvC,GAAG,CAAC,KAAK,CAAC,oBAAoB,MAAM,KAAK,IAAI,CAAC,MAAM,OAAO,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