Skip to content

Commit

Permalink
chore: styling
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-something committed May 28, 2024
1 parent 37581e6 commit 7ada60b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/invariants/fuzz/Greeter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ interface IHevm {

contract InvariantGreeter {
// See https://github.com/a16z/halmos-cheatcodes?tab=readme-ov-file
IHevm public hevm = IHevm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
IHevm internal _hevm = IHevm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);

Greeter public targetContract;
Greeter internal _targetContract;

constructor() {
targetContract = new Greeter('a', IERC20(address(1)));
_targetContract = new Greeter('a', IERC20(address(1)));
}

function checkGreeterNeverEmpty(string memory newGreeting) public {
// Execution
(bool success,) = address(targetContract).call(abi.encodeCall(Greeter.setGreeting, newGreeting));
(bool success,) = address(_targetContract).call(abi.encodeCall(Greeter.setGreeting, newGreeting));

// Check output condition
assert((success && keccak256(bytes(targetContract.greeting())) != keccak256(bytes(''))) || !success);
assert((success && keccak256(bytes(_targetContract.greeting())) != keccak256(bytes(''))) || !success);
}

function checkOnlyOwnerSetsGreeting(address caller) public {
// Input conditions
hevm.prank(caller);
_hevm.prank(caller);

// Execution
(bool success,) = address(this).call(abi.encodeCall(Greeter.setGreeting, 'hello'));

// Check output condition
assert((success && msg.sender == targetContract.OWNER()) || (!success && msg.sender != targetContract.OWNER()));
assert((success && msg.sender == _targetContract.OWNER()) || (!success && msg.sender != _targetContract.OWNER()));
}
}

0 comments on commit 7ada60b

Please sign in to comment.