Coder Social home page Coder Social logo

avataaars's Introduction

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

avataaars's People

Contributors

austinkline avatar

Stargazers

Greg Santos avatar

Watchers

 avatar Jacob Tucker avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.