Remove ERC165Storage (#3880)
Co-authored-by: Francisco <frangio.1@gmail.com>
This commit is contained in:
committed by
Francisco Giordano
parent
9cbe8b340c
commit
81dbe643a0
@ -1,11 +0,0 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import "../utils/introspection/ERC165Storage.sol";
|
||||
|
||||
contract ERC165StorageMock is ERC165Storage {
|
||||
function registerInterface(bytes4 interfaceId) public {
|
||||
_registerInterface(interfaceId);
|
||||
}
|
||||
}
|
||||
@ -70,8 +70,6 @@ Note that, in all cases, accounts simply _declare_ their interfaces, but they ar
|
||||
|
||||
{{ERC165}}
|
||||
|
||||
{{ERC165Storage}}
|
||||
|
||||
{{ERC165Checker}}
|
||||
|
||||
{{IERC1820Registry}}
|
||||
|
||||
@ -16,8 +16,6 @@ import "./IERC165.sol";
|
||||
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
|
||||
*/
|
||||
abstract contract ERC165 is IERC165 {
|
||||
/**
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)
|
||||
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import "./ERC165.sol";
|
||||
|
||||
/**
|
||||
* @dev Storage based implementation of the {IERC165} interface.
|
||||
*
|
||||
* Contracts may inherit from this and call {_registerInterface} to declare
|
||||
* their support of an interface.
|
||||
*/
|
||||
abstract contract ERC165Storage is ERC165 {
|
||||
/**
|
||||
* @dev Mapping of interface ids to whether or not it's supported.
|
||||
*/
|
||||
mapping(bytes4 => bool) private _supportedInterfaces;
|
||||
|
||||
/**
|
||||
* @dev See {IERC165-supportsInterface}.
|
||||
*/
|
||||
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
|
||||
return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Registers the contract as an implementer of the interface defined by
|
||||
* `interfaceId`. Support of the actual ERC165 interface is automatic and
|
||||
* registering its interface id is not required.
|
||||
*
|
||||
* See {IERC165-supportsInterface}.
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
* - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
|
||||
*/
|
||||
function _registerInterface(bytes4 interfaceId) internal virtual {
|
||||
require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
|
||||
_supportedInterfaces[interfaceId] = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user