I want to store informations about ERC1155 tokens AND use it in same contract. Best way for me is get information from token metadata, but i don't know how to do this, I found only function to get token URI but i can't read informations from metadata
1 Answer
Sounds to me like this is a job for storage variables. A mapping, to be precise.
You could define a mapping that maps each token id to a struct that contains its data like this:
struct NftData {
... // Insert NFT data params here
}
mapping(uint256 => NftData) public nftData;
-
thanks, but I have 10k tokens, everyone with diffrent params, how to store it in structs? Can I put data from metadata to struct? Commented Feb 19, 2022 at 14:16