Unable to understand the ERC-1155 standard

Hello everyone,
I am quite confused with the ERC-1155 standard. Few questions for that.

  1. If we assign a baseURI in the constructor then the uri function will return that base URI for every
    tokenId passed into the function. So how can we make the tokens fungible. As there would be URI
    for every token ID.
  2. How will the wallets and exchanges know the decimals for the tokens?? Because there is no
    implementation for decimals in ERC-1155.

It is the “base” url, you append the token Id after the url so it becomes unique.

ERC-1155 is about NFT’s not about ERC-20. ERC-20 is all about using a token like a cryptocurrency as if it is money. you need decimals to tell what the exact value is. NFT’s don’t represent a value but an “object” so decimals is not relevant to it.

But ERC1155 is a multi token standard, right?


I am confused with this.

Yeah technically it’s for managing multiple tokens in 1 contract, so ERC-20 and ERC-721’s

The implementation is pretty much always used for managing multiple NFT types.

I’m not sure where your above information comes from. The specification itself doesn’t specify any ERC-20 interfaces. It is more for managing those tokens. However it is compatible with it, allowing you to implement it in such a way to interact with it as if it was one.

https://eips.ethereum.org/EIPS/eip-1155

The above information comes from Ethereum's official website.

That's what I am confused with. It is being created to manage fungible as well as non-Fungible tokens.
And ERC20 fungible tokens don't have any URI attached. So in that case I think, we don't provide any BaseURI, instead tokens would have their own URIs attached through mapping. What are your views on this??
And also ERC20 fungible tokens needs decimal to work.
Or am I getting it wrong?
Maybe the fungible tokens they are talking about, are the NFTs itself which are same having the same token ID.

You can add those interfaces of erc-20 and manage the fungible token that way.

But the eip doesn’t work as an a erc-20 in itself, it’s just providing you with an standard way so you can handle multiple different tokens like approving, getting the balance etc.

There is no problem in allowing the NFT’s you manage to not use a baseurl, it’s how most NFT’s use it.

So we can't define fungible tokens in ERC1155 contract.

You can implement it and it will work, it’s just not directly part of erc -1155.

hi

let me try to give you a better understanding about ERC1155.

(1)
the fungible token doesn't have to have a decimal with it.

think cash -- there's no 1.42 USD. or casino token -- there's no 1.42 chip (represents 1.42 USD) too.

(2)

EIP-1155:
"A standard interface for contracts that manage multiple token types. A single deployed contract may include any combination of fungible tokens, non-fungible tokens or other configurations (e.g. semi-fungible tokens)."

a contract deployed based on eip-1155 allows us to manage multiple token types -- (a) fungible token(s) "without a decimal" along with (a) non-fungible token(s) -- within one contract.

i created a "simple" ERC1155-based nft collection deployed at goerli as an illustration:

on the second txn i called mintBatch method on the contract:

mintBatch allowed us to mint "multiple" -- non-fungible token (1 id = 1 amount/quantity = ERC721) and fungible token (1 id > 1 amount). as many as we want within one transaction.

on this case (image above), i mint batch 3 ids (= token IDs) where:
id #1 is non-fungible (only 1 amount of quantity)
id #2 is fungible (10,000 amount of quantity)
id #3 is fungible (100,000,000 amount of quantity)

note:
it is a prove to show that within one contract can have multiple token types.

(3)

EIP-1155:
"In contrast, the ERC1155 Multi Token Standard allows for each token ID to represent a new configurable token type, which may have its own metadata, supply and other attributes."

since each id may have its own metadata, you can look at its opensea testnets collection page:

eg. "mfer gold token" (id #2, with total amount of supply = 10K):

note:
this is the feature that ERC20 doesn't have. where we can create a fungible token represented with a unique identifier (id) pointing to where its metadata's location (uri).

(4)

EIP-1155:
"New functionality is possible with this design such as transferring multiple token types at once, saving on transaction costs."

on the 3rd txn, i called safeBatchTransfer on the contract:

on this case (image above), i transfer batch 3 ids (= token IDs) to 1 address, where:
id #1 (total amount: 1)
id #2 (total amount: 234)
id #3 (total amount: 4,560)

note:
it is a prove that we can transfer multiple token types at once within one transaction.

hope it helps mfer.

1 Like

Really appreciate your explanation mate.
So let me get this straight, ERC1155 allows us to create fungible token but those tokens are not like ERC20 token as they all have a URI metadata, and don't have decimals.
We can just say that it makes the NFTs fungible?
We can't create tokens like USDT or DAI from this contract, which are only digits and doesn't contain any type of metadata assigned to them. Am I right??

We can just say that it makes the NFTs fungible?

yesss

We can't create tokens like USDT or DAI from this contract, which are only digits and doesn't contain any type of metadata assigned to them. Am I right??

and yesss ser

Okay, Thanks.
This was really stressing me out.

Seems like I misunderstood a part of the EIP. So indeed no ERC-20 support, but more like multiple different ERC-721’s with an additional value attached to it and allowing transfer of those values/amounts. Makes sense.

1 Like

Yeah,
We can also say adding the fungibility to NFTs. :eyes:

yeah true... that's why eip-1155 was inspired by enjin coin.

imagine with erc1155, in one nft collection (one contract), we can release some non-fungible items like the avatars/characters and we can have fungible items for the game items (swords, poisons, etc) and/or its currency.

1 Like