Hi everyone. I'm trying to figure out a proper structure to create a dapp where:
metadata can be often changeable by the contract owner and in specific cases by the nft holder
there is the possibility to execute crons to update the metadata
As an example imagine to have nfts representing basketball players and teams. If a match is simulated by the game, then stats of the players are updated.
I don't find a proper best practice approach, my questions are:
- apart from potential high gas fees (but for this I'm imagining to deploy on polygon), is a bad practice for any other reason to pre-create all the metadata and store them in contract structs and state variables, in order to retrieve them when the NFT is minted by the user?
This would give the complete management of attribute changes (for example if a stats need to be improved, or if the age of the player needs to be updated without changing other metadata).
Second aspect, is there a way to automatically call specific contract function to update the metadata? Eg. after each season I'd like to update +1 the age of a player.
In this case, if I set a function to be onlyOwner, to avoid these calls to be done by everyone (skills upgrade, age update etc), is there a way to call via cron as if is the owner to do that in order to trigger the function correctly?