Make money in blockchain

Good Luck To You!

What is erc1155? Take Adidas NFT as an example

The three standard protocols erc20, erc721 (derived from erc721a) and erc1155 have not encountered any good examples to explain. Just yesterday, a friend wondered why there was only one item of Adidas NFT but 30000 people held it. After studying it, I thought it was a good example, so I wrote this article to explain what erc1155 is.

Let's take a look at the situation of Adidas NFT. The opensea website is as follows: https://opensea.io/collection/adidasoriginals .

After we enter, we can see that there is only one NFT, but more than 20000 people own it. At this time, subconsciously, you may guess that it is a shared NFT? Or fragmented NFT?

1.png

Entering the details page of the NFT, we can see that there are 21.7k people holding it.

2.png


Further down, you can see that there are many holders of pending orders, and the prices are different.

3.png

When we click on purchase, we can find that 1.499eth is required to be paid, that is, the lowest price of all pending orders.

4.png

Here you will feel as if it does look different from the usual NFT. It's strange.

Then we click Details to see that the token ID is 0. As we all know, the token ID of most NFTs is increasing. That is, I issued 10000 NFTs, and the ID should increase from 0 to 10000. However, Adidas issued 30000 NFTs. According to the common sense, there should be 30000 NFTs, and the ID should increase to 30000. But why is there only one NFT with ID 0?

Let's continue to look down. Its protocol is erc1155. The fishiness may be here. You may find that your NFT uploaded on opensea also uses 1155 protocol. What is the relationship between the two?

5.png

There must be a reason why Adidas uses such an unusual NFT protocol, so let's continue to follow the steps. Let's take a look at the introduction of its NFT on the adidas official website.

Adidas NFT is divided into four stages. Stages 1, 2 and 3 involve the destruction and exchange operation. In the fourth stage, an erc721nft will be obtained.

Let's deduce that in the next big game, Adidas uses the four stages of collection, destruction and exchange in the form of games to play tricks layer by layer, so as to enhance everyone's participation and play brand influence. Therefore, the focus here is "destruction". If the NFT in the hands of 30000 people is to be destroyed, it means that these NFT tools have very strong attributes and cannot be different, From this point of view, the common erc721 issue non-homogeneous token agreement seems not to be applicable.

It seems that erc1155 is more applicable. Let's first briefly understand what erc1155 is, and then let's see what the adidas contract has done.

In short, the biggest difference between erc1155 and erc721 is that it can carry multiple types of FT and NFT in one contract. It can be understood as an enhanced version of the integration of erc20 and erc721. If you want to issue homogeneous and non-homogeneous tokens 1155, you can do it all without using multiple contract carriers for interaction.

Erc721 is a contract that carries class 1 NFT. Class 1 NFT carries multiple NFTs, such as boring ape. Its contract has and can only distribute a set of NFTs, each specific NFT number is different and is increasing. However, erc1155 can distribute multiple types of NFTs. Its most commonly used scenes are in games, such as a game. There may be many types of equipment, such as "weapons", "mounts" and "drugs". Some of these equipment are non-homogeneous, For example, there is only one dragon slaying sabre, and some of them are homogeneous. For example, the drugs are the same. Drink a bottle to supplement 10 drops of blood, while the traditional 721 can only distribute one type of entity, but 1155 can distribute multiple types. It's a bit abstract to say. It can be directly added to the code.

Let's demonstrate the simplest 1155 protocol contract. From top to bottom, I first created three token types: weapon WQ, Mount ZJ and gem BS, with their numbers of 0, 1 and 2 respectively.

Then I defined the maximum number of these three types of tokens as 1, 10 and 9999 respectively.

In the mint function, three parameters are passed in: address, token number and quantity. Check whether the number of token types that the current user wants to mint exceeds the maximum number of sales in turn. If not, execute the mint operation. Note here that compared with the 721 mint, the mint here passes in an ID, which is the token type defined in the 1155 protocol. Similarly, totalsupply is used in the verification process. Compared with 721, more IDs are passed in, It is also because there are multiple token types, so you need to use ID to retrieve which token type quantity you want to obtain.

6.png

We execute Mint operation, input the address, mint 2 tokens, mint100 tokens, and click Transcat to execute.

7.png

You can see that I made a balanceof query, and the token numbered 2 holds 100.

8.png

I can also transfer my tokens to others. Similarly, I need to define what kind of tokens to transfer and how many tokens to transfer. This is different from the common 721.

9.png

So far, you have understood the difference between 1155 and 721. Next, let's take a look at the contract code of Adidas. There are a lot of codes. I will pick the important ones. It doesn't matter if you don't understand the code. Please be patient and understand what the project party has done.

First, it defines the maximum number of sales of 30000, the maximum number of sales of 20380 for the pre-sale of the white list, the maximum number of mint1 for each person on the white list, and the maximum number of Mint2 for each person on the public sale.

Then, the start and end times of pre-sale and public sale are defined. Here, the timestamp definition is used.

Finally, the time of destruction window period is defined.

10.png

Then the constructor is executed, which is very interesting. The project side mints 380 automatically at the beginning.

11.png

Here we apply what we have learned. We use the reading Etherscan taught in the last article. Let's check the address.

I'm very poor. I don't have much money in my wallet.

12.png

Let's take a look at his transaction records. There are a large number of hundreds of eth transactions. The project party has no money in its own mint+ Wallet + has a large number of large transaction records, so this wallet may be a white glove.

13.pngContinue to look at the code. Here comes the mint function. It can be seen that it currently has only 1 type of tokens, so the number 0 is automatically passed in.

14.png

Interestingly, this function is used to execute during the destruction window period. First, judge the user's holding status and window period time, then execute burn to destroy the user's token, and then execute mint to create a new token for the user. Here, the cardidtomint parameter is used to control the number of rounds reached. Remember Adidas said that there were four rounds in total at the beginning.

15.pngThese two functions are used by the project side to manipulate the specific rounds of cardidtomint.

16.png

The above led us to learn erc1155 protocol through actual combat and interpretation of Adidas code. I believe we have a deeper understanding of NFT ecology. As an innovation of infrastructure, the protocol will release more upper NFT application scenarios.


Add comment:

◎Welcome to take comment to discuss this post.

Powered By Z-BlogPHP 1.7.2

Contact with:6542851@gmail.com