Skip to content

Commit baf791a

Browse files
authored
chore: Open compiler version + remove contract-test-utils (#55)
* chore: open compiler version * chore: remove contract test utils
1 parent 9fbe925 commit baf791a

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

.gitmodules

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "modules/contract-test-utils"]
2-
path = modules/contract-test-utils
3-
url = https://github.com/maple-labs/contract-test-utils
1+
[submodule "modules/forge-std"]
2+
path = modules/forge-std
3+
url = https://github.com/foundry-rs/forge-std

contracts/test/ERC20.t.sol

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: AGPL-3.0-only
2-
pragma solidity 0.8.7;
2+
pragma solidity ^0.8.7;
33

4-
import { InvariantTest, TestUtils } from "../../modules/contract-test-utils/contracts/test.sol";
4+
import { Test } from "../../modules/forge-std/src/Test.sol";
55

66
import { IERC20 } from "../interfaces/IERC20.sol";
77

@@ -10,7 +10,7 @@ import { ERC20 } from "../ERC20.sol";
1010
import { ERC20User } from "./accounts/ERC20User.sol";
1111
import { MockERC20 } from "./mocks/MockERC20.sol";
1212

13-
contract ERC20BaseTest is TestUtils {
13+
contract ERC20BaseTest is Test {
1414

1515
address internal immutable self = address(this);
1616

@@ -60,8 +60,8 @@ contract ERC20BaseTest is TestUtils {
6060
}
6161

6262
function testFuzz_increaseAllowance(address account_, uint256 initialAmount_, uint256 addedAmount_) public {
63-
initialAmount_ = constrictToRange(initialAmount_, 0, type(uint256).max / 2);
64-
addedAmount_ = constrictToRange(addedAmount_, 0, type(uint256).max / 2);
63+
initialAmount_ = bound(initialAmount_, 0, type(uint256).max / 2);
64+
addedAmount_ = bound(addedAmount_, 0, type(uint256).max / 2);
6565

6666
_token.approve(account_, initialAmount_);
6767

@@ -75,7 +75,7 @@ contract ERC20BaseTest is TestUtils {
7575
function testFuzz_decreaseAllowance_infiniteApproval(address account_, uint256 subtractedAmount_) public {
7676
uint256 MAX_UINT256 = type(uint256).max;
7777

78-
subtractedAmount_ = constrictToRange(subtractedAmount_, 0, MAX_UINT256);
78+
subtractedAmount_ = bound(subtractedAmount_, 0, MAX_UINT256);
7979

8080
_token.approve(account_, MAX_UINT256);
8181

@@ -87,8 +87,8 @@ contract ERC20BaseTest is TestUtils {
8787
}
8888

8989
function testFuzz_decreaseAllowance_nonInfiniteApproval(address account_, uint256 initialAmount_, uint256 subtractedAmount_) public {
90-
initialAmount_ = constrictToRange(initialAmount_, 0, type(uint256).max - 1);
91-
subtractedAmount_ = constrictToRange(subtractedAmount_, 0, initialAmount_);
90+
initialAmount_ = bound(initialAmount_, 0, type(uint256).max - 1);
91+
subtractedAmount_ = bound(subtractedAmount_, 0, initialAmount_);
9292

9393
_token.approve(account_, initialAmount_);
9494

@@ -115,8 +115,8 @@ contract ERC20BaseTest is TestUtils {
115115
}
116116

117117
function testFuzz_transferFrom(address recipient_, uint256 approval_, uint256 amount_) public {
118-
approval_ = constrictToRange(approval_, 0, type(uint256).max - 1);
119-
amount_ = constrictToRange(amount_, 0, approval_);
118+
approval_ = bound(approval_, 0, type(uint256).max - 1);
119+
amount_ = bound(amount_, 0, approval_);
120120

121121
ERC20User owner = new ERC20User();
122122

@@ -142,7 +142,7 @@ contract ERC20BaseTest is TestUtils {
142142
function testFuzz_transferFrom_infiniteApproval(address recipient_, uint256 amount_) public {
143143
uint256 MAX_UINT256 = type(uint256).max;
144144

145-
amount_ = constrictToRange(amount_, 0, MAX_UINT256);
145+
amount_ = bound(amount_, 0, MAX_UINT256);
146146

147147
ERC20User owner = new ERC20User();
148148

@@ -219,7 +219,7 @@ contract ERC20BaseTest is TestUtils {
219219

220220
}
221221

222-
contract ERC20PermitTest is TestUtils {
222+
contract ERC20PermitTest is Test {
223223

224224
bytes internal constant ARITHMETIC_ERROR = abi.encodeWithSignature("Panic(uint256)", 0x11);
225225

@@ -425,14 +425,14 @@ contract ERC20PermitTest is TestUtils {
425425

426426
}
427427

428-
contract ERC20Invariants is TestUtils, InvariantTest {
428+
contract ERC20Invariants is Test {
429429

430430
BalanceSum internal _balanceSum;
431431

432432
function setUp() public {
433433
_balanceSum = new BalanceSum();
434434

435-
addTargetContract(address(_balanceSum));
435+
targetContract(address(_balanceSum));
436436
}
437437

438438
function invariant_balanceSum() public {

contracts/test/accounts/ERC20User.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// SPDX-License-Identifier: AGPL-3.0-only
2-
pragma solidity 0.8.7;
2+
pragma solidity ^0.8.7;
33

44
import { IERC20 } from "../../interfaces/IERC20.sol";
55

modules/contract-test-utils

-1
This file was deleted.

modules/forge-std

Submodule forge-std added at 1de6eec

0 commit comments

Comments
 (0)