Skip to content

Commit

Permalink
fix: verification is enabled by default
Browse files Browse the repository at this point in the history
Verification is enabled by default, but it can be turned off and it is turned off in the CI.
  • Loading branch information
mauricedesaxe committed May 16, 2022
1 parent ca53cff commit f8c4af1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
47 changes: 29 additions & 18 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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 =
Expand All @@ -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",
Expand Down

0 comments on commit f8c4af1

Please sign in to comment.