Skip to content

Instantly share code, notes, and snippets.

@kevinjanada
Created July 22, 2022 04:47
Show Gist options
  • Save kevinjanada/b464731b93553a729c728ffb7d925d52 to your computer and use it in GitHub Desktop.
Save kevinjanada/b464731b93553a729c728ffb7d925d52 to your computer and use it in GitHub Desktop.
hardhat-tasks-tutorial
// tasks/verify-etherscan.ts
import { task, types } from "hardhat/config";
task("verify-etherscan", "Verify deployed contract on Etherscan")
.addParam("contractAddress", "Contract address deployed", undefined, types.string)
.setAction(async ({ contractAddress }: { contractAddress: string }, hre) => {
try {
await hre.run("verify:verify", {
address: contractAddress,
contract: 'contracts/NFT.sol:NFT' // <path-to-contract>:<contract-name>
})
} catch ({ message }) {
console.error(message)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment