From f8c4af1231e4cbdd85f09a0df0c97c7d6161954e Mon Sep 17 00:00:00 2001 From: Alex Lazar Date: Sun, 15 May 2022 18:53:27 +0300 Subject: [PATCH] fix: verification is enabled by default Verification is enabled by default, but it can be turned off and it is turned off in the CI. --- .github/workflows/ci.yml | 2 +- hardhat.config.ts | 47 +++++++++++++++++++++++++--------------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d79624a..a49c37a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,6 +62,6 @@ jobs: POLYGON_URL: ${{ secrets.POLYGON_URL }} - name: Deploy contract - run: yarn hardhat --network hardhat deployOffsetHelper + run: yarn hardhat --network hardhat deployOffsetHelper --verify false env: POLYGON_URL: ${{ secrets.POLYGON_URL }} diff --git a/hardhat.config.ts b/hardhat.config.ts index 6b7568a..61fbcc9 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -9,6 +9,7 @@ import "solidity-coverage"; import { tokens } from "./utils/tokens"; import addresses, { mumbaiAddresses } from "./utils/addresses"; import { network } from "hardhat"; +import { boolean } from "hardhat/internal/core/params/argumentTypes"; dotenv.config(); @@ -20,8 +21,14 @@ task("accounts", "Prints the list of accounts", async (taskArgs, hre) => { } }); -task("deployOffsetHelper", "Deploys and verifies OffsetHelper").setAction( - async (taskArgs, hre) => { +task("deployOffsetHelper", "Deploys and verifies OffsetHelper") + .addOptionalParam( + "verify", + "Set false to not verify the OffsetHelper after deployment", + true, + boolean + ) + .setAction(async (taskArgs, hre) => { const OffsetHelper = await hre.ethers.getContractFactory("OffsetHelper"); const addressesToUse = @@ -35,25 +42,29 @@ task("deployOffsetHelper", "Deploys and verifies OffsetHelper").setAction( addressesToUse.wmatic, ]); await oh.deployed(); - await oh.deployTransaction.wait(5); console.log(`OffsetHelper deployed on ${hre.network.name} to:`, oh.address); - await hre.run("verify:verify", { - address: oh.address, - constructorArguments: [ - tokens, - [ - addressesToUse.bct, - addressesToUse.nct, - addressesToUse.usdc, - addressesToUse.weth, - addressesToUse.wmatic, + if (taskArgs.verify === true) { + await oh.deployTransaction.wait(5); + await hre.run("verify:verify", { + address: oh.address, + constructorArguments: [ + tokens, + [ + addressesToUse.bct, + addressesToUse.nct, + addressesToUse.usdc, + addressesToUse.weth, + addressesToUse.wmatic, + ], ], - ], - }); - console.log(`OffsetHelper verified on ${hre.network.name} to:`, oh.address); - } -); + }); + console.log( + `OffsetHelper verified on ${hre.network.name} to:`, + oh.address + ); + } + }); const config: HardhatUserConfig = { defaultNetwork: "hardhat",