forked from WTFAcademy/WTF-Solidity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathERC165.sol
29 lines (26 loc) · 987 Bytes
/
ERC165.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: MIT
// OpenZeppelin Contratos v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementação da interface {IERC165}.
*
* Contratos que desejam implementar o ERC165 devem herdar deste contrato e substituir {supportsInterface} para verificar
* o ID de interface adicional que será suportado. Por exemplo:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternativamente, {ERC165Storage} fornece uma implementação mais fácil de usar, mas mais cara.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev Veja {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}