Skip to content

Commit

Permalink
refactor!: revert implementing ERC-165 for application
Browse files Browse the repository at this point in the history
  • Loading branch information
guidanoli committed Jul 15, 2024
1 parent 27792e8 commit e50e53d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 76 deletions.
5 changes: 0 additions & 5 deletions .changeset/red-wasps-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion .changeset/silly-islands-end.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Modified the `ICartesiDApp` interface:
- Made it inherit from:

- `IERC721Receiver`.
- `IERC1155Receiver` (which inherits from `IERC165`).
- `IERC1155Receiver`.

- Modified the `executeVoucher` function:

Expand Down
10 changes: 0 additions & 10 deletions contracts/dapp/Application.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
22 changes: 2 additions & 20 deletions test/foundry/dapp/Application.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,22 @@ 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";
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";
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[];

Expand Down Expand Up @@ -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
// ------------------
Expand Down
40 changes: 0 additions & 40 deletions test/foundry/util/ERC165Test.sol

This file was deleted.

0 comments on commit e50e53d

Please sign in to comment.