1
0

Remove second voter: proposer can vote for proposal himself

This commit is contained in:
Theo 2023-06-06 13:57:07 -07:00
parent 58828efa47
commit 0e2bdd6d00
2 changed files with 8 additions and 13 deletions

@ -12,9 +12,7 @@ contract Mock {
address public constant TEST_STAKER_ADDRESS = 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266; address public constant TEST_STAKER_ADDRESS = 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266;
uint256 public constant TEST_STAKER_PRIVATE_KEY = 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80; uint256 public constant TEST_STAKER_PRIVATE_KEY = 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80;
// Two test accounts to create proposal and vote for it // Test account to create proposal and vote for it
uint256 public constant TEST_PRIVATE_KEY_ONE = 0x66ddbd7cbe4a566df405f6ded0b908c669f88cdb1656380c050e3a457bd21df0;
uint256 public constant TEST_PRIVATE_KEY_TWO = 0xa4c8c98120e77741a87a116074a2df4ddb20d1149069290fd4a3d7ee65c55064;
address public constant TEST_ADDRESS_ONE = 0x118251976c65AFAf291f5255450ddb5b6A4d8B88; address public constant TEST_ADDRESS_ONE = 0x118251976c65AFAf291f5255450ddb5b6A4d8B88;
address public constant TEST_ADDRESS_TWO = 0x63aE7d90Eb37ca39FC62dD9991DbEfeE70673a20; uint256 public constant TEST_PRIVATE_KEY_ONE = 0x66ddbd7cbe4a566df405f6ded0b908c669f88cdb1656380c050e3a457bd21df0;
} }

@ -28,28 +28,25 @@ contract ProposalUtils is Utils {
} }
function proposeAndVote(address proposalAddress) public returns (uint256) { function proposeAndVote(address proposalAddress) public returns (uint256) {
retrieveAndLockBalance(TEST_PRIVATE_KEY_ONE, TEST_ADDRESS_ONE, PROPOSAL_QOURUM_THRESHOLD); retrieveAndLockBalance(TEST_PRIVATE_KEY_ONE, TEST_ADDRESS_ONE, PROPOSAL_QOURUM_THRESHOLD + 1 ether);
retrieveAndLockBalance(TEST_PRIVATE_KEY_TWO, TEST_ADDRESS_TWO, 1 ether);
/* ----------PROPOSER------------ */ /* ----------PROPOSE------------ */
vm.startPrank(TEST_ADDRESS_ONE); vm.startPrank(TEST_ADDRESS_ONE);
uint256 proposalId = governance.propose(proposalAddress, PROPOSAL_DESCRIPTION); uint256 proposalId = governance.propose(proposalAddress, PROPOSAL_DESCRIPTION);
/* ------------------------------ */
// TIME-TRAVEL // TIME-TRAVEL
vm.warp(block.timestamp + 6 hours); vm.warp(block.timestamp + 6 hours);
/* ------------VOTE-------------- */
governance.castVote(proposalId, true); governance.castVote(proposalId, true);
vm.stopPrank(); vm.stopPrank();
/* ------------------------------ */ /* ------------------------------ */
/* -------------VOTER-------------*/
vm.startPrank(TEST_ADDRESS_TWO);
governance.castVote(proposalId, true);
vm.stopPrank();
/* ------------------------------ */
return proposalId; return proposalId;
} }