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

MetadataViews over complexify previous design #85

Closed
cybercent opened this issue May 13, 2022 · 4 comments
Closed

MetadataViews over complexify previous design #85

cybercent opened this issue May 13, 2022 · 4 comments
Labels
Feature Feedback SC-Eng Issues that we want to see surfaced in SC-Eng ZH Board

Comments

@cybercent
Copy link

cybercent commented May 13, 2022

Instructions

While the MetadataViews proposal strives to add more structure to NFT metadata is actually adds unnecessary complexity.

Issue To Be Solved

Perviously, each contract defined their interface and a list of methods that could be called to get various data from the contract.

In the new proposal, each contract is defining their own custom views.

When a Dapp, needs to setup a new account to be used with a specific contract, that Dapp needs to setup the new account with all the views that were defined in the contract otherwise the metadata exposed by those views will not be available.

Additionally, the main problem, a metadata standard is not solved as the developer still needs to look through the contract code and define custom scripts to use the custom view functions defined in each contract.

(Optional): Suggest A Solution

Abandon MetadataViews and rely on previous design.
Propose new metadata standard.

(Optional): Context

When a user purchases an NFT on a marketplace, the marketplace needs to link all the metadata views defined by the contract that minted the NFT otherwise the views won't be accessible.

Previously the marketplace only needed to link one specific interface per contract.

As I see there are other issues proposing different types of views I suggest taking a pause and re-evaluating if this is not going in the wrong direction.

@bluesign
Copy link

When a Dapp, needs to setup a new account to be used with a specific contract, that Dapp needs to setup the new account with all the views that were defined in the contract otherwise the metadata exposed by those views will not be available

can you give an example to this? This feels like wrong conclusion

@cybercent
Copy link
Author

cybercent commented May 13, 2022

Hi @bluesign

Here is a concrete example.

The Flovatar contract implements the previous NFT metadata standard:
https://flowscan.org/contract/A.921ea449dffec68a.Flovatar/overview

This CollectionPublic interface defined in the contract needs to be linked on a new account in order for that account to allow the reading of metadata.

pub resource interface CollectionPublic { .. }

A new user that acquires a Flovatar would have this link created by the marketplace or wallet that managed the purchase.
Once linked, metadata can be read by executing methods defined in the interface.

The BarterYardClub contract implements the new MetadataViews standard:
https://flowscan.org/contract/A.28abb9f291cadaf2.BarterYardClubWerewolf/overview

The contract does not have an interface but exposes data using Views.
So when setting up a new account the marketplace or wallet would need to link the NonFungibleToken.CollectionPublic and the MetadataViews.ResolverCollection:

signer.link<&BarterYardClubWerewolf.Collection{NonFungibleToken.CollectionPublic, MetadataViews.ResolverCollection}>
            (BarterYardClubWerewolf.CollectionPublicPath, target: BarterYardClubWerewolf.CollectionStoragePath)

to finally have access to the same data as the first example.

Given that the second contract uses a custom view CompleteDisplay one would still need to look over all the fields defined in the view and create a custom connector that would first get the view and then get the same data by calling the custom fields.

So IMO there is additional complexity both in creating the contract code to define views and the code needed on the connector to read from views while one could just read the public methods.

@cybercent cybercent changed the title MetadataViews over complexity previous design MetadataViews over complexify previous design May 13, 2022
@bluesign
Copy link

@cybercent ok but this is not per view type, it is MetadataViews.ResolverCollection for all view types.

But the reason for this is, MetadataViews standard came after NonFungibleToken. And as new NFT standard is on the way, updating old one didn't make sense. Otherwise we could do something like :

resource interface NonFungibleToken.Collection : MetadataViews.ResolverCollection

In the new standard it is roughly like below, it is even more embedded. [0]

 pub resource interface NFT {
        // We also don’t want to restrict how an NFT defines its ID
        // They can store it, compute it, or use the UUID
        pub fun getID(): UInt64

        // Two functions for the NFT Metadata Standard
        pub fun getViews() : [Type]
        pub fun resolveView(_ view:Type): AnyStruct?
    }

It is a bit transition period in my opinion.

For the second part, design decision there is making a custom view or implementing some other standard view is decision left to developer.

As such for example viv3 can request from dapps to implement a viv3Display view or can use standard display view in the standard. But slowly standard views are getting added everyday too, it is still very young,

[0] https://forum.onflow.org/t/streamlined-token-standards-proposal/3075/9

@bjartek
Copy link
Contributor

bjartek commented May 13, 2022

Based on your experience @cybercent I see where you have doubts about this. But I would argue that the metadata standard has a lot of merrit.

Intention

The intention was never that each provider should defined their own views that should be used for interop against consumers. The intention was that there should be standardized views that the community agree upon that providers can then implement to expose their contracts to the functionality that consumers provide.

Another aspect that was always intended was that NFT.CP should have get getViewsand resolveView methods. And that they should be default implemented to return empty values. This way all existing links that link against NFT.CP should just work.

Status

The status so far is that the PR for default implementaion is done and awaiting review and merge thanks to @bluesign

There are many views that are already present in MetadataViews (https://github.com/onflow/flow-nft/blob/master/contracts/MetadataViews.cdc) such as

  • Display
  • Royalties/Royalty
  • ExternalView
  • File
  • Media
  • License
  • NFTCollectionData

And there are many more that are beeing worked on like

  • Edition
  • NFTView (That will compose the above to generate what alchemy need for their API)
  • Tags/Attributes
  • Serials
  • Rarity
  • Listing (for signaling that something is listed at a marketplace, like viv3)

@franklywatson franklywatson added the SC-Eng Issues that we want to see surfaced in SC-Eng ZH Board label May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Feedback SC-Eng Issues that we want to see surfaced in SC-Eng ZH Board
Projects
None yet
Development

No branches or pull requests

5 participants