10000 NFTs will be produced. We have Gold, Diamond, Silver and Platinum images. There are 4 objects in metadata. Do we have to specify the number of these to be produced in the contract?
1 Answer
Yes, you will need to specify the number of each type of NFT to be produced in the contract. You can do this by defining variables for each type of NFT and setting their values to the desired number. For example:
uint256 public goldNFTs = 2500;
uint256 public diamondNFTs = 2500;
uint256 public silverNFTs = 2500;
uint256 public platinumNFTs = 2500;
You will also need to define a function for minting the NFTs that takes the type of NFT and the number to mint as arguments and updates the corresponding variable.
function mintNFT(string memory _type, uint256 _num) public {
if (_type == "gold") {
goldNFTs += _num;
} else if (_type == "diamond") {
diamondNFTs += _num;
} else if (_type == "silver") {
silverNFTs += _num;
} else if (_type == "platinum") {
platinumNFTs += _num;
}
}
Keep in mind that you will need to have some way of assigning a unique identifier to each NFT, such as using a counter that increments every time an NFT is minted.
-
-
yes, you can go to ChatGPT throw this link chat.openai.com Commented Jan 5, 2023 at 9:38