From a42668d004376ccbfe366b36b4953002eb020896 Mon Sep 17 00:00:00 2001 From: Hunter King Date: Tue, 7 May 2024 12:05:16 -0700 Subject: [PATCH] pass tests --- test/unit/ODGovernor.t.sol | 58 +++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/test/unit/ODGovernor.t.sol b/test/unit/ODGovernor.t.sol index 76c0e835..768f48bb 100644 --- a/test/unit/ODGovernor.t.sol +++ b/test/unit/ODGovernor.t.sol @@ -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);