ERC165Upgradeable.sol 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
  3. pragma solidity ^0.8.0;
  4. import "./IERC165Upgradeable.sol";
  5. import "../../proxy/utils/Initializable.sol";
  6. /**
  7. * @dev Implementation of the {IERC165} interface.
  8. *
  9. * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
  10. * for the additional interface id that will be supported. For example:
  11. *
  12. * ```solidity
  13. * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
  14. * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
  15. * }
  16. * ```
  17. *
  18. * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
  19. */
  20. abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
  21. function __ERC165_init() internal onlyInitializing {
  22. __ERC165_init_unchained();
  23. }
  24. function __ERC165_init_unchained() internal onlyInitializing {
  25. }
  26. /**
  27. * @dev See {IERC165-supportsInterface}.
  28. */
  29. function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
  30. return interfaceId == type(IERC165Upgradeable).interfaceId;
  31. }
  32. uint256[50] private __gap;
  33. }