EIP-165 defines an interface for contracts to let others know whether they implement some interface or not. This is possible thanks to the following function:
function supportsInterface(bytes4 interfaceID) external view returns (bool);
Where interfaceID is the XOR (exclusive or) of all function selectors in the interface. In Solidity, this value can be computed at compile time, which is very convenient for contract developers.
In #150, we specify that the ICartesiDApp interface returns an array of addresses that can be used to add inputs to the DApp. But, at first, we don't know which functions they implement. So, we should make them implement EIP-165!
āļø Solution
Make input relays implement EIP-165 and return true for their specific interface and IInputRelay.
We should, therefore, also make the specific interfaces NOT inherit from IInputRelay!!
The implementations already implement IInputRelay through InputRelay.
So, for example, EtherPortal should support IEtherPortal and IInputRelay.
š Context
EIP-165 defines an interface for contracts to let others know whether they implement some interface or not. This is possible thanks to the following function:
Where
interfaceID
is the XOR (exclusive or) of all function selectors in the interface. In Solidity, this value can be computed at compile time, which is very convenient for contract developers.In #150, we specify that the
ICartesiDApp
interface returns an array of addresses that can be used to add inputs to the DApp. But, at first, we don't know which functions they implement. So, we should make them implement EIP-165!āļø Solution
Make input relays implement EIP-165 and return
true
for their specific interface andIInputRelay
. We should, therefore, also make the specific interfaces NOT inherit fromIInputRelay
!! The implementations already implementIInputRelay
throughInputRelay
. So, for example,EtherPortal
should supportIEtherPortal
andIInputRelay
.We may use OpenZeppelin's ERC-165 implementation.