I have the following scenario:
- An HTML NFT that can read url parameters hosted in IPFS
- A set of static traits for the NFT
I need to be able to set the static traits during mint and also pass optional parameters to the tokenURI when the tokenURI method is called.
If I don't include static traits I can simply construct the metadata on the fly as name and description remain largely the same and simply concatenate the url paramter at the end of the IPFS url and then return it.
I cannot find a way to do both because:
- I need to read the traits string from somewhere and then construct the metadata on the fly as outside world without oracles is not possible
- I cannot read the contents of the IPFS hosted json when inside contract(without an oracle) and then add the url parameter at the end of the url pointing to the html.
I thought about storing all the traits in the contract but that can be expensive. How expensive though I don't know. In all likelihood it would be cost-prohibitive but for the sake of argument, how much would it cost to deploy a contract with a mapping(string => uint) of 2000 entries and the string being around 50 characters?
Another solution I thought was to use an oracle to read the traits json during mint and then store the json string to the mapping so that I can construct the metadata on the fly in tokeURI method. That would increase the mint gas cost though.
Is there a way to edit the IPFS retrieved JSON metadata on the fly so I can pass the parameter?
Any other solution I missing?