UNPKG

@vechain/vebetterdao-contracts

Version:

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

42 lines (41 loc) 2.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const config_1 = require("@repo/config"); const helpers_1 = require("../../../helpers"); const xAllocationVotingLibraries_1 = require("../../../libraries/xAllocationVotingLibraries"); 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); console.log("Deploying XAllocationVoting V10 libraries..."); const xAllocLibs = await (0, xAllocationVotingLibraries_1.xAllocationVotingLibraries)(true); const libraryAddresses = { AutoVotingLogic: await xAllocLibs.AutoVotingLogic.getAddress(), ExternalContractsUtils: await xAllocLibs.ExternalContractsUtils.getAddress(), VotingSettingsUtils: await xAllocLibs.VotingSettingsUtils.getAddress(), VotesUtils: await xAllocLibs.VotesUtils.getAddress(), VotesQuorumFractionUtils: await xAllocLibs.VotesQuorumFractionUtils.getAddress(), RoundEarningsSettingsUtils: await xAllocLibs.RoundEarningsSettingsUtils.getAddress(), RoundFinalizationUtils: await xAllocLibs.RoundFinalizationUtils.getAddress(), RoundsStorageUtils: await xAllocLibs.RoundsStorageUtils.getAddress(), RoundVotesCountingUtils: await xAllocLibs.RoundVotesCountingUtils.getAddress(), }; console.log("Libraries deployed:", libraryAddresses); console.log(`Upgrading XAllocationVoting contract at address: ${config.xAllocationVotingContractAddress} on network: ${config.network.name}`); // V10: Fix relayer vote double-processing (no reinitializer needed) const xAllocationVoting = (await (0, helpers_1.upgradeProxy)("XAllocationVotingV9", "XAllocationVoting", config.xAllocationVotingContractAddress, [], { version: 10, libraries: libraryAddresses, })); console.log(`XAllocationVoting upgraded`); const version = await xAllocationVoting.version(); console.log(`New XAllocationVoting version: ${version}`); if (parseInt(version) !== 10) { throw new Error(`XAllocationVoting version is not the expected one: ${version}`); } await (0, helpers_1.saveLibrariesToFile)({ XAllocationVoting: libraryAddresses }); console.log("Execution completed"); process.exit(0); } main();