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 1


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?
    – Blendered
    Feb 19, 2022 at 14:16

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.