Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Open compiler version + remove contract-test-utils #55

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "modules/contract-test-utils"]
path = modules/contract-test-utils
url = https://github.com/maple-labs/contract-test-utils
[submodule "modules/forge-std"]
path = modules/forge-std
url = https://github.com/foundry-rs/forge-std
28 changes: 14 additions & 14 deletions contracts/test/ERC20.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.7;
pragma solidity ^0.8.7;

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

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

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

contract ERC20BaseTest is TestUtils {
contract ERC20BaseTest is Test {

address internal immutable self = address(this);

Expand Down Expand Up @@ -60,8 +60,8 @@ contract ERC20BaseTest is TestUtils {
}

function testFuzz_increaseAllowance(address account_, uint256 initialAmount_, uint256 addedAmount_) public {
initialAmount_ = constrictToRange(initialAmount_, 0, type(uint256).max / 2);
addedAmount_ = constrictToRange(addedAmount_, 0, type(uint256).max / 2);
initialAmount_ = bound(initialAmount_, 0, type(uint256).max / 2);
addedAmount_ = bound(addedAmount_, 0, type(uint256).max / 2);

_token.approve(account_, initialAmount_);

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

subtractedAmount_ = constrictToRange(subtractedAmount_, 0, MAX_UINT256);
subtractedAmount_ = bound(subtractedAmount_, 0, MAX_UINT256);

_token.approve(account_, MAX_UINT256);

Expand All @@ -87,8 +87,8 @@ contract ERC20BaseTest is TestUtils {
}

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

_token.approve(account_, initialAmount_);

Expand All @@ -115,8 +115,8 @@ contract ERC20BaseTest is TestUtils {
}

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

ERC20User owner = new ERC20User();

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

amount_ = constrictToRange(amount_, 0, MAX_UINT256);
amount_ = bound(amount_, 0, MAX_UINT256);

ERC20User owner = new ERC20User();

Expand Down Expand Up @@ -219,7 +219,7 @@ contract ERC20BaseTest is TestUtils {

}

contract ERC20PermitTest is TestUtils {
contract ERC20PermitTest is Test {

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

Expand Down Expand Up @@ -425,14 +425,14 @@ contract ERC20PermitTest is TestUtils {

}

contract ERC20Invariants is TestUtils, InvariantTest {
contract ERC20Invariants is Test {

BalanceSum internal _balanceSum;

function setUp() public {
_balanceSum = new BalanceSum();

addTargetContract(address(_balanceSum));
targetContract(address(_balanceSum));
}

function invariant_balanceSum() public {
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/accounts/ERC20User.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.7;
pragma solidity ^0.8.7;

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

Expand Down
1 change: 0 additions & 1 deletion modules/contract-test-utils
Submodule contract-test-utils deleted from d42c3f
1 change: 1 addition & 0 deletions modules/forge-std
Submodule forge-std added at 1de6ee
Loading