Closed ivanzhelyazkov closed 6 months ago
I disagree with the solution:
The env variable should have higher properties than config
Okay, but it overrides different network api keys.
Consider a setup where you have an ETHERSCAN_API_KEY
env and BASESCAN_API_KEY
env - you've set the basescan api key to be read in the network as per the documentation, but the etherscan api key overrides it, failing the verification and potentially causing hours of debugging.
This way a multi-network deployment setup has to be configured specifically with mainnet api key env name different than ETHERSCAN_API_KEY
, otherwise it won't work.
BASESCAN_API_KEY
is not read by hardhat-deploy
The way I handle etherscan api keys across multiple network is to have a env loader that use .env.<network-name>
files and set ETHERSCAN_API_KEY
for each network this way
You can also use your own env var setup and use the hardhat.config to use them per network
Ah I see, thanks for the clarification. Are there docs for this ?
No unfortunately, there is no doc for this yet.
Maybe I can add this to the readme instead ?
PR implemented: https://github.com/wighawag/hardhat-deploy/pull/504 Closing this
Fix etherscan api key evaluation order - based on #502