@vechain/vebetterdao-contracts
Version:
Open-source repository that houses the smart contracts powering the decentralized VeBetterDAO on the VeChain Thor blockchain.
80 lines (79 loc) • 3.45 kB
JavaScript
;
// Wrapper script for mainnet verification that handles argument order correctly
// Usage: ts-node verify-mainnet.ts <contract-address> [contract-name] [--partial-match]
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const child_process_1 = require("child_process");
const path = __importStar(require("path"));
const args = process.argv.slice(2);
if (args.length < 1) {
console.error("Usage from root: yarn contracts:verify:{network} <contract-address> [contract-name] [--partial-match]");
console.error("Example: yarn contracts:verify:mainnet 0x123... StargateDelegation");
console.error("");
console.error("Options:");
console.error(" --partial-match Use 'match' verification instead of 'exact_match' (Sourcify v2 terminology)");
console.error("");
console.error("Match Types (Sourcify v2):");
console.error(" exact_match Full bytecode verification (default)");
console.error(" match Metadata-only verification (with --partial-match flag)");
process.exit(1);
}
const contractAddress = args[0];
const contractName = args[1] || "";
const additionalFlags = args.slice(2).join(" ");
const network = process.env.VITE_APP_ENV;
// Build the command with correct argument order: <address> <network> <contract-name> <flags>
const verifyScriptPath = path.join(__dirname, "verify-contract.ts");
const command = `ts-node "${verifyScriptPath}" "${contractAddress}" ${network} ${contractName} ${additionalFlags}`.trim();
console.log(`🚀 Verifying contract on ${network} using Sourcify v2 API...`);
console.log(`📋 Contract Address: ${contractAddress}`);
if (contractName) {
console.log(`📄 Contract Name: ${contractName}`);
}
if (additionalFlags.includes("--partial-match")) {
console.log(`🔧 Match Type: match (metadata-only)`);
}
else {
console.log(`🔧 Match Type: exact_match (full bytecode)`);
}
console.log(`\nExecuting: ${command}`);
console.log("");
try {
(0, child_process_1.execSync)(command, { stdio: "inherit" });
}
catch (error) {
process.exit(1);
}