ERC165.sol 921 B

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