ERC165.sol 987 B

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