-
Notifications
You must be signed in to change notification settings - Fork 2
/
utils.ts
29 lines (24 loc) · 845 Bytes
/
utils.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
import { writeFileSync } from "fs";
import { run } from "hardhat";
import { deployments } from "./config/deployments";
export const verify = async (contractAddress: string) => {
console.log("Verifying contract...");
try {
await run("verify:verify", {
address: contractAddress,
});
} catch (e) {
console.log(`Error while verifying: ${e}`);
}
};
export const delay = (ms: number) => new Promise((res) => setTimeout(res, ms));
export const addDeployment = (network: string, proxyAddress: string) => {
deployments[network] = proxyAddress;
// Convert the updated deployments object back to a string
const deploymentsContent = `export const deployments: Record<string, string> = ${JSON.stringify(
deployments,
null,
2
)};`;
writeFileSync("./config/deployments.ts", deploymentsContent, "utf-8");
};