-
Notifications
You must be signed in to change notification settings - Fork 46
/
deploy.ts
40 lines (31 loc) · 1.09 KB
/
deploy.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import hre from "hardhat";
// Colour codes for terminal prints
const RESET = "\x1b[0m";
const GREEN = "\x1b[32m";
function delay(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function main() {
const constructorArgs = ["Hello, Hardhat!"];
const contract = await hre.ethers.deployContract("Greeter", constructorArgs);
await contract.waitForDeployment();
const contractAddress = await contract.getAddress();
console.log("Greeter deployed to: " + `${GREEN}${contractAddress}${RESET}\n`);
console.log(
"Waiting 30 seconds before beginning the contract verification to allow the block explorer to index the contract...\n",
);
await delay(30000); // Wait for 30 seconds before verifying the contract
await hre.run("verify:verify", {
address: contractAddress,
constructorArguments: constructorArgs,
});
// Uncomment if you want to enable the `tenderly` extension
// await hre.tenderly.verify({
// name: "Greeter",
// address: contractAddress,
// });
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});