fix: remove vm.stopPrank if vm.startPrank not present (#719)
* remove vm.stopPrank if vm.startPrank not present * remove unnecessary vm.stopPrank from governance tests
This commit is contained in:
parent
3c414c12e6
commit
5a47f04ffc
@ -39,7 +39,6 @@ contract WETH9V06Test is Test {
|
|||||||
function testShouldConvertDepositedETHToWrappedETH() public {
|
function testShouldConvertDepositedETHToWrappedETH() public {
|
||||||
vm.prank(user);
|
vm.prank(user);
|
||||||
etherToken.deposit{value: 1e20}();
|
etherToken.deposit{value: 1e20}();
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
assertEq(etherToken.balanceOf(user), 1e20);
|
assertEq(etherToken.balanceOf(user), 1e20);
|
||||||
assertEq(address(etherToken).balance, 1e20);
|
assertEq(address(etherToken).balance, 1e20);
|
||||||
@ -58,7 +57,6 @@ contract WETH9V06Test is Test {
|
|||||||
etherToken.deposit{value: 1e20}();
|
etherToken.deposit{value: 1e20}();
|
||||||
vm.prank(user);
|
vm.prank(user);
|
||||||
etherToken.withdraw(100);
|
etherToken.withdraw(100);
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
assertEq(etherToken.balanceOf(user), 1e20 - 100);
|
assertEq(etherToken.balanceOf(user), 1e20 - 100);
|
||||||
assertEq(address(etherToken).balance, 1e20 - 100);
|
assertEq(address(etherToken).balance, 1e20 - 100);
|
||||||
@ -68,7 +66,6 @@ contract WETH9V06Test is Test {
|
|||||||
function testShouldConvertSentETHToWrappedETH() public {
|
function testShouldConvertSentETHToWrappedETH() public {
|
||||||
vm.prank(user);
|
vm.prank(user);
|
||||||
address(etherToken).call{value: 1e20}(new bytes(0));
|
address(etherToken).call{value: 1e20}(new bytes(0));
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
assertEq(etherToken.balanceOf(user), 1e20);
|
assertEq(etherToken.balanceOf(user), 1e20);
|
||||||
assertEq(address(etherToken).balance, 1e20);
|
assertEq(address(etherToken).balance, 1e20);
|
||||||
|
@ -34,7 +34,6 @@ contract ZRXTokenTest is Test {
|
|||||||
assembly {
|
assembly {
|
||||||
_address := create(0, add(_bytecode, 0x20), mload(_bytecode))
|
_address := create(0, add(_bytecode, 0x20), mload(_bytecode))
|
||||||
}
|
}
|
||||||
vm.stopPrank();
|
|
||||||
zrxToken = IERC20Token(address(_address));
|
zrxToken = IERC20Token(address(_address));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +72,6 @@ contract ZRXTokenTest is Test {
|
|||||||
function testShouldReturnFalseIfSenderHasInsufficientBalance() public {
|
function testShouldReturnFalseIfSenderHasInsufficientBalance() public {
|
||||||
vm.prank(owner);
|
vm.prank(owner);
|
||||||
zrxToken.approve(user, totalSupply + 1);
|
zrxToken.approve(user, totalSupply + 1);
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
bool success = zrxToken.transferFrom(owner, user, totalSupply + 1);
|
bool success = zrxToken.transferFrom(owner, user, totalSupply + 1);
|
||||||
assertEq(success, false);
|
assertEq(success, false);
|
||||||
@ -82,7 +80,6 @@ contract ZRXTokenTest is Test {
|
|||||||
function testShouldReturnFalseIfRecipientHasInsufficientAllowance() public {
|
function testShouldReturnFalseIfRecipientHasInsufficientAllowance() public {
|
||||||
vm.prank(owner);
|
vm.prank(owner);
|
||||||
zrxToken.approve(user, totalSupply - 1);
|
zrxToken.approve(user, totalSupply - 1);
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
bool success = zrxToken.transferFrom(owner, user, totalSupply);
|
bool success = zrxToken.transferFrom(owner, user, totalSupply);
|
||||||
assertEq(success, false);
|
assertEq(success, false);
|
||||||
@ -97,7 +94,6 @@ contract ZRXTokenTest is Test {
|
|||||||
function testShouldNotModifySenderAllowanceIfSetToUINT256Max() public {
|
function testShouldNotModifySenderAllowanceIfSetToUINT256Max() public {
|
||||||
vm.prank(owner);
|
vm.prank(owner);
|
||||||
zrxToken.approve(user, type(uint256).max);
|
zrxToken.approve(user, type(uint256).max);
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
zrxToken.transferFrom(owner, user, 100);
|
zrxToken.transferFrom(owner, user, 100);
|
||||||
assertEq(zrxToken.allowance(owner, user), type(uint256).max);
|
assertEq(zrxToken.allowance(owner, user), type(uint256).max);
|
||||||
@ -106,7 +102,6 @@ contract ZRXTokenTest is Test {
|
|||||||
function testShouldTransferCorrectlyWhenSufficientAllowance() public {
|
function testShouldTransferCorrectlyWhenSufficientAllowance() public {
|
||||||
vm.prank(owner);
|
vm.prank(owner);
|
||||||
zrxToken.approve(user, 1000 * 1e18);
|
zrxToken.approve(user, 1000 * 1e18);
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
vm.prank(user);
|
vm.prank(user);
|
||||||
zrxToken.transferFrom(owner, user, 100 * 1e18);
|
zrxToken.transferFrom(owner, user, 100 * 1e18);
|
||||||
|
@ -90,7 +90,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
|
|||||||
// Vote
|
// Vote
|
||||||
vm.prank(account2);
|
vm.prank(account2);
|
||||||
governor.castVote(proposalId, 1); // Vote "for"
|
governor.castVote(proposalId, 1); // Vote "for"
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
// Fast forward to vote end
|
// Fast forward to vote end
|
||||||
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
||||||
@ -155,7 +154,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
|
|||||||
// Vote
|
// Vote
|
||||||
vm.prank(account2);
|
vm.prank(account2);
|
||||||
governor.castVote(proposalId, 1); // Vote "for"
|
governor.castVote(proposalId, 1); // Vote "for"
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
// Fast forward to vote end
|
// Fast forward to vote end
|
||||||
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
||||||
@ -266,7 +264,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
|
|||||||
// Vote
|
// Vote
|
||||||
vm.prank(account2);
|
vm.prank(account2);
|
||||||
governor.castVote(proposalId, 1); // Vote "for"
|
governor.castVote(proposalId, 1); // Vote "for"
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
// Fast forward to vote end
|
// Fast forward to vote end
|
||||||
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
||||||
@ -330,7 +327,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
|
|||||||
// Vote
|
// Vote
|
||||||
vm.prank(account2);
|
vm.prank(account2);
|
||||||
governor.castVote(proposalId, 1); // Vote "for"
|
governor.castVote(proposalId, 1); // Vote "for"
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
// Fast forward to vote end
|
// Fast forward to vote end
|
||||||
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
||||||
@ -366,7 +362,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
|
|||||||
// Vote
|
// Vote
|
||||||
vm.prank(account2);
|
vm.prank(account2);
|
||||||
governor.castVote(proposalId, 1); // Vote "for"
|
governor.castVote(proposalId, 1); // Vote "for"
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
// Fast forward to vote end
|
// Fast forward to vote end
|
||||||
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
||||||
@ -402,7 +397,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
|
|||||||
// Vote
|
// Vote
|
||||||
vm.prank(account2);
|
vm.prank(account2);
|
||||||
governor.castVote(proposalId, 1); // Vote "for"
|
governor.castVote(proposalId, 1); // Vote "for"
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
// Fast forward to vote end
|
// Fast forward to vote end
|
||||||
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
||||||
@ -438,7 +432,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
|
|||||||
// Vote
|
// Vote
|
||||||
vm.prank(account2);
|
vm.prank(account2);
|
||||||
governor.castVote(proposalId, 1); // Vote "for"
|
governor.castVote(proposalId, 1); // Vote "for"
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
// Fast forward to vote end
|
// Fast forward to vote end
|
||||||
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
||||||
|
@ -70,13 +70,12 @@ contract ZeroExProtocolGovernorTest is ZeroExGovernorBaseTest {
|
|||||||
// Vote
|
// Vote
|
||||||
vm.prank(account2);
|
vm.prank(account2);
|
||||||
governor.castVote(proposalId, 1); // Vote "for"
|
governor.castVote(proposalId, 1); // Vote "for"
|
||||||
vm.stopPrank();
|
|
||||||
vm.prank(account3);
|
vm.prank(account3);
|
||||||
governor.castVote(proposalId, 0); // Vote "against"
|
governor.castVote(proposalId, 0); // Vote "against"
|
||||||
vm.stopPrank();
|
|
||||||
vm.prank(account4);
|
vm.prank(account4);
|
||||||
governor.castVote(proposalId, 2); // Vote "abstain"
|
governor.castVote(proposalId, 2); // Vote "abstain"
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
// Fast forward to vote end
|
// Fast forward to vote end
|
||||||
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
||||||
|
@ -66,13 +66,12 @@ contract ZeroExTreasuryGovernorTest is ZeroExGovernorBaseTest {
|
|||||||
// Vote
|
// Vote
|
||||||
vm.prank(account2);
|
vm.prank(account2);
|
||||||
governor.castVote(proposalId, 1); // Vote "for"
|
governor.castVote(proposalId, 1); // Vote "for"
|
||||||
vm.stopPrank();
|
|
||||||
vm.prank(account3);
|
vm.prank(account3);
|
||||||
governor.castVote(proposalId, 0); // Vote "against"
|
governor.castVote(proposalId, 0); // Vote "against"
|
||||||
vm.stopPrank();
|
|
||||||
vm.prank(account4);
|
vm.prank(account4);
|
||||||
governor.castVote(proposalId, 2); // Vote "abstain"
|
governor.castVote(proposalId, 2); // Vote "abstain"
|
||||||
vm.stopPrank();
|
|
||||||
|
|
||||||
// Fast forward to vote end
|
// Fast forward to vote end
|
||||||
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
vm.roll(governor.proposalDeadline(proposalId) + 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user