ERC165.sol 879 B

12345678910111213141516171819202122232425
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/ERC165.sol)
  3. pragma solidity ^0.8.20;
  4. import {IERC165} from "./IERC165.sol";
  5. /**
  6. * @dev Implementation of the {IERC165} interface.
  7. *
  8. * Contracts that want to implement ERC-165 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. abstract contract ERC165 is IERC165 {
  18. /// @inheritdoc IERC165
  19. function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
  20. return interfaceId == type(IERC165).interfaceId;
  21. }
  22. }