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");
}
require(
getDraftNumber(msg.sender) >= 1,
"First you need to draft for buy customized NFT"
);
require(
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);
_tokenIds.increment();
}
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.