I am quite confused with the ERC-1155 standard. Few questions for that.
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.
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.
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.
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.
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.
"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)
it is a prove to show that within one contract can have multiple token types.
"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):
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).
"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:
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??
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.
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.