1
1
// SPDX-License-Identifier: AGPL-3.0-only
2
- pragma solidity 0.8.7 ;
2
+ pragma solidity ^ 0.8.7 ;
3
3
4
- import { InvariantTest, TestUtils } from "../../modules/contract-test-utils/contracts/test .sol " ;
4
+ import { Test } from "../../modules/forge-std/src/Test .sol " ;
5
5
6
6
import { IERC20 } from "../interfaces/IERC20.sol " ;
7
7
@@ -10,7 +10,7 @@ import { ERC20 } from "../ERC20.sol";
10
10
import { ERC20User } from "./accounts/ERC20User.sol " ;
11
11
import { MockERC20 } from "./mocks/MockERC20.sol " ;
12
12
13
- contract ERC20BaseTest is TestUtils {
13
+ contract ERC20BaseTest is Test {
14
14
15
15
address internal immutable self = address (this );
16
16
@@ -60,8 +60,8 @@ contract ERC20BaseTest is TestUtils {
60
60
}
61
61
62
62
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 );
65
65
66
66
_token.approve (account_, initialAmount_);
67
67
@@ -75,7 +75,7 @@ contract ERC20BaseTest is TestUtils {
75
75
function testFuzz_decreaseAllowance_infiniteApproval (address account_ , uint256 subtractedAmount_ ) public {
76
76
uint256 MAX_UINT256 = type (uint256 ).max;
77
77
78
- subtractedAmount_ = constrictToRange (subtractedAmount_, 0 , MAX_UINT256);
78
+ subtractedAmount_ = bound (subtractedAmount_, 0 , MAX_UINT256);
79
79
80
80
_token.approve (account_, MAX_UINT256);
81
81
@@ -87,8 +87,8 @@ contract ERC20BaseTest is TestUtils {
87
87
}
88
88
89
89
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_);
92
92
93
93
_token.approve (account_, initialAmount_);
94
94
@@ -115,8 +115,8 @@ contract ERC20BaseTest is TestUtils {
115
115
}
116
116
117
117
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_);
120
120
121
121
ERC20User owner = new ERC20User ();
122
122
@@ -142,7 +142,7 @@ contract ERC20BaseTest is TestUtils {
142
142
function testFuzz_transferFrom_infiniteApproval (address recipient_ , uint256 amount_ ) public {
143
143
uint256 MAX_UINT256 = type (uint256 ).max;
144
144
145
- amount_ = constrictToRange (amount_, 0 , MAX_UINT256);
145
+ amount_ = bound (amount_, 0 , MAX_UINT256);
146
146
147
147
ERC20User owner = new ERC20User ();
148
148
@@ -219,7 +219,7 @@ contract ERC20BaseTest is TestUtils {
219
219
220
220
}
221
221
222
- contract ERC20PermitTest is TestUtils {
222
+ contract ERC20PermitTest is Test {
223
223
224
224
bytes internal constant ARITHMETIC_ERROR = abi.encodeWithSignature ("Panic(uint256) " , 0x11 );
225
225
@@ -425,14 +425,14 @@ contract ERC20PermitTest is TestUtils {
425
425
426
426
}
427
427
428
- contract ERC20Invariants is TestUtils , InvariantTest {
428
+ contract ERC20Invariants is Test {
429
429
430
430
BalanceSum internal _balanceSum;
431
431
432
432
function setUp () public {
433
433
_balanceSum = new BalanceSum ();
434
434
435
- addTargetContract (address (_balanceSum));
435
+ targetContract (address (_balanceSum));
436
436
}
437
437
438
438
function invariant_balanceSum () public {
0 commit comments