Skip to content

Commit

Permalink
Merge pull request #688 from open-dollar/fix-gov-test
Browse files Browse the repository at this point in the history
Pass Governance Unit Tests
  • Loading branch information
daopunk authored May 9, 2024
2 parents 3d31abf + a42668d commit 4597b99
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions test/unit/ODGovernor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -99,35 +99,35 @@ contract Unit_ODGovernorTest is Base {
assertEq(proposalState, uint256(IGovernor.ProposalState.Active));
}

// function test_ODGovernor_Propose_and_Cancel() public {
// // setup: Alice receives tokens and delegates to herself
// __mintAndDelegate(alice, 100 ether);
// vm.roll(100); // move to block number to 100
// (address[] memory targets, uint256[] memory values, bytes[] memory calldatas) = __createProposalArgs();
// vm.startPrank(alice);
// bytes32 descriptionHash = keccak256(bytes(proposal_description));
// uint256 propId = odGovernor.propose(targets, values, calldatas, proposal_description);
// vm.roll(10); // move to block number to some point inside the voting window

// // cancel the proposal
// odGovernor.cancel(targets, values, calldatas, descriptionHash);
// uint256 proposalState = uint256(odGovernor.state(propId));
// assertEq(proposalState, uint256(IGovernor.ProposalState.Canceled));
// }

// function test_ODGovernor_Propose_and_CancelExtendedArguments() public {
// // setup: Alice receives tokens and delegates to herself
// __mintAndDelegate(alice, 100 ether);
// vm.roll(100); // move to block number to 100
// (address[] memory targets, uint256[] memory values, bytes[] memory calldatas) = __createProposalArgs();
// vm.startPrank(alice);
// uint256 propId = odGovernor.propose(targets, values, calldatas, proposal_description);
// vm.roll(10); // move to block number to some point inside the voting window

// odGovernor.cancel(targets, values, calldatas, proposal_hash);
// uint256 proposalState = uint256(odGovernor.state(propId));
// assertEq(proposalState, uint256(IGovernor.ProposalState.Canceled));
// }
function test_ODGovernor_Propose_and_Cancel() public {
// setup: Alice receives tokens and delegates to herself
__mintAndDelegate(alice, 100 ether);
vm.roll(100); // move to block number to 100
(address[] memory targets, uint256[] memory values, bytes[] memory calldatas) = __createProposalArgs();
vm.startPrank(alice);
bytes32 descriptionHash = keccak256(bytes(proposal_description));
uint256 propId = odGovernor.propose(targets, values, calldatas, proposal_description);
vm.roll(10); // move to block number to some point inside the voting window

// cancel the proposal
odGovernor.cancel(targets, values, calldatas, descriptionHash);
uint256 proposalState = uint256(odGovernor.state(propId));
assertEq(proposalState, uint256(IGovernor.ProposalState.Canceled));
}

function test_ODGovernor_Propose_and_CancelExtendedArguments() public {
// setup: Alice receives tokens and delegates to herself
__mintAndDelegate(alice, 100 ether);
vm.roll(100); // move to block number to 100
(address[] memory targets, uint256[] memory values, bytes[] memory calldatas) = __createProposalArgs();
vm.startPrank(alice);
uint256 propId = odGovernor.propose(targets, values, calldatas, proposal_description);
vm.roll(10); // move to block number to some point inside the voting window

odGovernor.cancel(targets, values, calldatas, proposal_hash);
uint256 proposalState = uint256(odGovernor.state(propId));
assertEq(proposalState, uint256(IGovernor.ProposalState.Canceled));
}

function test_ODGovernor_Propose_and_Execute() public {
uint256 bobBalanceBeforeExecute = token.balanceOf(bob);
Expand Down

0 comments on commit 4597b99

Please sign in to comment.