ERC165Upgradeable.sol 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. }
  23. function __ERC165_init_unchained() internal onlyInitializing {
  24. }
  25. /**
  26. * @dev See {IERC165-supportsInterface}.
  27. */
  28. function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
  29. return interfaceId == type(IERC165Upgradeable).interfaceId;
  30. }
  31. /**
  32. * This empty reserved space is put in place to allow future versions to add new
  33. * variables without shifting down storage in the inheritance chain.
  34. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  35. */
  36. uint256[50] private __gap;
  37. }