I'm trying to understand how ERC721 CID url's work.
How can i use the same CID url multiple times such as
QmXgSuLPGuxxRuAana7JdoWmaS25oAcXv3x2pYMN9kVfg3/1
QmXgSuLPGuxxRuAana7JdoWmaS25oAcXv3x2pYMN9kVfg3/2
QmXgSuLPGuxxRuAana7JdoWmaS25oAcXv3x2pYMN9kVfg3/3
etc?
Do i have to do this in the same instance call, or how can i reuse the CID?
Thanks
maxareo
September 2, 2021, 12:55pm
2
There is not built-in mechanism checking duplication of IPFS CIDs, however, you can add a mapping and a function to check for duplication, or any logic you'd like to impose on CIDs.
Not sure i understand your reply. I'm trying to reuse the CID
maxareo
September 4, 2021, 10:25am
4
I mean ERC721 does not have a built-in mechanism checking CIDs. Instead, you may want to add the following code in your ERC721 contract.
mapping(string => uint256) _CIDUsage;
function usageIncrement(string memory CID) internal {
_CIDUsage[CID] += 1;
}
function getCIDUsage(string memory CID) public view returns (uint256) {
return _CIDUsage[CID];
}
It will allow you to put restrictions on CID usage, like duplication
, or maxNumberOfDup
, etc.