Skip to content

Commit

Permalink
chore: improve message format and deploy option
Browse files Browse the repository at this point in the history
  • Loading branch information
adnpark committed Feb 27, 2024
1 parent ba1f456 commit 1667710
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
29 changes: 18 additions & 11 deletions src/action/verifyContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,28 @@ export const verifyContracts = async (
await checkForgeAvailability()

const spinner = ora().start("Verifying contracts...")

const verificationPromises = chains.map((chain) =>
verifyContract(contractName, contractAddress, chain)
.then((message) => {
if (message.includes("is already verified")) {
ora().warn(message).start().stop()
} else {
ora().succeed(message).start().stop()
}
})
.catch((error) => {
ora()
.fail(
`Verification failed on ${chain.name}: ${error.message}`
)
.start()
.stop()
})
)

const results = await Promise.allSettled(verificationPromises)
results.forEach((result, index) => {
spinner.text = `Verifying contract ${contractName} on ${chains[index].name}`
if (result.status === "fulfilled") {
result.value.includes("is already verified")
? spinner.warn(result.value)
: spinner.succeed(result.value)
} else {
spinner.fail(`Verification failed! ${result.reason}`)
}
})
// Wait for all verifications to complete
await Promise.all(verificationPromises)

spinner.stop()
console.log("✅ All verifications process successfully finished!")
Expand Down
8 changes: 5 additions & 3 deletions src/command/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,13 @@ program
"-s, --salt <salt>",
"salt to be used for CREATE2. This can be a full 32-byte hex string or a shorter numeric representation that will be converted to a 32-byte hex string."
)
.option("-t, --testnet-all", "select all testnets", false)
.option("-t, --testnet-all", "select all testnets", true)
.option("-m, --mainnet-all", "select all mainnets", false)
.option("-a, --all-networks", "select all networks", false)
.option(
"-c, --chains [CHAINS]",
"list of chains for deploying contracts, with all selected by default",
"all"
"list of chains for deploying contracts, defaults to all testnets",
"testnet-all"
)
.option("-e, --expected-address [ADDRESS]", "expected address to confirm")
.option(
Expand All @@ -143,6 +144,7 @@ program
salt,
testnetAll,
mainnetAll,
allNetworks,
chains,
expectedAddress,
verifyContract
Expand Down

0 comments on commit 1667710

Please sign in to comment.