diff --git a/.changeset/red-wasps-report.md b/.changeset/red-wasps-report.md index 493d48e0..a63ca2aa 100644 --- a/.changeset/red-wasps-report.md +++ b/.changeset/red-wasps-report.md @@ -6,11 +6,6 @@ Modified the `CartesiDApp` contract: - Renamed it as `Application`. -- Made it support the following interfaces (as in EIP-165): - - - `IApplication` - - `IERC721Receiver` - - Removed the `withdrawEther` function. - Removed the `OnlyApplication` error. diff --git a/.changeset/silly-islands-end.md b/.changeset/silly-islands-end.md index 82ae37e2..c8515122 100644 --- a/.changeset/silly-islands-end.md +++ b/.changeset/silly-islands-end.md @@ -9,7 +9,7 @@ Modified the `ICartesiDApp` interface: - Made it inherit from: - `IERC721Receiver`. - - `IERC1155Receiver` (which inherits from `IERC165`). + - `IERC1155Receiver`. - Modified the `executeVoucher` function: diff --git a/contracts/dapp/Application.sol b/contracts/dapp/Application.sol index 0ee35c0d..f7cb1956 100644 --- a/contracts/dapp/Application.sol +++ b/contracts/dapp/Application.sol @@ -15,7 +15,6 @@ import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Hol import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; -import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {BitMaps} from "@openzeppelin/contracts/utils/structs/BitMaps.sol"; contract Application is @@ -135,15 +134,6 @@ contract Application is return _consensus; } - function supportsInterface( - bytes4 interfaceId - ) public view virtual override(ERC1155Holder, IERC165) returns (bool) { - return - interfaceId == type(IApplication).interfaceId || - interfaceId == type(IERC721Receiver).interfaceId || - super.supportsInterface(interfaceId); - } - /// @notice Check if an output Merkle root hash was ever accepted by the current consensus. /// @param claim The output Merkle root hash function _wasClaimAccepted(bytes32 claim) internal view returns (bool) { diff --git a/test/foundry/dapp/Application.t.sol b/test/foundry/dapp/Application.t.sol index f838ac8a..930e4cc2 100644 --- a/test/foundry/dapp/Application.t.sol +++ b/test/foundry/dapp/Application.t.sol @@ -14,7 +14,6 @@ import {SafeERC20Transfer} from "contracts/delegatecall/SafeERC20Transfer.sol"; import {IERC1155Receiver} from "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol"; import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; -import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {IERC20Errors, IERC721Errors, IERC1155Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; @@ -22,7 +21,7 @@ import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; -import {ERC165Test} from "../util/ERC165Test.sol"; +import {TestBase} from "../util/TestBase.sol"; import {EtherReceiver} from "../util/EtherReceiver.sol"; import {ExternalLibMerkle32} from "../library/LibMerkle32.t.sol"; import {LibEmulator} from "../util/LibEmulator.sol"; @@ -30,7 +29,7 @@ import {SimpleERC20} from "../util/SimpleERC20.sol"; import {SimpleERC721} from "../util/SimpleERC721.sol"; import {SimpleSingleERC1155, SimpleBatchERC1155} from "../util/SimpleERC1155.sol"; -contract ApplicationTest is ERC165Test { +contract ApplicationTest is TestBase { using LibEmulator for LibEmulator.State; using ExternalLibMerkle32 for bytes32[]; @@ -291,23 +290,6 @@ contract ApplicationTest is ERC165Test { _testERC20Success(output, proof); } - // ------- - // ERC-165 - // ------- - - function getERC165Contract() public view override returns (IERC165) { - return _appContract; - } - - function getSupportedInterfaces() - public - view - override - returns (bytes4[] memory) - { - return _interfaceIds; - } - // ------------------ // internal functions // ------------------ diff --git a/test/foundry/util/ERC165Test.sol b/test/foundry/util/ERC165Test.sol deleted file mode 100644 index e7b2212d..00000000 --- a/test/foundry/util/ERC165Test.sol +++ /dev/null @@ -1,40 +0,0 @@ -// (c) Cartesi and individual authors (see AUTHORS) -// SPDX-License-Identifier: Apache-2.0 (see LICENSE) - -pragma solidity ^0.8.8; - -import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; - -import {TestBase} from "./TestBase.sol"; - -/// @notice Tests contracts that implement ERC-165 -abstract contract ERC165Test is TestBase { - /// @notice Get ERC-165 contract to be tested - function getERC165Contract() public virtual returns (IERC165); - - /// @notice Get array of IDs of supported interfaces - function getSupportedInterfaces() public virtual returns (bytes4[] memory); - - function testSupportsInterface() public { - IERC165 erc165 = getERC165Contract(); - assertTrue(erc165.supportsInterface(type(IERC165).interfaceId)); - assertFalse(erc165.supportsInterface(0xffffffff)); - - bytes4[] memory supportedInterfaces = getSupportedInterfaces(); - for (uint256 i; i < supportedInterfaces.length; ++i) { - assertTrue(erc165.supportsInterface(supportedInterfaces[i])); - } - } - - function testSupportsInterface(bytes4 interfaceId) public { - vm.assume(interfaceId != type(IERC165).interfaceId); - - bytes4[] memory supportedInterfaces = getSupportedInterfaces(); - for (uint256 i; i < supportedInterfaces.length; ++i) { - vm.assume(interfaceId != supportedInterfaces[i]); - } - - IERC165 erc165 = getERC165Contract(); - assertFalse(erc165.supportsInterface(interfaceId)); - } -}