Skip to content

Move etherscan API keys to each network's config file #534

@julien51

Description

@julien51

Right now we do a bit of magic in the verify task:

  const network = networks[chainId.toString()]

  let etherscanNetworkName
  switch (Number(chainId)) {
    case 1:
      etherscanNetworkName = 'mainnet'
      break
    case 42161:
      etherscanNetworkName = 'arbitrum'
      break
    default:
      etherscanNetworkName = network.name.toLowerCase()
  }
  if (!config.etherscan.apiKey[etherscanNetworkName]) {
    console.error(
      `No Etherscan API key found for '${etherscanNetworkName}'. Please add one to hardhat.config.ts`
    )
    return
  }

and we have to configure etherscan keys in the hardhat config. It would be much better to do that as an etherscan key in each network's config file like this:

etherscan: {
  apiKey: '',
  customChains: {
     //..
  }
}

(of course we would only use customChains if needed.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions