From 8332c79dcfac5d216ad97db9e3d5d5590c561ede Mon Sep 17 00:00:00 2001 From: jummy123 Date: Thu, 20 Jan 2022 01:19:28 +0000 Subject: [PATCH] Add etherscan verification plugin and docs --- .env.example | 1 + README.md | 7 +++++++ hardhat.config.js | 4 ++++ package.json | 1 + 4 files changed, 13 insertions(+) diff --git a/.env.example b/.env.example index 22b905c1..bd28c068 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,3 @@ RINKEBY_PRIVATE_KEY= ALCHEMY_PROJECT_ID= +ETHERSCAN_API_KEY= diff --git a/README.md b/README.md index fd06ab09..6a1b3dec 100644 --- a/README.md +++ b/README.md @@ -78,3 +78,10 @@ The coverage report will then be found in `coverage/`. To deploy to the [rinkeby network](https://www.rinkeby.io/) you need to set appropriate environment variables. The file [.env.example](.env.example) contains examples of the variables you need to set. For convenience you can copy this file to a file name _.env_ and use a tool like [direnv](https://direnv.net/) to automatically load it. You could then deploy to rinkeby by using [hardhat-deploy](https://github.com/wighawag/hardhat-deploy) with this command `yarn hardhat deploy --network rinkeby`. + +### Verifying contracts + +To verify the contracts on rinkeby you will need an etherscan API key, see [.env.example](.env.example). To verify a contract on you will need the deployed contracts address, run +``` +yarn hardhat verify --network rinkeby "${contract_address}" +``` diff --git a/hardhat.config.js b/hardhat.config.js index 1081966a..3ee77080 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -1,4 +1,5 @@ require("@nomiclabs/hardhat-ethers"); +require("@nomiclabs/hardhat-etherscan"); require("@nomiclabs/hardhat-waffle"); require("@openzeppelin/hardhat-upgrades"); require("hardhat-abi-exporter"); @@ -37,4 +38,7 @@ module.exports = { deployer: 0, dev: 1, }, + etherscan: { + apiKey: process.env.ETHERSCAN_API_KEY + } }; diff --git a/package.json b/package.json index a6ac61b4..2f506cef 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "homepage": "https://github.com/traderjoe-xyz/rocker-joe/issues", "devDependencies": { "@nomiclabs/hardhat-ethers": "^2.0.0", + "@nomiclabs/hardhat-etherscan": "^3.0.0", "@nomiclabs/hardhat-waffle": "^2.0.0", "@openzeppelin/contracts": "^4.4.1", "@openzeppelin/contracts-upgradeable": "^4.4.1",