Skip to content

Latest commit

 

History

History
204 lines (189 loc) · 6.9 KB

ERC165.md

File metadata and controls

204 lines (189 loc) · 6.9 KB

ERC165.sol

View Source: openzeppelin-solidity/contracts/utils/introspection/ERC165.sol

↗ Extends: IERC165 ↘ Derived Contracts: AccessControl

ERC165

Implementation of the {IERC165} interface. Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check for the additional interface id that will be supported. For example:

function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
    return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
}

Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.

Functions

supportsInterface

See {IERC165-supportsInterface}.

function supportsInterface(bytes4 interfaceId) public view
returns(bool)

Arguments

Name Type Description
interfaceId bytes4
Source Code
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }

Contracts