I’ve been thinking about the best way to implement an NFT (ERC 721) equivalent on Libra. A requirement would be that an account should be able to own multiple NFTs from the same module. The NFT has unique properties associated with it. For the sake of simplicity lets just say that each NFT that’s created could hold a random integer, and each NFT must have a unique ID in order to be distinguishable from the other NFTs (in case there are multiple with the same property values).
The resource within the account would need to store a mapping of IDs of the NFTs owned to the properties of the owned NFT.
Based on my (still developing) knowledge of the MVM, one way this is possible would be to define a resource, let’s call it NFToken, that maintains a value of type bytes. This value would be a serialized byte array of a JSON object that contains the mapping of the NFToken ID to the property values.
While this may be a possible, it would require a lot of effort without JSON support builtins. Even with JSON support builtins, it would probably be an extremely expensive transaction to deserialize, update JSON, and serialize.
Since an account can’t own multiple of the same resource, it makes a NFT implementation a bit more complicated.
Am I over complicating this? Is there some sort of wrapper implementation that I haven’t thought about that would handle this?