diff --git a/bun.lockb b/bun.lockb index 96dcbed..bb57383 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 86c4352..c966ef1 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ }, "files": ["out/index.mjs"], "devDependencies": { + "@bgd-labs/rpc-env": "^2.3.1", "@biomejs/biome": "1.9.4", "@types/chalk": "^2.2.0", "bun-types": "1.1.36", @@ -38,7 +39,5 @@ "lint": "bunx @biomejs/biome check .", "test": "vitest" }, - "dependencies": { - "@bgd-labs/rpc-env": "^2.0.1" - } + "dependencies": {} } diff --git a/src/explorers/etherscan.json b/src/explorers/etherscan.json index eac4a2b..4c00667 100644 --- a/src/explorers/etherscan.json +++ b/src/explorers/etherscan.json @@ -1,257 +1,307 @@ [ { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=1", "explorer": "https://etherscan.io", "chainId": 1 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=11155111", "explorer": "https://sepolia.etherscan.io", "chainId": 11155111 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=17000", "explorer": "https://sepolia.etherscan.io", "chainId": 17000 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=56", "explorer": "https://bscscan.com", "chainId": 56 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=97", "explorer": "https://testnet.bscscan.com", "chainId": 97 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=137", "explorer": "https://polygonscan.com", "chainId": 137 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=80002", "explorer": "https://amoy.polygonscan.com/", "chainId": 80002 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=1101", "explorer": "https://zkevm.polygonscan.com/", "chainId": 1101 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=2442", "explorer": "https://cardona-zkevm.polygonscan.com/", "chainId": 2442 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=8453", "explorer": "https://basescan.org", "chainId": 8453 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=84532", "explorer": "https://sepolia.basescan.org/", "chainId": 84532 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=42161", "explorer": "https://arbiscan.io", "chainId": 42161 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=42170", "explorer": "https://nova.arbiscan.io/", "chainId": 42170 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=421614", "explorer": "https://sepolia.arbiscan.io/", "chainId": 421614 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=59144", "explorer": "https://lineascan.build/", "chainId": 59144 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=59141", "explorer": "https://sepolia.lineascan.build/", "chainId": 59141 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=250", "explorer": "https://ftmscan.com", "chainId": 250 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=4002", "explorer": "https://testnet.ftmscan.com/", "chainId": 4002 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=81457", "explorer": "https://blastscan.io/", "chainId": 81457 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=168587773", "explorer": "https://sepolia.blastscan.io/", "chainId": 168587773 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=10", "explorer": "https://optimistic.etherscan.io/", "chainId": 10 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=11155420", "explorer": "https://sepolia-optimism.etherscan.io/", "chainId": 11155420 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=43114", "explorer": "https://snowscan.xyz/", "chainId": 43114 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=43113", "explorer": "https://testnet.snowscan.xyz/", "chainId": 43113 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=199", "explorer": "https://bttcscan.com/", "chainId": 199 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=1028", "explorer": "https://testnet.bttcscan.com/", "chainId": 1028 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=42220", "explorer": "https://celoscan.io", "chainId": 42220 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=44787", "explorer": "https://alfajores.celoscan.io/", "chainId": 44787 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=25", "explorer": "https://cronoscan.com", "chainId": 25 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=252", "explorer": "https://fraxscan.com/", "chainId": 252 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=2522", "explorer": "https://holesky.fraxscan.com/", "chainId": 2522 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=100", "explorer": "https://gnosisscan.io/", "chainId": 100 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=255", "explorer": "https://kromascan.com/", "chainId": 255 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=2358", "explorer": "https://sepolia.kromascan.com/", "chainId": 2358 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=5000", "explorer": "https://mantlescan.xyz/", "chainId": 5000 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=5003", "explorer": "https://sepolia.mantlescan.xyz/", "chainId": 5003 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=1284", "explorer": "https://moonbeam.moonscan.io/", "chainId": 1284 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=1285", "explorer": "https://moonriver.moonscan.io/", "chainId": 1285 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=1287", "explorer": "https://moonbase.moonscan.io/", "chainId": 1287 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=204", "explorer": "https://opbnb.bscscan.com/", "chainId": 204 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=5611", "explorer": "https://opbnb-testnet.bscscan.com/", "chainId": 5611 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=534352", "explorer": "https://scrollscan.com/", "chainId": 534352 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=534351", "explorer": "https://sepolia.scrollscan.com/", "chainId": 534351 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=167000", "explorer": "https://taikoscan.io/", "chainId": 167000 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=167009", "explorer": "https://hekla.taikoscan.io/", "chainId": 167009 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=1111", "explorer": "https://wemixscan.com/", "chainId": 1111 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=1112", "explorer": "https://testnet.wemixscan.com/", "chainId": 1112 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=324", "explorer": "https://era.zksync.network/", "chainId": 324 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=300", "explorer": "https://sepolia-era.zksync.network/", "chainId": 300 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=660279", "explorer": "https://xaiscan.io/", "chainId": 660279 }, { - "api": "https://api.etherscan.io/v2/api", + "api": "https://api.etherscan.io/v2/api?chainid=37714555429", "explorer": "https://sepolia.xaiscan.io/", "chainId": 37714555429 + }, + { + "api": "https://api.etherscan.io/v2/api?chainid=50", + "explorer": "https://xdcscan.com/", + "chainId": 50 + }, + { + "api": "https://api.etherscan.io/v2/api?chainid=51", + "explorer": "https://testnet.xdcscan.com/", + "chainId": 51 + }, + { + "api": "https://api.etherscan.io/v2/api?chainid=33139", + "explorer": "https://apescan.io/", + "chainId": 33139 + }, + { + "api": "https://api.etherscan.io/v2/api?chainid=33111", + "explorer": "https://curtis.apescan.io/", + "chainId": 33111 + }, + { + "api": "https://api.etherscan.io/v2/api?chainid=480", + "explorer": "https://worldscan.org/", + "chainId": 480 + }, + { + "api": "https://api.etherscan.io/v2/api?chainid=4801", + "explorer": "https://sepolia.worldscan.org/", + "chainId": 4801 + }, + { + "api": "https://api.etherscan.io/v2/api?chainid=50104", + "explorer": "https://sophscan.xyz/", + "chainId": 50104 + }, + { + "api": "https://api.etherscan.io/v2/api?chainid=531050104", + "explorer": "https://testnet.sophscan.xyz/", + "chainId": 531050104 + }, + { + "api": "https://api.etherscan.io/v2/api?chainid=146", + "explorer": "https://sonicscan.org/", + "chainId": 146 + }, + { + "api": "https://api.etherscan.io/v2/api?chainid=57054", + "explorer": "https://testnet.sonicscan.org/", + "chainId": 57054 } ] diff --git a/src/explorers/routescan.json b/src/explorers/routescan.json index 761d722..aa8abaa 100644 --- a/src/explorers/routescan.json +++ b/src/explorers/routescan.json @@ -169,11 +169,6 @@ "explorer": "88888.routescan.io", "chainId": 88888 }, - { - "api": "https://api.routescan.io/v2/network/mainnet/evm/424/etherscan", - "explorer": "424.routescan.io", - "chainId": 424 - }, { "api": "https://api.routescan.io/v2/network/mainnet/evm/7777777/etherscan", "explorer": "7777777.routescan.io", @@ -334,6 +329,31 @@ "explorer": "255.routescan.io", "chainId": 255 }, + { + "api": "https://api.routescan.io/v2/network/mainnet/evm/21000000/etherscan", + "explorer": "21000000.routescan.io", + "chainId": 21000000 + }, + { + "api": "https://api.routescan.io/v2/network/mainnet/evm/1135/etherscan", + "explorer": "1135.routescan.io", + "chainId": 1135 + }, + { + "api": "https://api.routescan.io/v2/network/mainnet/evm/42161/etherscan", + "explorer": "42161.routescan.io", + "chainId": 42161 + }, + { + "api": "https://api.routescan.io/v2/network/mainnet/evm/146/etherscan", + "explorer": "146.routescan.io", + "chainId": 146 + }, + { + "api": "https://api.routescan.io/v2/network/mainnet/evm/80094/etherscan", + "explorer": "80094.routescan.io", + "chainId": 80094 + }, { "api": "https://api.routescan.io/v2/network/testnet/evm/43113/etherscan", "explorer": "43113.routescan.io", @@ -349,11 +369,6 @@ "explorer": "335.routescan.io", "chainId": 335 }, - { - "api": "https://api.routescan.io/v2/network/testnet/evm/9270/etherscan", - "explorer": "9270.routescan.io", - "chainId": 9270 - }, { "api": "https://api.routescan.io/v2/network/testnet/evm/3012/etherscan", "explorer": "3012.routescan.io", @@ -399,11 +414,6 @@ "explorer": "686669576.routescan.io", "chainId": 686669576 }, - { - "api": "https://api.routescan.io/v2/network/testnet/evm/431234/etherscan", - "explorer": "431234.routescan.io", - "chainId": 431234 - }, { "api": "https://api.routescan.io/v2/network/testnet/evm/31335/etherscan", "explorer": "31335.routescan.io", @@ -574,11 +584,6 @@ "explorer": "7222.routescan.io", "chainId": 7222 }, - { - "api": "https://api.routescan.io/v2/network/testnet/evm/7589/etherscan", - "explorer": "7589.routescan.io", - "chainId": 7589 - }, { "api": "https://api.routescan.io/v2/network/testnet/evm/421614/etherscan", "explorer": "421614.routescan.io", @@ -599,11 +604,6 @@ "explorer": "8082.routescan.io", "chainId": 8082 }, - { - "api": "https://api.routescan.io/v2/network/testnet/evm/64165/etherscan", - "explorer": "64165.routescan.io", - "chainId": 64165 - }, { "api": "https://api.routescan.io/v2/network/testnet/evm/7210/etherscan", "explorer": "7210.routescan.io", @@ -664,6 +664,61 @@ "explorer": "3636.routescan.io", "chainId": 3636 }, + { + "api": "https://api.routescan.io/v2/network/testnet/evm/80000/etherscan", + "explorer": "80000.routescan.io", + "chainId": 80000 + }, + { + "api": "https://api.routescan.io/v2/network/testnet/evm/124832/etherscan", + "explorer": "124832.routescan.io", + "chainId": 124832 + }, + { + "api": "https://api.routescan.io/v2/network/testnet/evm/2037/etherscan", + "explorer": "2037.routescan.io", + "chainId": 2037 + }, + { + "api": "https://api.routescan.io/v2/network/testnet/evm/60118/etherscan", + "explorer": "60118.routescan.io", + "chainId": 60118 + }, + { + "api": "https://api.routescan.io/v2/network/testnet/evm/21000001/etherscan", + "explorer": "21000001.routescan.io", + "chainId": 21000001 + }, + { + "api": "https://api.routescan.io/v2/network/testnet/evm/78170/etherscan", + "explorer": "78170.routescan.io", + "chainId": 78170 + }, + { + "api": "https://api.routescan.io/v2/network/testnet/evm/53123/etherscan", + "explorer": "53123.routescan.io", + "chainId": 53123 + }, + { + "api": "https://api.routescan.io/v2/network/testnet/evm/57054/etherscan", + "explorer": "57054.routescan.io", + "chainId": 57054 + }, + { + "api": "https://api.routescan.io/v2/network/testnet/evm/11155931/etherscan", + "explorer": "11155931.routescan.io", + "chainId": 11155931 + }, + { + "api": "https://api.routescan.io/v2/network/testnet/evm/1398243/etherscan", + "explorer": "1398243.routescan.io", + "chainId": 1398243 + }, + { + "api": "https://api.routescan.io/v2/network/testnet/evm/48795/etherscan", + "explorer": "48795.routescan.io", + "chainId": 48795 + }, { "api": "https://api.routescan.io/v2/network/mainnet/evm/all/etherscan", "explorer": "all.routescan.io", @@ -734,6 +789,11 @@ "explorer": "all.routescan.io", "chainId": null }, + { + "api": "https://api.routescan.io/v2/network/testnet/evm/all/etherscan", + "explorer": "all.routescan.io", + "chainId": null + }, { "api": "https://api.routescan.io/v2/network/mainnet/evm/all/etherscan", "explorer": "all.routescan.io", @@ -749,6 +809,11 @@ "explorer": "all.routescan.io", "chainId": null }, + { + "api": "https://api.routescan.io/v2/network/mainnet/evm/all/etherscan", + "explorer": "all.routescan.io", + "chainId": null + }, { "api": "https://api.routescan.io/v2/network/testnet/evm/all/etherscan", "explorer": "all.routescan.io", diff --git a/src/index.ts b/src/index.ts index 54e1cf1..19ee61f 100755 --- a/src/index.ts +++ b/src/index.ts @@ -59,14 +59,16 @@ const main = async () => { console.log("\nAnalyzing deployment transactions...\n"); for (const tx of parsedRun.transactions) { const trace = await getTxInternalCalls(tx.hash, rpc); - for (const explorer of networkConfig) { - console.log(explorer); - try { - await callTraceVerifier(trace.result, artifacts, buildInfos, parsedRun.chain, explorer); - } catch (error) { - console.error("[Verification Error]", error); - } - } + await Promise.allSettled( + networkConfig.map(async (explorer) => { + console.log(explorer); + try { + await callTraceVerifier(trace.result, artifacts, buildInfos, parsedRun.chain, explorer); + } catch (error) { + console.error("[Verification Error]", error); + } + }), + ); } console.log("\n[catapulta-verify] Verification finished."); console.log( diff --git a/src/utils/calltrace-verifier.ts b/src/utils/calltrace-verifier.ts index 4d36847..95cefcf 100644 --- a/src/utils/calltrace-verifier.ts +++ b/src/utils/calltrace-verifier.ts @@ -1,5 +1,9 @@ import type { ExplorerConfig } from "../config"; -import { checkIfVerified, checkVerificationStatus, submitVerification } from "./api"; +import { + checkIfVerified, + checkVerificationStatus, + submitVerification, +} from "./api"; import { waitTillVisible } from "./explorer-api"; import { getSettingsByArtifact } from "./foundry-ffi"; import { delay, renderExplorerUrl } from "./misc"; @@ -24,12 +28,12 @@ export const callTraceVerifier = async ( await waitTillVisible(chainId, explorer, call.to); - const verified = await checkIfVerified(chainId, explorer, call.to); + // const verified = await checkIfVerified(chainId, explorer, call.to); - if (verified) { - console.log(`(${renderExplorerUrl(call.to, explorer)}) is already verified, skipping.`); - return; - } + // if (verified) { + // console.log(`(${renderExplorerUrl(call.to, explorer)}) is already verified, skipping.`); + // return; + // } // if the tx has subdeployments get the deployed bytecode from the last deployment in order to // compare the bytecode and deployed bytecode strings, resulting in the constructor params @@ -47,18 +51,31 @@ export const callTraceVerifier = async ( return; } - const { result: guid, message, status }: any = await submitVerification(chainId, explorer, verificationReq); + const { + result: guid, + message, + status, + }: any = await submitVerification(chainId, explorer, verificationReq); if (!status || guid.includes("Max rate limit reached")) { - console.log(`Couldn't verify ${renderExplorerUrl(call.to, explorer)} `, guid); + console.log( + `Couldn't verify ${renderExplorerUrl(call.to, explorer)} `, + guid, + ); return; } - console.log(`Verifying contract ${renderExplorerUrl(call.to, explorer)}, with guid: ${guid}`); + console.log( + `Verifying contract ${renderExplorerUrl(call.to, explorer)}, with guid: ${guid}`, + ); for (let i = 0; i < 30; i++) { await delay(1000); - const { status, message } = await checkVerificationStatus(chainId, explorer, guid); + const { status, message } = await checkVerificationStatus( + chainId, + explorer, + guid, + ); if (status !== 2) { console.log(message);