Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aviggiano committed Sep 25, 2024
1 parent a621a12 commit 223eccd
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions test/ERC20.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import {SymTest} from "halmos-cheatcodes/SymTest.sol";
import {ERC20OpenZeppelin} from "@src/ERC20OpenZeppelin.sol";
import {ERC20Solady} from "@src/ERC20Solady.sol";
import {ERC20Solmate} from "@src/ERC20Solmate.sol";
import {MockERC20} from "@solmate/test/utils/mocks/MockERC20.sol";

/// @custom:halmos --storage-layout=generic --array-lengths senders=2 --loop 256
/// @custom:halmos --storage-layout=generic --array-lengths senders=2 --array-lengths staticcalls=2 --loop 256
contract ERC20Test is Test, SymTest {
ERC20OpenZeppelin public openzeppelin;
ERC20Solady public solady;
Expand All @@ -23,15 +22,13 @@ contract ERC20Test is Test, SymTest {
solmate = new ERC20Solmate("Token", "TOK", 6);
}

function check_differential_erc20(address[] memory senders, uint256 calls, uint256 staticcalls) public {
vm.assume(senders.length == calls);

function check_differential_erc20(address[] memory senders, uint256[] memory staticcalls) public {
address[3] memory contracts = [address(openzeppelin), address(solady), address(solmate)];

bytes[] memory results;

results = new bytes[](calls);
for (uint256 j = 0; j < calls; j++) {
results = new bytes[](senders.length);
for (uint256 j = 0; j < senders.length; j++) {
for (uint256 i = 0; i < contracts.length; i++) {
vm.prank(senders[j]);
(bool _success, bytes memory _result) = contracts[i].call(svm.createCalldata("MockERC20"));
Expand All @@ -44,8 +41,8 @@ contract ERC20Test is Test, SymTest {
}
}

results = new bytes[](staticcalls);
for (uint256 j = 0; j < staticcalls; j++) {
results = new bytes[](staticcalls.length);
for (uint256 j = 0; j < staticcalls.length; j++) {
for (uint256 i = 0; i < contracts.length; i++) {
(bool _success, bytes memory _result) = contracts[i].staticcall(svm.createCalldata("MockERC20", true));
require(_success);
Expand Down

0 comments on commit 223eccd

Please sign in to comment.