Problem Mock & package.json

This commit is contained in:
2024-08-05 16:57:41 +08:00
parent 6e9c6dd633
commit 3ab5ee37c6
11 changed files with 128 additions and 1096 deletions
+20 -18
View File
@@ -1,26 +1,11 @@
// imports
const { ethers, run, network } = require("hardhat");
const { exit } = require("process");
// async main
async function main() {
const verifyOnly = false;
if (verifyOnly == true) {
const address = "0xF90F7edF515001CD4293255bfaF7D17ffa415e91";
const ETHERSCAN_API_KEY_VERIFY = process.env.ETHERSCAN_API_KEY;
console.log("Network config:", network.config);
console.log("ChainId: " + network.config.chainId);
if (network.config.chainId === 11155111) {
console.log("Currently on Sepolia Testnet");
if (ETHERSCAN_API_KEY_VERIFY !== undefined) {
console.log("Verifying contract...");
await verify(address, []);
console.log("Verification complete");
} else {
console.log("ETHERSCAN_API_KEY is undefined");
}
}
if (true) return;
if (false) {
await runVerifyOnly("0xF90F7edF515001CD4293255bfaF7D17ffa415e91");
}
const simpleStorageFactory =
@@ -85,6 +70,23 @@ async function verify(contractAddress, args) {
}
}
async function runVerifyOnly(address) {
const ETHERSCAN_API_KEY_VERIFY = process.env.ETHERSCAN_API_KEY;
console.log("Network config:", network.config);
console.log("ChainId: " + network.config.chainId);
if (network.config.chainId === 11155111) {
console.log("Currently on Sepolia Testnet");
if (ETHERSCAN_API_KEY_VERIFY !== undefined) {
console.log("Verifying contract...");
await verify(address, []);
console.log("Verification complete");
} else {
console.log("ETHERSCAN_API_KEY is undefined");
}
}
process.exit(1);
}
// main
main()
.then(() => process.getMaxListeners(0))