UNPKG

@vechain/vebetterdao-contracts

Version:

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

35 lines (34 loc) 1.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const config_1 = require("@repo/config"); const helpers_1 = require("../../../helpers"); const hardhat_1 = require("hardhat"); async function main() { if (!process.env.NEXT_PUBLIC_APP_ENV) { throw new Error("Missing NEXT_PUBLIC_APP_ENV"); } const config = (0, config_1.getConfig)(process.env.NEXT_PUBLIC_APP_ENV); const network = config.network.name; const env = config.environment; const deployer = (await hardhat_1.ethers.getSigners())[0]; console.log(`Upgrading XAllocationVoting contract at address: ${config.xAllocationVotingContractAddress} on network: ${network} (env: ${env}) with deployer: ${deployer.address}`); const xAllocationVotingV2 = (await (0, helpers_1.upgradeProxy)("XAllocationVotingV1", "XAllocationVotingV2", config.xAllocationVotingContractAddress, [config.veBetterPassportContractAddress], { version: 2, })); console.log(`XAllocationVoting upgraded`); // check that upgrade was successful const version = await xAllocationVotingV2.version(); console.log(`New XAllocationVoting version: ${version}`); if (parseInt(version) !== 2) { throw new Error(`XAllocationVoting version is not 2: ${version}`); } // check that the VeBetterPassport contract address is set const veBetterPassport = await xAllocationVotingV2.veBetterPassport(); if (veBetterPassport !== config.veBetterPassportContractAddress) { throw new Error(`VeBetterPassport contract address is not the expected one: ${veBetterPassport}`); } console.log("Execution completed"); process.exit(0); } // Execute the main function main();