Can supportsInterface() function be removed?

Hello team,
I was playing around with Contracts Wizard and an idea crossed my mind (probably wrong one, but I would like to ask you anyway). Assuming, we want to create (for example) a simple ERC721 Contract which is Mintable, Burnable and has Roles. The rest of features are not necessary for the usage of the contract. Let us also assume that a creator of the contract does not even want to interact with other contracts in the future, thus it does not see a value (for instance) in supportsInterface() function. Questions are:

  • Is there any chance to omit/remove supportsInterface? One could say based on reasons above that if it is not needed, let us remove it to have as minimum lines of code as possible and we could even save some gas. If it is not a good approach, why?

  • Only way how to remove is to copy contracts to own repository and remove lines of code from the original code, right? Or exists any other approach to do so?

Thank you very much in advance!


But you should not remove supportsInterface. It's required by the ERC, so systems can assume it's present and will do for various purposes, the basic one is detecting off-chain whether a contract is an ERC721 contract.