I just deployed a contract on Amoy and I am unable to verify it on polygonscan. Do you know if hardhat verify works for polygonscan?

Created by Kenil Shah, Modified on Thu, 22 Aug at 12:12 PM by Kenil Shah

To answer your question, Yes hardhat verify works for etherscan like a charm. All you need to do is set up your network and your etherscan API key under hardhat.config.ts folder for example:


const config: HardhatUserConfig = {

     solidity: {

          version: "your_solidity_version",

     },

     networks: {

          ethereum: {

               url: process.env.ETHEREUM_RPC_URL,

               gasPrice: "auto",

               account: process.env.YOUR_PRIVATE_KEY

          },

          amoy: {

               url: process.env.AMOY_RPC_URL,

               gasPrice: "auto",

               account: process.env.YOUR_PRIVATE_KEY

          }         

     },

     etherscan: {

          apiKey: process.env.EXPLORER_API_KEY

     }

}


once your setup is done all you need to do is run the command

 

> npx hardhat verify --network <network-name-in-hardhat-config> DEPLOYED_CONTRACT_ADDRESS "Constructor arguments"


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article