Skip to content

Commit

Permalink
test: fix superc20 interface test (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
agusduha authored Nov 5, 2024
1 parent 6fbf9db commit ee8faaa
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol";

// Libraries
import { Predeploys } from "src/libraries/Predeploys.sol";
import { IERC20Solady as IERC20 } from "src/vendor/interfaces/IERC20Solady.sol";

import { Initializable } from "@openzeppelin/contracts-v5/proxy/utils/Initializable.sol";
import { IERC165 } from "@openzeppelin/contracts-v5/utils/introspection/IERC165.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IERC7802 } from "src/L2/interfaces/IERC7802.sol";
import { IBeacon } from "@openzeppelin/contracts-v5/proxy/beacon/IBeacon.sol";
import { BeaconProxy } from "@openzeppelin/contracts-v5/proxy/beacon/BeaconProxy.sol";
import { Unauthorized } from "src/libraries/errors/CommonErrors.sol";
Expand Down Expand Up @@ -248,13 +249,17 @@ contract OptimismSuperchainERC20Test is Test {
/// @notice Tests that the `supportsInterface` function returns true for the `ISuperchainERC20` interface.
function test_supportInterface_succeeds() public view {
assertTrue(optimismSuperchainERC20.supportsInterface(type(IERC165).interfaceId));
assertTrue(optimismSuperchainERC20.supportsInterface(type(IERC20).interfaceId));
assertTrue(optimismSuperchainERC20.supportsInterface(type(IERC7802).interfaceId));
assertTrue(optimismSuperchainERC20.supportsInterface(type(IOptimismSuperchainERC20).interfaceId));
}

/// @notice Tests that the `supportsInterface` function returns false for any other interface than the
/// `ISuperchainERC20` one.
function testFuzz_supportInterface_returnFalse(bytes4 _interfaceId) public view {
vm.assume(_interfaceId != type(IERC165).interfaceId);
vm.assume(_interfaceId != type(IERC20).interfaceId);
vm.assume(_interfaceId != type(IERC7802).interfaceId);
vm.assume(_interfaceId != type(IOptimismSuperchainERC20).interfaceId);
assertFalse(optimismSuperchainERC20.supportsInterface(_interfaceId));
}
Expand Down

0 comments on commit ee8faaa

Please sign in to comment.