Hello I'm using the Hardhat plugin for contract verification.
Is there a way to set the network for verification in the verify:verify substack?
I am trying to run verification through a script and I need to set the network outside of the cli.
Please see my verify:verify function:
async function verifyArtifacts(contractName: string, contractAddress: string, constructorArgs: any[]) {
console.log(`${contractName}: ${contractAddress}`)
console.log(SUBSECTION_SEPARATOR);
await hre.run("verify:verify", {
address: contractAddress,
constructorArguments: constructorArgs,
});
console.log(`${contractName}: ${contractAddress}`, "has been verified.")
console.log(SECTION_SEPARATOR);
}
I am trying to verify my contracts on the ropsten
network.
In hardhat.config.ts
I have set my api key this way:
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
}
and have ropsten in networks:
networks: {
mainnet: createMainnetConfig(),
hardhat: createHardhatConfig(),
goerli: createTestnetConfig("goerli"),
kovan: createTestnetConfig("kovan"),
rinkeby: createTestnetConfig("rinkeby"),
ropsten: createTestnetConfig("ropsten"),
localhost: {
accounts: {
mnemonic,
},
chainId: chainIds.hardhat,
gasMultiplier: 10,
},
},
const url = `https://eth-${network}.alchemyapi.io/v2/${alchemyApiKey}`;
return {
accounts: {
count: 10,
initialIndex: 0,
mnemonic,
path: "m/44'/60'/0'/0", // HD derivation path
},
chainId: chainIds[network],
url,
gas: 500000
};
}
Thank you for any insight!