UNPKG

@vechain/vebetterdao-contracts

Version:

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

44 lines (43 loc) 2.97 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const local_1 = require("@repo/config/contracts/envs/local"); const chai_1 = require("chai"); const hardhat_1 = require("hardhat"); const mocha_1 = require("mocha"); const helpers_1 = require("../helpers"); (0, mocha_1.describe)("Governance - V9 Upgrade - @shard4g", function () { (0, mocha_1.it)("Should upgrade from V8 to V9 and preserve version", async () => { const config = (0, local_1.createLocalConfig)(); const { governor, governorClockLogicLib, governorConfiguratorLib, governorDepositLogicLib, governorFunctionRestrictionsLogicLib, governorProposalLogicLib, governorQuorumLogicLib, governorStateLogicLib, governorVotesLogicLib, } = await (0, helpers_1.getOrDeployContractInstances)({ forceDeploy: true, config }); const version = await governor.version(); (0, chai_1.expect)(version).to.equal("9"); const governorAddress = await governor.getAddress(); (0, chai_1.expect)(governorAddress).to.not.equal(hardhat_1.ethers.ZeroAddress); }); (0, mocha_1.it)("Should preserve governor configuration after V8 to V9 upgrade", async () => { const config = (0, local_1.createLocalConfig)(); const { governor, vot3, b3tr, voterRewards, xAllocationVoting } = await (0, helpers_1.getOrDeployContractInstances)({ forceDeploy: true, config, }); // Verify all external contracts are preserved (0, chai_1.expect)(await governor.token()).to.equal(await vot3.getAddress()); (0, chai_1.expect)(await governor.b3tr()).to.equal(await b3tr.getAddress()); (0, chai_1.expect)(await governor.voterRewards()).to.equal(await voterRewards.getAddress()); (0, chai_1.expect)(await governor.xAllocationVoting()).to.equal(await xAllocationVoting.getAddress()); // Verify version (0, chai_1.expect)(await governor.version()).to.equal("9"); }); (0, mocha_1.it)("Should preserve governance roles after V8 to V9 upgrade", async () => { const config = (0, local_1.createLocalConfig)(); const { governor, owner } = await (0, helpers_1.getOrDeployContractInstances)({ forceDeploy: true, config }); const DEFAULT_ADMIN_ROLE = await governor.DEFAULT_ADMIN_ROLE(); const GOVERNOR_FUNCTIONS_SETTINGS_ROLE = await governor.GOVERNOR_FUNCTIONS_SETTINGS_ROLE(); const PAUSER_ROLE = await governor.PAUSER_ROLE(); const PROPOSAL_STATE_MANAGER_ROLE = await governor.PROPOSAL_STATE_MANAGER_ROLE(); (0, chai_1.expect)(await governor.hasRole(DEFAULT_ADMIN_ROLE, owner.address)).to.be.true; (0, chai_1.expect)(await governor.hasRole(GOVERNOR_FUNCTIONS_SETTINGS_ROLE, owner.address)).to.be.true; (0, chai_1.expect)(await governor.hasRole(PAUSER_ROLE, owner.address)).to.be.true; (0, chai_1.expect)(await governor.hasRole(PROPOSAL_STATE_MANAGER_ROLE, owner.address)).to.be.true; }); });