ERC 1155 - create new items after the contract has been deployed

Hi!
There is a way to create "new items" after the contract has been deployed?

When you develop an online game you need to add new items in the various season so you can't have them ready when you deploy the contract .

There is a way to do that? Or should I use the ERC721 for every new item I want to put into the game and make it mintable?

Unless you actually set a limit, the amount of token_id's is only limited to the integer.

For example if your wanted to set a limit of say 4 collections with max supplies of 100

uint256[] public NFTsAvaliable = [100, 100 ,100, 100];

.......

        require(_token_id<= NFTsAvaliable .length, "This collection does not exist");
        require(_minted_amount<= NFTsAvaliable [_token_id], "Already reached maximum supply");

Otherwise there is no limit beyond the scope of the variable.

So I can add new collections after the deployment of the contract?

Sorry but I'm new to smart contracts, I was just seeing the tutorials on here and searched for some answer.

Yes using the ERC1155 just out of the box as found listed in the Open Zeppelins Contracts.

Allows you to mint as many NFT collections (token_id)
These collections are all linked to individual URIs

Each URI holds the metadata containing the image and information.
Therefor each token_id can be different.
Of which you can mint many from.

But the problem is: I can't change the URI right? So in the URI should be also the metadata of the future seasons (that obviously I don't have at the moment)

Okay reading better you say:

New collection require an URI so I can mint a new collection with a new URI. Right?

You can indeed change the URI as there is a function that does that.
You can actually just mint without the URI and later change it when the ERC1155 is minted.

    function f_setURI(string memory newuri) external onlyOwner {
        _setURI(newuri);
    }

Yes

Because when you mint

_mint (msg.sender, _token_id, _howManytoMint, "");

Each token_id has a URI

You will see this in the docs as

https://Yourwebsite.io/{id}.json

Oh that's fantastic, thank you!

Can you please link me where I can learn all this stuff?

There is many tutorials within these forums, you would have to look though.

All the best

1 Like