Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Remove ERC1155Receiver in favor of ERC1155Holder
  • Loading branch information
frangio committed Jul 11, 2023
commit 77d4c4183d34833d0a8db5d61ffd3d01870c914c
3 changes: 1 addition & 2 deletions contracts/governance/TimelockController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pragma solidity ^0.8.19;
import {AccessControl} from "../access/AccessControl.sol";
import {ERC721Holder} from "../token/ERC721/utils/ERC721Holder.sol";
import {ERC1155Holder} from "../token/ERC1155/utils/ERC1155Holder.sol";
import {ERC1155Receiver} from "../token/ERC1155/utils/ERC1155Receiver.sol";
import {Address} from "../utils/Address.sol";

/**
Expand Down Expand Up @@ -160,7 +159,7 @@ contract TimelockController is AccessControl, ERC721Holder, ERC1155Holder {
*/
function supportsInterface(
bytes4 interfaceId
) public view virtual override(AccessControl, ERC1155Receiver) returns (bool) {
) public view virtual override(AccessControl, ERC1155Holder) returns (bool) {
return super.supportsInterface(interfaceId);
}

Expand Down
2 changes: 0 additions & 2 deletions contracts/token/ERC1155/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ NOTE: This core set of contracts is designed to be unopinionated, allowing devel

{{IERC1155Receiver}}

{{ERC1155Receiver}}

== Extensions

{{ERC1155Pausable}}
Expand Down
14 changes: 11 additions & 3 deletions contracts/token/ERC1155/utils/ERC1155Holder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,23 @@

pragma solidity ^0.8.19;

import {ERC1155Receiver} from "./ERC1155Receiver.sol";
import {IERC165, ERC165} from "../../../utils/introspection/ERC165.sol";
import {IERC1155Receiver} from "../IERC1155Receiver.sol";

/**
* @dev Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
* @dev Simple implementation of `IERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
*
* IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
* stuck.
*/
abstract contract ERC1155Holder is ERC1155Receiver {
abstract contract ERC1155Holder is ERC165, IERC1155Receiver {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
}

function onERC1155Received(
address,
address,
Expand Down
21 changes: 0 additions & 21 deletions contracts/token/ERC1155/utils/ERC1155Receiver.sol

This file was deleted.