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

Remove ERC1155Receiver in favor of ERC1155Holder #4450

Merged
merged 2 commits into from
Jul 11, 2023
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
5 changes: 5 additions & 0 deletions .changeset/afraid-walls-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'openzeppelin-solidity': major
---

`ERC1155Receiver`: Removed in favor of `ERC1155Holder`.
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.