ethql
ethql copied to clipboard
Expose ERC165 supportsInterface operation in schema
The ERC165 standard allows us to interrogate if a contract supports a specific function. It also appears to be a prerequisite for univocally identifying ERC721 contracts (#33).
The current proposal is to add a new field on the Account type. Suggested definition:
supportsInterface(selector: String!): ERC165Result!
Where ERC165Result is an enum with values:
SUPPORTED=> if the contract has asupportsInterface(bytes4)function as mandated by the standard, and the result of the call is true.NOT_SUPPORTED=> if the contract has asupportsInterface(bytes4)function as mandated by the standard, and the result of the call is false.NON_INTROSPECTABLE=> if the contract doesn't expose asupportsInterface(bytes4)function.
The selector argument is the String representation of the function selector (e.g. transfer(address,uint)). More info here: http://solidity.readthedocs.io/en/v0.4.21/abi-spec.html#function-selector.
The resolver would need to convert the String representation into its corresponding binary representation as per the link above (there might be functions in the web3 lib to do this).
@jonathanBuhler – would you like to take the lead on this one and collaborate with @akhila-raju?