TestRegisterProposal.t.sol
1 pragma solidity >=0.6.0; 2 3 import "truffle/Assert.sol"; 4 import "./Base.t.sol"; 5 6 contract TestRegisterProposal is Base { 7 8 function testRegisterProposalMeetingMinimumShares() public { 9 10 Proposal p = new ChangeInterestRateProposal(); 11 12 Assert.isFalse( 13 manager.isRegisteredProposal(address(p)), "proposal not registered" 14 ); 15 16 (,ProposalWrapper w) = alpha.registerProposal(p, SIMPLE_MAJORITY, now + 10 days); 17 18 Assert.isTrue( 19 manager.isRegisteredProposal(address(p)), "proposal registered" 20 ); 21 22 Assert.isTrue(w.getId() > 0, "p ID"); 23 Assert.isTrue(w.getStatus() == ProposalWrapper.Status.OPEN, "p OPEN"); 24 } 25 26 function testRegisterProposalWithoutMinimumShares() public { 27 28 Proposal p = new ChangeInterestRateProposal(); 29 30 alpha.transfer(address(beta), govToken.balanceOf(address(alpha)) - 5 finney); // 0.5% left 31 32 (bool success,) = address(alpha).call( 33 abi.encodePacked( 34 alpha.registerProposal.selector, 35 abi.encode(p, SIMPLE_MAJORITY, now + 10 days) 36 ) 37 ); 38 39 Assert.isFalse(success, "registerProposal should fail"); 40 } 41 }