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.

  • It is not forbidden by the EIP-721. If it makes sense is up to you.
    – Ismael
    Commented Oct 14, 2021 at 4:06

1 Answer 1


Actually, I was thinking about the same and I believe this breaks the whole concept of NFTs. IF in the real-world two contracts can point to the same apartment "asset" with two different owners, here we can have two different NFTs (2 different token_id) pointing to the same URI.

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.