All checks were successful
CI / lint-and-test (push) Successful in 9m52s
Co-authored-by: Cursor <cursoragent@cursor.com>
60 lines
1.8 KiB
TypeScript
60 lines
1.8 KiB
TypeScript
import { run, network } from "hardhat";
|
|
import * as fs from "fs";
|
|
import * as path from "path";
|
|
|
|
async function main() {
|
|
const deployPath = path.join(__dirname, "../deployments/chain138.json");
|
|
if (!fs.existsSync(deployPath)) {
|
|
throw new Error("Missing deployments/chain138.json — run pnpm run deploy:chain138 first");
|
|
}
|
|
|
|
const deployment = JSON.parse(fs.readFileSync(deployPath, "utf8")) as {
|
|
deployer: string;
|
|
contracts: { SubAccountFactory: string; TreasuryWallet: string };
|
|
};
|
|
|
|
if (network.name !== "chain138") {
|
|
console.log("Using network:", network.name);
|
|
}
|
|
|
|
console.log("Verifying SubAccountFactory:", deployment.contracts.SubAccountFactory);
|
|
try {
|
|
await run("verify:verify", {
|
|
address: deployment.contracts.SubAccountFactory,
|
|
constructorArguments: [],
|
|
});
|
|
console.log("SubAccountFactory verified");
|
|
} catch (e: unknown) {
|
|
const msg = e instanceof Error ? e.message : String(e);
|
|
if (msg.includes("Already Verified") || msg.includes("already verified")) {
|
|
console.log("SubAccountFactory already verified");
|
|
} else {
|
|
console.warn("SubAccountFactory verify:", msg);
|
|
}
|
|
}
|
|
|
|
const owners = [deployment.deployer];
|
|
const threshold = 1;
|
|
|
|
console.log("Verifying TreasuryWallet:", deployment.contracts.TreasuryWallet);
|
|
try {
|
|
await run("verify:verify", {
|
|
address: deployment.contracts.TreasuryWallet,
|
|
constructorArguments: [owners, threshold],
|
|
});
|
|
console.log("TreasuryWallet verified");
|
|
} catch (e: unknown) {
|
|
const msg = e instanceof Error ? e.message : String(e);
|
|
if (msg.includes("Already Verified") || msg.includes("already verified")) {
|
|
console.log("TreasuryWallet already verified");
|
|
} else {
|
|
console.warn("TreasuryWallet verify:", msg);
|
|
}
|
|
}
|
|
}
|
|
|
|
main().catch((error) => {
|
|
console.error(error);
|
|
process.exit(1);
|
|
});
|