Referring to the documents and examples of tzip-16, how would one implement the contract metadata on a Fa1.2 contract on SmartPy? In order to provide balance updates and offchain events.
2 Answers
TZip16 uses a two stage approach:
link to an external document. This is shown here: https://smartpy.io/dev/index.html?template=metadata.py https://smartpy.io/dev/reference.html#_metadata_support
implementation of the document which may contain views or events. No support from SmartPy as of today. You can use SmartPy to derive the Michelson in question but no specific support.
For the specific case of the FA1.2, we will probably simply add the metadata
field.
There is no way, to implement tzip-16 on an already originated smart contract unless the contract was originally designed for this purpose, because:
- Tzip-16 requires
(big_map %metadata string bytes)
field in the contract storage . - You can't change the storage structure of an already originated contract.