Remove ERC1155Receiver in favor of ERC1155Holder (#4450)

pull/4452/head
Francisco 2 years ago committed by GitHub
parent cd981f6521
commit 3d0edbecf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      .changeset/afraid-walls-smell.md
  2. 3
      contracts/governance/TimelockController.sol
  3. 2
      contracts/token/ERC1155/README.adoc
  4. 14
      contracts/token/ERC1155/utils/ERC1155Holder.sol
  5. 21
      contracts/token/ERC1155/utils/ERC1155Receiver.sol

@ -0,0 +1,5 @@
---
'openzeppelin-solidity': major
---
`ERC1155Receiver`: Removed in favor of `ERC1155Holder`.

@ -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";
/**
@ -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);
}

@ -26,8 +26,6 @@ NOTE: This core set of contracts is designed to be unopinionated, allowing devel
{{IERC1155Receiver}}
{{ERC1155Receiver}}
== Extensions
{{ERC1155Pausable}}

@ -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,

@ -1,21 +0,0 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)
pragma solidity ^0.8.19;
import {IERC1155Receiver} from "../IERC1155Receiver.sol";
import {IERC165, ERC165} from "../../../utils/introspection/ERC165.sol";
/**
* @dev Basic contract implementing the ERC-165 interface for {IERC1155Receiver}.
*
* NOTE: This contract does not suffice to receive tokens. See {ERC1155Holder}.
*/
abstract contract ERC1155Receiver 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);
}
}
Loading…
Cancel
Save