npm buidler

buidler-etherscan

Buidler plugin for integration with Etherscan's contract verification service.

What

This plugin verifies your contracts on Etherscan.

Installation

npm install --save-dev @nomiclabs/buidler-etherscan

And add the following statement to your buidler.config.js:

usePlugin("@nomiclabs/buidler-etherscan");

Tasks

This plugin provides the verify-contract task, which allows you to verify contracts through Etherscan's service.

Environment extensions

This plugin does not extend the environment.

Usage

You need to add the following Etherscan config to your buidler.config.js file:

module.exports = {
  etherscan: {
    // The url for the Etherscan API you want to use.
    // For example, here we're using the one for the Ropsten test network
    url: "https://api-ropsten.etherscan.io/api",
    // Your API key for Etherscan
    // Obtain one at https://etherscan.io/
    apiKey: "YOUR_ETHERSCAN_API_KEY"
  }
};

Lastly, run the verify-contract task like so:

npx buidler verify-contract --contract-name MyContract --address DEPLOYED_CONTRACT_ADDRESS "Constructor argument 1"

TypeScript support

You need to add this to your tsconfig.json's files array: "node_modules/@nomiclabs/buidler-etherscan/src/type-extensions.d.ts"