原文标题:《 ERC1155 是什么?以阿迪达斯 NFT 为例解析 》
Do you understand the world a little better today
This article is from wechat official account:Did you understand the world a little better today
The three standard protocols, ERC20, ERC721 (derived FROM ERC721A), and ERC1155, have been introduced and practiced in previous articles. However, the third protocol, 1155, has not been given a good example. Just yesterday, some friends wondered why adidas NFT has only one item but 30,000 people hold it. After studying it, they thought it was a good example, so I write this article to explain what ERC1155 is.
Let's have a look at the adidas NFT is what circumstance, opensea url is as follows: https://opensea.io/collection/adidasoriginals.
We go in and we see that there's only one NFT, but there's 20,000 people holding it, so subconsciously you might guess it's a shared NFT, right? Or fragmented NFT?

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

Further down you can see that there are many holders, and prices vary.

When we click buy, we can find that 1.499ETH is required, which is the lowest price of all invoice prices.

And you're going to feel like it does look a little bit different than the usual NFT, weird.
The Token Id is 0. As we all know, most NFT toklen ids are increments. If I issued 10,000 NFT, the Id should be increments from 0 to 10,000, but Adidas issued 30,000. Why is there only one NFT with ID 0, when there should be 30,000 NFT with ID increasing to 30,000?
The protocol is ERC1155. This is where you might find yourself uploading NFT using protocol 1155.

There must be a reason why Adidas uses such an unusual NFT agreement, so let's continue to follow the story and take a look at the introduction of adidas' NFT on its official website.
The Adidas NFT is divided into four phases. Phases 1, 2, and 3 all involve the destruction and exchange operation. The fourth phase gives you an ERC721NFT.

Then we deduction, adidas in the next happens, through the game using the four stages, in the form of layers of a strange collection, destruction, exchange process, improve everyone's participation and brand influence, so the key here is "destroyed", if the 30000 hands of NFT will be destroyed, that means the NFT tool attribute is very strong, There can be no difference. From this point of view, the common ERC721 issuing non-homogeneous Token protocol does not seem to be applicable.
ERC1155 seems to be more suitable. Let's first have a brief understanding of what ERC1155 is, and then see what Adidas has done in the contract.
ERC1155 相比于 ERC721 简而言之最大的区别就是它可以一个合约承载多类 FT 与 NFT,可以将其理解为是 ERC20 和 ERC721 的融合加强版,想发行同质化和非同质化的 Token 1155 全部搞定,而不用用多个合约承载再进行交互。
ERC721 is a contract that carries class 1 NFT, and class 1 NFT carries multiple NFT, such as the Boring Ape. Its contract has and can only issue a set of NFT for the boring Ape. Each specific NFT number is different and increasing, but ERC1155 can issue multiple NFT in one contract. It the most common scene in the game, such as a game, there may be many types of equipment, such as "weapons", "mount", "drug", etc., some of these equipment are homogeneous, such as slew a nod to only one, have a plenty of homogeneity such as drugs are the same drink a bottle of 10 drop of blood, and the traditional 721 issued only a kind of entity, However, 1155 can publish multiple classes, which is a bit abstract, right?
我们来演示一个最简单的 1155 协议合约,自上而下,我先创建了 3 种 Token 类型分别为武器 wq、坐骑 zj 和宝石 bs,他们的编号分别为 0、1、2。
然后我定义这三类 Token 的发售最大数量分别为 1、10 和 9999。
在 mint 函数中,传入三个参数分别为地址、 Token 编号和数量,依次校验当前用户要 mint 的 Token 类型数量是否超过了最大发售数,若未超过则执行 mint 操作,这里大家注意,相比 721 的 mint 这里的 mint 多传入了一个 id,这个 id 即 1155 协议中定义的 Token 类型,同样的在校验的过程中用到了 totalSupply 相比如 721 多传入了 id,也是因为有多个 Token 类型,所以需要用 id 来检索到底要获取的是哪一个 Token 类型的数量。

我们执行 mint 操作,输入地址,mint 编号为 2 的 Token ,mint100 个出来,点击 transcat 执行。

可以看到我进行 balanceOf 查询编号为 2 的 Token 持有 100 个。

我也可以将我的 Token 转移给其他人,同样的需要定义转移的哪一类,以及转移多少个,这和常见的 721 都是不一样的。

Now 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 and I will highlight the important ones.
First of all, it defines the maximum sale of 30,000, the maximum sale of 20380 white list pre-sale, the maximum number of MINT1 per person white list, the maximum number of minT2 per person public sale.
Then it defines the start and end time of presale and public sale, using the timestamp definition here.
Finally, the time of destroying the window period is defined.

And then it executes the constructor, and it's kind of interesting here that the project gives itself 380 automint at the beginning.

Let's apply what we've learned to etherScan and check out this address.
Pretty poor guy with no money in his wallet.

Take a look at his transaction record, there are a large number of ETH flows, often tens or hundreds of ETH flows, the project owner has no money in his mint+ wallet + a large number of transaction records, so the wallet may be a white glove.

继续看代码,这里到了 mint 函数,可见它目前只有 1 类 Token 所以自动传入了编号 0。

有趣的来了,这个函数是用来在销毁窗口期执行的,首先判断用户持有情况和窗口期时间,然后先执行 burn 销毁用户 Token ,再执行 mint 给用户新创建 Token 出来,这里用到了 cardIdToMint 这个参数用来管控到达了第几轮,还记得一开始阿迪达斯说总共有 4 轮吗。

These two functions are used by the project side to control the specific rounds of cardIdToMint.

We have learned ERC1155 protocol through actual practice and interpretation of Adidas code. We believe that we have a deeper understanding of NFT ecology. The innovation of protocol as infrastructure will release more application scenarios of upper NFT.
You can pay attention to my public number "today have a little more understand this world & NBSP;" Check out previous posts for more in-depth discussions, or follow me on Twitter: Jason_chen998 & NBSP;
The original link
Welcome to join the official BlockBeats community:
Telegram Subscription Group: https://t.me/theblockbeats
Telegram Discussion Group: https://t.me/BlockBeats_App
Official Twitter Account: https://twitter.com/BlockBeatsAsia