This is a question about ERC-721 contract. NFTs needs to be unique to a specific wallet. But in my contract _tokenURIs variable stores IPFS address with tokenIDs. Here is my function

    function buyCustomizedNFT(string memory uri) public payable {
        if (totalSupply() != 0) {
            require(_uriToTokenId[uri] != 0, "NONO YOU CANT");
            getDraftNumber(msg.sender) >= 1,
            "First you need to draft for buy customized NFT"
            totalSupply().add(1) <= MAX_SUPPLY,
            "Sales is already ended for this amount"
        require(nftPrices[uri] != 0, "Unrecognized token price");
        require(nftPrices[uri] == msg.value, "Invalid AVAX value");
        uint256 newTokenID = _tokenIds.current();
        draftAmounts[msg.sender] = draftAmounts[msg.sender] - 1;
        _safeMint(msg.sender, newTokenID);
        _setTokenURI(newTokenID, uri);
        // _setUriToTokenId(uri, newTokenID);

In this function contract mint the token with given uri and adds mapping. But if two different users enters the same uri. Is this situation acceptable? For get rid of this situation I created a new mapping for uriToTokenId. This mapping goes uri to tokenId so I can easily check this uri refers to another tokenID. Should I do this checking or is it okey with same IPFS address for multiple tokenIDs.

New contributor
MehmetBerat is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • It is not forbidden by the EIP-721. If it makes sense is up to you.
    – Ismael
    Oct 14 at 4:06

Your Answer

MehmetBerat is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.