erc721 icon indicating copy to clipboard operation
erc721 copied to clipboard

Cheaper ERC-165 implementation

Open fulldecent opened this issue 4 years ago • 2 comments

The approach in this implementation is:

supportedInterfaces[0x80ac58cd] = true; // ERC721

But this approach has gotten much more expensive with recent gas cost changes.

We can improve this to a pure implementation to save gas.

fulldecent avatar Dec 13 '21 17:12 fulldecent

@fulldecent A downside with this is combining implementations.

So if someone does this:

contract NFTokenMetadataEnumerableMock is
  NFTokenEnumerable,
  NFTokenMetadata, 

Then he is also responsible to override supportInterface to assure both are supported. With the current implementation that is done automatically.

This is a drawback and we have to decide which takes priority. A bit lower gas fee when deploying the contract or simpler implementation / usage.

MoMannn avatar Dec 20 '21 12:12 MoMannn

The compiler does throw an error for combining implementations since it does not know which method to use. This does not solve the correct implementation tho. But either way I created an implementation so we can see it and decide afterwards if we want to use it or not.

https://github.com/nibbstack/erc721/pull/292

@xpepermint

MoMannn avatar Dec 20 '21 12:12 MoMannn