Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query for name and symbol on ERC721 contracts regardless of whether or not they support the metadata interface #834

Merged
merged 4 commits into from
May 19, 2022

Conversation

adonesky1
Copy link
Contributor

@adonesky1 adonesky1 commented May 18, 2022

Some ERC721 contracts (e.g. Decentraland) only partially implement the metadata interface (described in the original EIP). We should query for fields included on the interface (name, symbol and tokenURI) regardless of whether or not the interface is fully implemented.

  • CHANGED:
    • Removed requirement that EIP721 metadata be fully implemented to query for name, symbol and tokenURI fields on a contract.

Checklist

  • Tests are included if applicable

Issue

Resolves MetaMask/metamask-extension#14459 & MetaMask/metamask-extension#14589 & MetaMask/metamask-extension#14518

digiwand
digiwand previously approved these changes May 18, 2022
Copy link
Contributor

@digiwand digiwand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@adonesky1 adonesky1 force-pushed the query-erc721-name-symbol-without-interface branch from 10b2c1e to 3e0d99f Compare May 19, 2022 15:56
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to use metadata at all if we don't understand the format? I'm 100% behind us making this class compatible with ERC721 contracts with alternative metadata formats, or no metadata. The format described in the EIP is optional after all. But if the contract doesn't support this metadata format, should we be assuming the fields we do find can be used in the same way?

e.g. if the contract had metadata of the format { name: ___, fullName: ___, where name is the symbol and fullName is a longer human-readable name. In that case we'd be wrongly using the symbol as the name.

Adding explicit support for other popular metadata formats (in later PRs) would be a safer alternate path for supporting those cases.

@FrederikBolding
Copy link
Member

Does it make sense to use metadata at all if we don't understand the format? I'm 100% behind us making this class compatible with ERC721 contracts with alternative metadata formats, or no metadata. The format described in the EIP is optional after all. But if the contract doesn't support this metadata format, should we be assuming the fields we do find can be used in the same way?

e.g. if the contract had metadata of the format { name: ___, fullName: ___, where name is the symbol and fullName is a longer human-readable name. In that case we'd be wrongly using the symbol as the name.

Adding explicit support for other popular metadata formats (in later PRs) would be a safer alternate path for supporting those cases.

I don't think I understand what you mean here. We are not parsing the tokenURI data at this point. We are just calling functions on the contract that return metadata. These functions are pretty standardized.

@Gudahtt
Copy link
Member

Gudahtt commented May 19, 2022

Hmm. ERC-721 seemed to imply they were optional, which led me to think they might be used for something else. But maybe you're right. Even if not explicitly guaranteed by the standard, it seems unlikely they'd be reused for some other purpose. Especially since they're also defined in ERC-20.

Copy link
Member

@FrederikBolding FrederikBolding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine to approve this as long as we create issues to resolve the infinite loading problem in the extension and explore the idea of trying to parse non-standard contracts.

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

MajorLift pushed a commit that referenced this pull request Oct 11, 2023
…r not they support the metadata interface (#834)

* query for name and symbol on erc721 contracts regardless of whether or not they support the metadata interface
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
…r not they support the metadata interface (#834)

* query for name and symbol on erc721 contracts regardless of whether or not they support the metadata interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Approving an ERC-721
4 participants