Skip to content

Flowtyio/avataaars

Repository files navigation

Avataaars - A Sample PFP Generator Cadence Smart Contract

Welcome! This repo serves as a complete example for how to build a smart contract fully compliant with NFT-standards. This repo brings Avataaars, an open-source avatar generator, to the blockchain, randomly generating avatars for users and storing them as NFTs. It makes full use of Metadata Standards needed for NFTs to be compatible with the Flowty marketplace and suite of products. Enjoy!

Metadata

Metadata is broken up into things called "Views" and can be "resolved" using the resolveView method on any resource which implements the MetadataViews.Resolver interface. In order for an NFT to be compliant with metadata standards, it should be able to resolve the NFTView Metadata View which encapsulates the minimum set of data needed to fully describe an NFT. Don't worry about resolving the NFTView yourself, though! There is a helper method that consumers of these standards use to grab everything at once, so you can avoid as much boilerplate as possible.

NFT-level Metadata

The following metadata views are expected by Flowty to be available in order for NFTs to be compatible with our marketplace and suite of products.

  1. Display - This is the primary view that is used to display an NFT in the marketplace. It contains information about the NFT's image, name, and description

  2. Royalties - This view is used to describe how royalties should be paid out to the NFT's creators. To learn more about Royalties, check out Austin's thread on the topic here

  3. External URL -
    This view is optional, and is used to provide a backlink for a specific NFT to your website or app.

  4. NFTCollectionData - This view contains information necessary to interact with your collection. Flowty makes use of this view to determine where to save and retrieve your NFTs. This view is used as a fallback if your collection is not on the NFT Catalog, and does not describe this view on the contract-level (described below).

  5. NFTCollectionDisplay - This view described how your collection should be shown on marketplaces. Just like NFTCollectionData, this view is used as a fallback if your collection is not on the NFT Catalog, and does not describe this view on the contract-level (described below).

  6. Traits - This view describes traits that users can perform filtering on. For example, Avataars have a trait called "Clothing" which has various values such as "Shirt", "Jacket", "Hoodie", etc. When ingested, each of these traits becomes a filterable option for users to search for on your collection page.

Contract-level Metadata

In addition to the Resolver interface, there is also a contract-level interface called ViewResolver which can be used to describe metadata about the contract itself. These views all can exist on NFTs as well, but contract-level views take precedence where described. Currently, the following metadata views are supported by Flowty at the contract level:

  1. NFTCollectionData - Flowty makes use of this view to determine where to save and retrieve your NFTs. Without it, Flowty will not be able to detect your collection's NFTs automatically.

  2. NFTCollectionDisplay - This view described how your collection should be shown on marketplaces. Without this, Flowty will use placeholder images for your collection's banner and thumbnail, and will use your contract's name as the collection's name.

  3. External URL -
    This view is optional, and is used to provide a backlink to your website or app. NOTE: Unlike the other contract-level views, External URL does not override the NFTs implementation of this view as they serve different purposes

You can find the Avataaars implementation of ViewResolver here.

Sample transactions

Mint - Mainnet

Mint - Testnet

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published