nibbstack / erc721

The reference implementation of the ERC-721 non-fungible token standard.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cheaper ERC-165 implementation

fulldecent opened this issue · 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
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.

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.

#292

@xpepermint