growl
February 11, 2022, 8:25pm
1
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?
MattMcP
February 11, 2022, 11:07pm
2
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.
growl
February 11, 2022, 11:32pm
3
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.
MattMcP
February 11, 2022, 11:36pm
4
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.
growl
February 11, 2022, 11:38pm
5
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)
growl
February 11, 2022, 11:39pm
6
Okay reading better you say:
New collection require an URI so I can mint a new collection with a new URI. Right?
MattMcP
February 11, 2022, 11:39pm
7
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);
}
MattMcP
February 11, 2022, 11:41pm
8
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
growl
February 11, 2022, 11:41pm
9
Oh that's fantastic, thank you!
Can you please link me where I can learn all this stuff?
MattMcP
February 11, 2022, 11:44pm
10
There is many tutorials within these forums, you would have to look though.
All the best
1 Like