Skip to content

Commit 3d0edbe

Browse files
authored
Remove ERC1155Receiver in favor of ERC1155Holder (#4450)
1 parent cd981f6 commit 3d0edbe

File tree

5 files changed

+17
-28
lines changed

5 files changed

+17
-28
lines changed

.changeset/afraid-walls-smell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'openzeppelin-solidity': major
3+
---
4+
5+
`ERC1155Receiver`: Removed in favor of `ERC1155Holder`.

contracts/governance/TimelockController.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pragma solidity ^0.8.19;
66
import {AccessControl} from "../access/AccessControl.sol";
77
import {ERC721Holder} from "../token/ERC721/utils/ERC721Holder.sol";
88
import {ERC1155Holder} from "../token/ERC1155/utils/ERC1155Holder.sol";
9-
import {ERC1155Receiver} from "../token/ERC1155/utils/ERC1155Receiver.sol";
109
import {Address} from "../utils/Address.sol";
1110

1211
/**
@@ -160,7 +159,7 @@ contract TimelockController is AccessControl, ERC721Holder, ERC1155Holder {
160159
*/
161160
function supportsInterface(
162161
bytes4 interfaceId
163-
) public view virtual override(AccessControl, ERC1155Receiver) returns (bool) {
162+
) public view virtual override(AccessControl, ERC1155Holder) returns (bool) {
164163
return super.supportsInterface(interfaceId);
165164
}
166165

contracts/token/ERC1155/README.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ NOTE: This core set of contracts is designed to be unopinionated, allowing devel
2626

2727
{{IERC1155Receiver}}
2828

29-
{{ERC1155Receiver}}
30-
3129
== Extensions
3230

3331
{{ERC1155Pausable}}

contracts/token/ERC1155/utils/ERC1155Holder.sol

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,23 @@
33

44
pragma solidity ^0.8.19;
55

6-
import {ERC1155Receiver} from "./ERC1155Receiver.sol";
6+
import {IERC165, ERC165} from "../../../utils/introspection/ERC165.sol";
7+
import {IERC1155Receiver} from "../IERC1155Receiver.sol";
78

89
/**
9-
* @dev Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
10+
* @dev Simple implementation of `IERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
1011
*
1112
* IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
1213
* stuck.
1314
*/
14-
abstract contract ERC1155Holder is ERC1155Receiver {
15+
abstract contract ERC1155Holder is ERC165, IERC1155Receiver {
16+
/**
17+
* @dev See {IERC165-supportsInterface}.
18+
*/
19+
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
20+
return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
21+
}
22+
1523
function onERC1155Received(
1624
address,
1725
address,

contracts/token/ERC1155/utils/ERC1155Receiver.sol

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)