Skip to content

Commit

Permalink
Merge pull request #28 from lordshashank/main
Browse files Browse the repository at this point in the history
verify script separated
  • Loading branch information
xBalbinus authored Oct 11, 2024
2 parents 5198efb + bc34b62 commit 67b3be3
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 26 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"verify": "yarn workspace @fil-frame/hardhat etherscan-verify",
"hardhat-verify": "yarn workspace @fil-frame/hardhat verify",
"deploy": "yarn workspace @fil-frame/hardhat deploy",
"deploy:verify": "yarn workspace @fil-frame/hardhat deploy:verify",
"chain": "yarn workspace @fil-frame/hardhat chain",
"test": "yarn workspace @fil-frame/hardhat test",
"dev": "yarn workspace @fil-frame/nextjs dev",
Expand Down
1 change: 1 addition & 0 deletions packages/hardhat/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ cache_forge
# Hardhat files
/cache
/artifacts
/deployments

# TypeChain files
/typechain
Expand Down
39 changes: 22 additions & 17 deletions packages/hardhat/deploy/00_deploy_your_contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,30 @@ const deployYourContract: DeployFunction = async function (
);
console.log("👋 Initial greeting:", await yourContract.greeting());

// Timeout for 10 Seconds to wait for the contract to be indexed on explorer
console.log(
"⏳ Waiting for 10 seconds for the contract to be indexed on the explorer..."
);
await new Promise((resolve) => setTimeout(resolve, 10000));
// Check if the --verify flag is present
const shouldVerify = process.env.VERIFY === "true";

if (shouldVerify) {
// Timeout for 10 Seconds to wait for the contract to be indexed on explorer
console.log(
"⏳ Waiting for 10 seconds for the contract to be indexed on the explorer..."
);
await new Promise((resolve) => setTimeout(resolve, 10000));

console.log("🕵️‍♂️ Verifying the contract on the explorer...");
console.log("🕵️‍♂️ Verifying the contract on the explorer...");

const filecoinNetworks = ["calibration", "filecoin"];
if (filecoinNetworks.includes(hre.network.name)) {
// Verify the contract on the filfox explorer
await hre.run("verifyContract", {
contractName: "YourContract",
});
} else {
await hre.run("verify:verify", {
address: YourContractAddress,
constructorArguments: [deployer],
});
const filecoinNetworks = ["calibration", "filecoin"];
if (filecoinNetworks.includes(hre.network.name)) {
// Verify the contract on the filfox explorer
await hre.run("verifyContract", {
contractName: "YourContract",
});
} else {
await hre.run("verify:verify", {
address: YourContractAddress,
constructorArguments: [deployer],
});
}
}
};

Expand Down
18 changes: 9 additions & 9 deletions packages/hardhat/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { HardhatUserConfig } from "hardhat/config";
import { config as dotenvConfig } from "dotenv";
import "@nomicfoundation/hardhat-foundry";
import "@nomicfoundation/hardhat-ethers";
import "./tasks/verifyContract";
import "@nomicfoundation/hardhat-chai-matchers";
import "@typechain/hardhat";
import "hardhat-gas-reporter";
import "solidity-coverage";
import "@nomicfoundation/hardhat-ethers";
import "@nomicfoundation/hardhat-foundry";
import "@nomicfoundation/hardhat-verify";
import "@typechain/hardhat";
import { config as dotenvConfig } from "dotenv";
import "hardhat-deploy";
import "hardhat-deploy-ethers";
import "./tasks/verifyContract";
import "hardhat-gas-reporter";
import { HardhatUserConfig } from "hardhat/config";
import "solidity-coverage";

dotenvConfig();
const providerApiKey =
Expand Down Expand Up @@ -85,4 +85,4 @@ const config: HardhatUserConfig = {
},
};

export default config;
export default config;
1 change: 1 addition & 0 deletions packages/hardhat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"chain": "hardhat node --network hardhat",
"compile": "hardhat compile",
"deploy": "hardhat deploy",
"deploy:verify": "VERIFY=true hardhat deploy",
"fork": "MAINNET_FORKING_ENABLED=true hardhat node --network hardhat",
"generate": "hardhat run scripts/generateAccount.ts",
"flatten": "hardhat flatten",
Expand Down

0 comments on commit 67b3be3

Please sign in to comment.