Improve Governor (#2794)

Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
Francisco Giordano
2021-08-04 18:29:13 -03:00
committed by GitHub
parent f782943099
commit 4b152bd8ce
15 changed files with 211 additions and 129 deletions

View File

@ -215,6 +215,51 @@ contract('GovernorCompatibilityBravo', function (accounts) {
runGovernorWorkflow();
});
describe('cancel', function () {
beforeEach(async function () {
this.settings = {
proposal: [
[ this.receiver.address ], // targets
[ web3.utils.toWei('0') ], // values
[ this.receiver.contract.methods.mockFunction().encodeABI() ], // calldatas
'<proposal description>', // description
],
proposer,
tokenHolder: owner,
steps: {
wait: { enable: false },
queue: { enable: false },
execute: { enable: false },
},
};
});
describe('by proposer', function () {
afterEach(async function () {
await this.mock.cancel(this.id, { from: proposer });
});
runGovernorWorkflow();
});
describe('if proposer below threshold', function () {
afterEach(async function () {
await this.token.transfer(voter1, web3.utils.toWei('1'), { from: proposer });
await this.mock.cancel(this.id);
});
runGovernorWorkflow();
});
describe('not if proposer above threshold', function () {
afterEach(async function () {
await expectRevert(
this.mock.cancel(this.id),
'GovernorBravo: proposer above threshold',
);
});
runGovernorWorkflow();
});
});
describe('with compatibility interface', function () {
beforeEach(async function () {
this.settings = {