1

Take a look at this code:

pragma solidity >=0.8.26;

import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol";

interface IFoo1 is IERC165 {
    function myFunction() external pure returns (bool);
}

interface IFoo2 {
    function myFunction() external pure returns (bool);
}

contract Implementation {
    function option1() external pure returns (bytes4) {
        return type(IFoo1).interfaceId;
    }

    function option2() external pure returns (bytes4) {
        return type(IFoo2).interfaceId;
    }
}

Both option1 and option2 return the same value: 0xc3780a3a. But why? IFoo1 contains an additional function, namely, the supportsInterface function defined in IERC165.

1 Answer 1

3

It actually doesn't include inherited functions, mentioned in the feature PR

There is also a discussion regarding this in the comments of this same PR

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.