Remove ERC1155Receiver in favor of ERC1155Holder (#4450)
This commit is contained in:
5
.changeset/afraid-walls-smell.md
Normal file
5
.changeset/afraid-walls-smell.md
Normal file
@ -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 {AccessControl} from "../access/AccessControl.sol";
|
||||||
import {ERC721Holder} from "../token/ERC721/utils/ERC721Holder.sol";
|
import {ERC721Holder} from "../token/ERC721/utils/ERC721Holder.sol";
|
||||||
import {ERC1155Holder} from "../token/ERC1155/utils/ERC1155Holder.sol";
|
import {ERC1155Holder} from "../token/ERC1155/utils/ERC1155Holder.sol";
|
||||||
import {ERC1155Receiver} from "../token/ERC1155/utils/ERC1155Receiver.sol";
|
|
||||||
import {Address} from "../utils/Address.sol";
|
import {Address} from "../utils/Address.sol";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -160,7 +159,7 @@ contract TimelockController is AccessControl, ERC721Holder, ERC1155Holder {
|
|||||||
*/
|
*/
|
||||||
function supportsInterface(
|
function supportsInterface(
|
||||||
bytes4 interfaceId
|
bytes4 interfaceId
|
||||||
) public view virtual override(AccessControl, ERC1155Receiver) returns (bool) {
|
) public view virtual override(AccessControl, ERC1155Holder) returns (bool) {
|
||||||
return super.supportsInterface(interfaceId);
|
return super.supportsInterface(interfaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,8 +26,6 @@ NOTE: This core set of contracts is designed to be unopinionated, allowing devel
|
|||||||
|
|
||||||
{{IERC1155Receiver}}
|
{{IERC1155Receiver}}
|
||||||
|
|
||||||
{{ERC1155Receiver}}
|
|
||||||
|
|
||||||
== Extensions
|
== Extensions
|
||||||
|
|
||||||
{{ERC1155Pausable}}
|
{{ERC1155Pausable}}
|
||||||
|
|||||||
@ -3,15 +3,23 @@
|
|||||||
|
|
||||||
pragma solidity ^0.8.19;
|
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
|
* IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
|
||||||
* stuck.
|
* 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(
|
function onERC1155Received(
|
||||||
address,
|
address,
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user