type 的用法。
type(C).name (string): 合约的名称type(C).creationCode (bytes memory): 合约的创建字节码type(C).runtimeCode (bytes memory): 合约的运行时字节码type(I).interfaceId (bytes4): 包含给定接口的EIP-165接口标识符type(T).min (T): 所在整型 T 的最小值type(T).max (T): 所在整型 T 的最大值
interfaceId
这个是计算接口合约的方法。
看下面的合约
1 | pragma solidity ^0.8.0; |
这 4 个方法分别返回
calculate_Test_interfaceId0xc6be8b58
Test_interfaceId0xc6be8b58
IERC20_interfaceId0x36372b07
IERC165_interfaceId0x01ffc9a7bytes4(keccak256('supportsInterface(bytes4)')) = 0x01ffc9a7