DEV Community

Cover image for Introduction to AtomicAssets
Ivan Montiel
Ivan Montiel

Posted on • Updated on

Introduction to AtomicAssets

Introduction

While creating our own NFT using our own implementation can provide greater flexibility, it is missing a lot of quality of life functionality that most people expect with WAX NFTs. In this section, we are going to investigate the AtomicAssets Smart Contract and how we can leverage this to create robust NFTs on the WAX Blockchain. Rather than implement this functionality and potentially introduce bugs and security issues, we can use tried and true contracts that already exist in the WAX ecosystem.

What is AtomicAssets

AtomicAssets is a Smart Contract that is deployed on the WAX blockchain that provides an entire ecosystem of functionality that we can build upon when creating NFTs. The contract already implements the concept of Collections, Schemas, Templates, and NFT assets for us, while also building in transferring, trading, and selling asset functionality.

Moving forward, we will use the AtomicAsset standard to create NFTs. The contract implementation can be found on Github: https://github.com/pinknetworkx/atomicassets-contract.

You can also read about their AtomicHub launch which is a marketplace built on top of AtomicAssets. We will continue to explore both the contract and marketplace in future sections.

Understanding Collections and Structures

First, let’s look at the common tables that we will use in AtomicAssets: https://github.com/pinknetworkx/atomicassets-contract/wiki/Tables.

Collections: you can think of a collection as a way for us to organize our NFTs. In our previous Simple NFT example, you can imagine that all of our cats that we minted might be in our “Cats Series 1” Collection, which we could follow up with a new series that would belong to a new collection.

Schemas: when we created a Simple NFT, our NFT only had one piece of information that we really cared about, cat_name. However, most NFTs are more complicated than that, typically including a name, image URI, and other attributes. We use schemas to define the structure of our NFTs.

Templates: templates are useful when you want to mint many of the same type of NFT. For example, if you are creating a game, you may want a “Reward” schema, with templates for each type of reward, such as “Early Supporter” or “Gen0 Participant”. These templates can be used to mint new NFTs with all or some of the fields pre-set for the Reward template.

Assets: an asset is what we typically think of as an NFT. An asset can be minted by a template, but always belongs to a given schema and collection. In AtomicAssets, an asset can also have immutable data - things that cannot change about the NFT - and mutable data - fields that can be updated by an authorized account.

There are additional tables, but the above are the ones we will focus on.

Looking at the Smart Contract

Now, let’s take a glance at the actions that AtomicAssets gives us: https://github.com/pinknetworkx/atomicassets-contract/wiki/Actions

createcol: we discussed Collections above. This action in the contract is used to create a new collection.

createschema: we discussed Schemas above. This action is used to create a new schema. You will need a collection to add to before you can create a new schema.

createtempl: This action create a Template for a given Collection and Schema. When you create a template, you can decide how many NFTs of the given template can be minted, if they are burnable, and if they are transferrable.

locktemplate: You can lock a template so no more NFTs from the template can be minted.

mintasset: Mint an asset! You can mint an asset for a given Collection, Schema, and optionally a Template. In most cases, you will want to use a template.

setassetdata: This action is used to update mutable NFT data. An example might be XP for an NFT representing a unit in a game.

burnasset: Burn an NFT asset.

transfer: Transfer an asset to an account.

That’s a lot to process, but don’t worry, in the next sections we will break down how to use each action to create your own NFTs.

Tying it Together

The get a better appreciation of this contract, let’s look back at our previous Simple NFT Smart Contract. In that example, we had to create a table to track NFT minting, and who owned the NFT. On top of that, we also had to implement our own mint and transfer functions.

If we wanted to continue to build functionality to make our NFTs as flexible and secure as AtomicAssets, we would have to also implement all of the above Tables and Actions we went over in the previous parts of this article.

Instead, we can just write a Smart Contract that calls AtomicAssets Actions and does lookups on the AtomicAssets Tables. We don’t need to reinvent the wheel.

Moving Forward

In the next sections, we are going to create our Collection, Schema, and Template for an example NFT collection called BabyChicks. We will create these using scripts, then implement a Smart Contract to interact with out AtomicAssets.

Next post: Creating an AtomicAssets Collection

E-book

Get this entire WAX tutorial as an e-book on Amazon.

Additional links

Top comments (0)