I'm developing a contract to manage multiple NFTs. The contract is an instance of ERC721, which manages some common attributes for every NFT.
Which could be the most efficient way to do it?
Option 1: Different mappings for each attribute.
mapping (uint256 => address) private _attribute1;
mapping (uint256 => uint256) private _attribute2;
mapping (uint256 => uint256) private _attribute3;
mapping (uint256 => uint256) private _attribute4;
mapping (uint256 => uint256) private _attribute5;
Option 2: One Struct and one mapping to store the structs.
struct ItemDetails {
address _attribute1;
uint256 _attribute2;
uint256 _attribute3;
uint256 _attribute4;
uint256 _attribute5;
}
mapping (uint256 => ItemDetails) private _itemDetailsMap;