UNPKG

@vechain/vebetterdao-contracts

Version:

Open-source repository that houses the smart contracts powering the decentralized VeBetterDAO on the VeChain Thor blockchain.

58 lines (57 loc) 3.1 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const hardhat_1 = require("hardhat"); const setup_1 = require("../deploy/setup"); const local_1 = __importDefault(require("@repo/config/local")); async function main() { console.log("================ Setting up local environment from deployed contracts"); console.log("Using local config:", local_1.default.environment); // Get the deployer account const [deployer] = await hardhat_1.ethers.getSigners(); console.log("Using deployer account:", deployer.address); try { // Connect to all deployed contracts using addresses from local config console.log("Connecting to deployed contracts..."); const emissions = (await hardhat_1.ethers.getContractAt("Emissions", local_1.default.emissionsContractAddress)); const treasury = (await hardhat_1.ethers.getContractAt("Treasury", local_1.default.treasuryContractAddress)); const x2EarnApps = (await hardhat_1.ethers.getContractAt("X2EarnApps", local_1.default.x2EarnAppsContractAddress)); const governor = (await hardhat_1.ethers.getContractAt("B3TRGovernor", local_1.default.b3trGovernorAddress)); const xAllocationVoting = (await hardhat_1.ethers.getContractAt("XAllocationVoting", local_1.default.xAllocationVotingContractAddress)); const b3tr = (await hardhat_1.ethers.getContractAt("B3TR", local_1.default.b3trContractAddress)); const vot3 = (await hardhat_1.ethers.getContractAt("VOT3", local_1.default.vot3ContractAddress)); // For nodeManagement, we use the address from the config const stargateMock = (await hardhat_1.ethers.getContractAt("Stargate", local_1.default.stargateContractAddress)); console.log("All contracts connected successfully!"); // Verify contracts are accessible console.log("Verifying contract connections..."); console.log("- B3TR name:", await b3tr.name()); console.log("- VOT3 name:", await vot3.name()); console.log("- Emissions address:", await emissions.getAddress()); console.log("- Treasury address:", await treasury.getAddress()); // Call setupEnvironment with local config console.log("================ Calling setupEnvironment..."); await (0, setup_1.setupEnvironment)("local", // EnvConfig type expects string literal emissions, treasury, x2EarnApps, governor, xAllocationVoting, b3tr, vot3, stargateMock); console.log("================ Setup completed successfully!"); } catch (error) { console.error("Error during setup:", error); process.exit(1); } } // Handle script execution if (require.main === module) { main() .then(() => { console.log("Script completed successfully"); process.exit(0); }) .catch(error => { console.error("Script failed:", error); process.exit(1); }); } exports.default = main;