@@ -17,6 +17,9 @@ const requestDelay = process.env.REQUEST_DELAY
17
17
18
18
const limit = pLimit ( 5 ) ;
19
19
20
+ // Add a constant for maximum retries
21
+ const MAX_RETRIES = 5 ;
22
+
20
23
export type EASChainConfig = {
21
24
chainId : number ;
22
25
chainName : string ;
@@ -158,16 +161,27 @@ export const EAS_CHAIN_CONFIGS: EASChainConfig[] = [
158
161
etherscanURL : "https://lineascan.build/" ,
159
162
rpcProvider : `https://linea-mainnet.infura.io/v3/${ process . env . INFURA_LINEA_API_KEY } ` ,
160
163
} ,
164
+ // {
165
+ // chainId: 80001,
166
+ // chainName: "polygon-mumbai",
167
+ // subdomain: "polygon-mumbai.",
168
+ // version: "1.2.0",
169
+ // contractAddress: "0xaEF4103A04090071165F78D45D83A0C0782c2B2a",
170
+ // schemaRegistryAddress: "0x55D26f9ae0203EF95494AE4C170eD35f4Cf77797",
171
+ // contractStartBlock: 41442300,
172
+ // etherscanURL: "https://mumbai.polygonscan.com/",
173
+ // rpcProvider: `https://polygon-mumbai.infura.io/v3/${process.env.INFURA_API_KEY}`,
174
+ // },
161
175
{
162
- chainId : 80001 ,
163
- chainName : "polygon-mumbai " ,
164
- subdomain : "polygon-mumbai ." ,
165
- version : "1.2 .0" ,
166
- contractAddress : "0xaEF4103A04090071165F78D45D83A0C0782c2B2a " ,
167
- schemaRegistryAddress : "0x55D26f9ae0203EF95494AE4C170eD35f4Cf77797 " ,
168
- contractStartBlock : 41442300 ,
169
- etherscanURL : "https://mumbai .polygonscan.com/" ,
170
- rpcProvider : `https://polygon-mumbai.infura.io/v3/ ${ process . env . INFURA_API_KEY } ` ,
176
+ chainId : 80002 ,
177
+ chainName : "polygon-amoy " ,
178
+ subdomain : "polygon-amoy ." ,
179
+ version : "1.3 .0" ,
180
+ contractAddress : "0xb101275a60d8bfb14529C421899aD7CA1Ae5B5Fc " ,
181
+ schemaRegistryAddress : "0x23c5701A1BDa89C61d181BD79E5203c730708AE7 " ,
182
+ contractStartBlock : 7372405 ,
183
+ etherscanURL : "https://amoy .polygonscan.com/" ,
184
+ rpcProvider : `https://restless-palpable-mountain.matic-amoy.quiknode.pro/ ${ process . env . QUICKNODE_POLYGON_AMOY_API_KEY } / ` ,
171
185
} ,
172
186
{
173
187
chainId : 137 ,
@@ -224,6 +238,28 @@ export const EAS_CHAIN_CONFIGS: EASChainConfig[] = [
224
238
etherscanURL : "https://explorer.zksync.io" ,
225
239
rpcProvider : `https://mainnet.era.zksync.io` ,
226
240
} ,
241
+ {
242
+ chainId : 31 ,
243
+ chainName : "rootstock-testnet" ,
244
+ subdomain : "rootstock-testnet." ,
245
+ version : "1.3.0" ,
246
+ contractAddress : "0xc300aeEaDd60999933468738c9F5D7e9C0671e1c" ,
247
+ schemaRegistryAddress : "0x679c62956cD2801AbAbF80e9D430f18859Eea2d5" ,
248
+ contractStartBlock : 5457123 ,
249
+ etherscanURL : "https://rootstock-testnet.blockscout.com/" ,
250
+ rpcProvider : `https://rpc.testnet.rootstock.io/${ process . env . ROOTSTOCK_TESTNET_API_KEY } ` ,
251
+ } ,
252
+ {
253
+ chainId : 30 ,
254
+ chainName : "rootstock" ,
255
+ subdomain : "rootstock." ,
256
+ version : "1.3.0" ,
257
+ contractAddress : "0x54C0726E9d2D57Bc37AD52c7E219A3229e0eE963" ,
258
+ schemaRegistryAddress : "0xeF29675d82CC5967069d6d9C17F2719f67728F5B" ,
259
+ contractStartBlock : 6635587 ,
260
+ etherscanURL : "https://rootstock.blockscout.com/" ,
261
+ rpcProvider : `https://rpc.mainnet.rootstock.io/${ process . env . ROOTSTOCK_API_KEY } ` ,
262
+ } ,
227
263
] ;
228
264
229
265
const activeChainConfig = EAS_CHAIN_CONFIGS . find (
@@ -300,6 +336,13 @@ export async function getFormattedAttestationFromLog(
300
336
let tries = 1 ;
301
337
302
338
do {
339
+ if ( tries > MAX_RETRIES ) {
340
+ console . log (
341
+ `Max retries reached for log ${ log . transactionHash } . Skipping...`
342
+ ) ;
343
+ return null ; // Exit the loop and return null after max retries
344
+ }
345
+
303
346
[
304
347
UID ,
305
348
schemaUID ,
@@ -369,6 +412,13 @@ export async function getFormattedSchemaFromLog(
369
412
let tries = 1 ;
370
413
371
414
do {
415
+ if ( tries > MAX_RETRIES ) {
416
+ console . log (
417
+ `Max retries reached for schema log ${ log . transactionHash } . Skipping...`
418
+ ) ;
419
+ throw new Error ( "Max retries reached while fetching schema." ) ;
420
+ }
421
+
372
422
[ UID , resolver , revocable , schema ] = await schemaContract . getSchema (
373
423
log . topics [ 1 ]
374
424
) ;
@@ -471,6 +521,8 @@ export async function createAttestationsForLogs(logs: ethers.providers.Log[]) {
471
521
await prisma . attestation . create ( { data : attestation } ) ;
472
522
await processCreatedAttestation ( attestation ) ;
473
523
}
524
+ } else {
525
+ console . log ( "Skipped creating attestation due to max retries." ) ;
474
526
}
475
527
}
476
528
}
0 commit comments