ethql icon indicating copy to clipboard operation
ethql copied to clipboard

Expose ERC165 supportsInterface operation in schema

Open raulk opened this issue 7 years ago • 1 comments

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 a supportsInterface(bytes4) function as mandated by the standard, and the result of the call is true.
  • NOT_SUPPORTED => if the contract has a supportsInterface(bytes4) function as mandated by the standard, and the result of the call is false.
  • NON_INTROSPECTABLE => if the contract doesn't expose a supportsInterface(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).

raulk avatar Jul 26 '18 11:07 raulk

@jonathanBuhler – would you like to take the lead on this one and collaborate with @akhila-raju?

raulk avatar Jul 26 '18 11:07 raulk