@dydxfoundation/governance
Version:
dYdX governance smart contracts
36 lines (35 loc) • 1.89 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const hardhat_1 = __importDefault(require("hardhat"));
const src_1 = require("../../src");
const types_1 = require("../../src/types");
const describe_contract_1 = require("../helpers/describe-contract");
const BLOCK_AFTER_GOVRNANCE_VOTES = 13679600;
let txBuilder;
function init(ctx) {
txBuilder = new src_1.TxBuilder({
network: src_1.Network.hardhat,
hardhatGovernanceAddresses: { DYDX_GOVERNANCE: ctx.governor.address },
injectedProvider: hardhat_1.default.ethers.provider,
});
}
(0, describe_contract_1.describeContract)('DydxGovernance', init, (ctx) => {
(0, describe_contract_1.describeContractForNetwork)('DydxGovernance', ctx, types_1.NetworkName.hardhat, true, () => {
it('getGovernanceVoters with large range and expected votes', async () => {
const voters = await txBuilder.dydxGovernanceService.getGovernanceVoters(src_1.DYDX_GOVERNOR_DEPLOYMENT_BLOCK);
(0, chai_1.expect)(voters.size).to.be.eq(790);
});
it('getGovernanceVoters with no range and no expected votes', async () => {
const emptyVoters = await txBuilder.dydxGovernanceService.getGovernanceVoters(src_1.DYDX_GOVERNOR_DEPLOYMENT_BLOCK, src_1.DYDX_GOVERNOR_DEPLOYMENT_BLOCK);
(0, chai_1.expect)(emptyVoters.size).to.be.eq(0);
});
it('getGovernanceVoters with range and no expected votes', async () => {
const emptyVoters = await txBuilder.dydxGovernanceService.getGovernanceVoters(src_1.DYDX_GOVERNOR_DEPLOYMENT_BLOCK, BLOCK_AFTER_GOVRNANCE_VOTES);
(0, chai_1.expect)(emptyVoters.size).to.be.eq(0);
});
});
});