diff --git a/contracts/hardhat.config.ts b/contracts/hardhat.config.ts index 0a30c06b2..e9fcb6931 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -59,7 +59,7 @@ export default { 'https://sepolia-rollup.arbitrum.io/rpc', accounts, }, - optimisticEthereum: { + optimism: { url: process.env.JSONRPC_HTTP_URL || 'https://mainnet.optimism.io', accounts, }, diff --git a/contracts/tasks/runners/exportRound.ts b/contracts/tasks/runners/exportRound.ts index 4eadf9818..da14269c1 100644 --- a/contracts/tasks/runners/exportRound.ts +++ b/contracts/tasks/runners/exportRound.ts @@ -29,6 +29,11 @@ type RoundListEntry = { isFinalized: boolean } +// Map hardhat network name to the etherscan api network name in the hardhat.config +const ETHERSCAN_NETWORKS: Record = { + optimism: 'optimisticEthereum', +} + const toUndefined = () => undefined const toString = (val: bigint) => BigInt(val).toString() const toZero = () => BigInt(0) @@ -41,13 +46,18 @@ function roundListFileName(directory: string): string { return path.join(directory, 'rounds.json') } +function toEtherscanNetworkName(network: string): string { + return ETHERSCAN_NETWORKS[network] ?? network +} + function getEtherscanApiKey(config: any, network: string): string { let etherscanApiKey = '' if (config.etherscan?.apiKey) { if (typeof config.etherscan.apiKey === 'string') { etherscanApiKey = config.etherscan.apiKey } else { - etherscanApiKey = config.etherscan.apiKey[network] + const etherscanNetwork = toEtherscanNetworkName(network) + etherscanApiKey = config.etherscan.apiKey[etherscanNetwork] } } diff --git a/contracts/utils/providers/EtherscanProvider.ts b/contracts/utils/providers/EtherscanProvider.ts index efa0cadb0..5a35ac557 100644 --- a/contracts/utils/providers/EtherscanProvider.ts +++ b/contracts/utils/providers/EtherscanProvider.ts @@ -6,7 +6,7 @@ const EtherscanApiUrl: Record = { arbitrum: 'https://api.arbiscan.io', 'arbitrum-goerli': 'https://api-goerli.arbiscan.io', 'arbitrum-sepolia': 'https://api-sepolia.arbiscan.io', - optimisticEthereum: 'https://api-optimistic.etherscan.io', + optimism: 'https://api-optimistic.etherscan.io', 'optimism-sepolia': 'https://api-sepolia-optimistic.etherscan.io', }