in ony of my contracts, I do the following:
/// for the GovernanceWrappedERC20
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return
interfaceId == type(IERC20Upgradeable).interfaceId ||
interfaceId == type(IERC20PermitUpgradeable).interfaceId ||
interfaceId == type(IERC20MetadataUpgradeable).interfaceId ||
interfaceId == type(ERC20VotesUpgradable).interfaceId ||
interfaceId == type(ERC20WrapperUpgradeable).interfaceId ||
super.supportsInterface(interfaceId);
}
As you can see, I do one of the checks such as:
interfaceId == type(ERC20WrapperUpgradeable).interfaceId
.
One problem I see here is doing interfaceId
on the abstract contract is wrong. The reason is, in this exampl,e decimals
exist on ERC20WrapperUpgradeable
which in the end would end up in the interfaceId
, but the thing is, It shouldn't be in the interfaceId of ERC20WrapperUpgradeable
, because it is included in the IERC20MetadataUpgradable
. Why don't you have interfaces for these contracts ? ERC20VotesUpgradable
and ERC20WrapperUpgradable
.