votes need to be above quorum

Signed-off-by: AlienTornadosaurusHex <>
This commit is contained in:
AlienTornadosaurusHex 2023-05-27 20:02:54 +00:00
parent c62f62aaee
commit d2e29c6ff9
2 changed files with 17 additions and 3 deletions

@ -1,5 +1,17 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
enum ProposalState {
Pending,
Active,
Defeated,
Timelocked,
AwaitingExecution,
Executed,
Expired
}
struct Proposal {
// Creator of the proposal
address proposer;
@ -39,4 +51,5 @@ interface IGovernance {
function lock(address owner, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
function lockWithApproval(uint256 amount) external;
function execute(uint256 proposalId) external payable;
function state(uint256 proposalId) external view returns (ProposalState);
}

@ -62,6 +62,7 @@ contract TornadoProposalTest is Test, TornadoAddresses {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TEST UTILS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function setUp() public virtual {
vm.createSelectFork(vm.envString("MAINNET_RPC_URL"));
_fetchConfiguration();
}
@ -74,7 +75,7 @@ contract TornadoProposalTest is Test, TornadoAddresses {
}
function easyPropose(address proposalAddress) public returns (uint256) {
retrieveAndLockBalance(TEST_PRIVATE_KEY_ONE, TEST_ADDRESS_ONE, PROPOSAL_THRESHOLD);
retrieveAndLockBalance(TEST_PRIVATE_KEY_ONE, TEST_ADDRESS_ONE, QUORUM_VOTES);
retrieveAndLockBalance(TEST_PRIVATE_KEY_TWO, TEST_ADDRESS_TWO, 1 ether);
/* ----------PROPOSER------------ */
@ -100,7 +101,7 @@ contract TornadoProposalTest is Test, TornadoAddresses {
}
function retrieveAndLockBalance(uint256 privateKey, address voter, uint256 amount) internal {
uint256 lockTimestamp = block.timestamp + VOTING_PERIOD + EXECUTION_DELAY;
uint256 lockTimestamp = block.timestamp + VOTING_PERIOD + EXECUTION_DELAY + 1 hours;
uint256 accountNonce = ERC20Permit(getTornTokenAddress()).nonces(voter);
bytes32 messageHash = keccak256(
@ -132,7 +133,7 @@ contract TornadoProposalTest is Test, TornadoAddresses {
function getProposalExecutableTime(uint256 proposalId) internal view returns (uint256) {
Proposal memory proposal = IGovernance(getGovernanceProxyAddress()).proposals(proposalId);
return proposal.endTime + VOTING_DELAY + 1 hours;
return proposal.endTime + EXECUTION_DELAY + 1 hours;
}
function _fetchConfiguration() internal {