I'm working on a smart contract which allows a caller to "purchase" an NFT simply by calling the contract and providing payment. I'd like the contract to mint the NFT at the time the contract is called and would like to set the NFT metadata based on certain info such as the time of day the contract is called, etc.
The way I see this working is roughly like this:
- A contract w/ FA2 implementation exists, and the base metadata is set for the collection of NFTs (it's a set of collectibles with semi-randomized attributes)
- The collection would have a set amount and sales would stop after that amount is reached
- A purchaser sends the purchase price to the contract, and depending on the current timestamp, one of the collectibles is minted and some attributes set that are based off of the current time
I see plenty of simple NFT examples, but they all seem to assume that an administrator of the contract would create the tokens via an admin call and then they would be sold or auctioned, which is not the way I want to set this up. This won't work since I want some part of the metadata to be dynamic based on when the NFT was minted by the purchaser.
Are there any examples using Smartpy that show how this might be implemented?