0

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
  • Please don't, we have enough 10,000 NFT projects lol Commented Jan 4, 2023 at 16:25

1 Answer 1

0

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.

2
  • Is this chatGPT? Pretty much looks like it... Commented Jan 5, 2023 at 9:22
  • yes, you can go to ChatGPT throw this link chat.openai.com Commented Jan 5, 2023 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.