1

What is the best way to implement a FA1.2 token with TZIP-016 metadata (symbol, name, decimals...)? I am using SmartPy. So far, I noted two methods: the first one is to implement a FA1.2 token with a json metadata such as

{
  "name": "mytoken",
  "description": "This is constructed just to be an example to be put on IPFS.\nAt the time of writing, the TZIP is now at `30b4bd3` a.k.a. “WIP-TZIP-16: Mention future work & extensions.”",
  "version": "0.42",
  "decimals": 42,
  "symbol": "AAAA",
  "interfaces": [
    "TZIP-16 draft"
  ]
}

By there is also a method where people: Implement a FA2 token that generates the desired FA1.2 token with a method called :

make_metadata(symbol, name, decimals):
    "Helper function to build metadata JSON bytes values."
     return (sp.map(l = {
        # Remember that michelson wants map already in ordered
        "decimals" : sp.bytes_of_string("%d" % decimals),
        "name" : sp.bytes_of_string(name),
        "symbol" : sp.bytes_of_string(symbol)
     }))

What is the best method?

0

The FA1.2 template was updated this week by Keefer Taylor. It will be updated in https://smartpy.io templates this weekend.

Template link: https://smartpy.io/ide?cid=Qma5v9x6xjbzB82hjhr5Y5Sw2oppRzhyNBN11eVVyXpvxv&k=ea98e1d25d85d92f75c7

Here is an example after deployment: https://tzcomet.io/#/explorer%3Fexplorer-input%3DKT1RbbpEXYbjJx3pB5QxsCrcoBthXa3vMLoa

You can use the sp.init_metadata helper to generate valid metadata to be used off-chain or encoded to bytes and stored in the contract storage. https://smartpy.io/reference.html#_metadata_support

This thread contains a guide for that: Why aren't the offchain views appearing?

1
  • This work is not finished (and probably shouldn't be used like that). Some better template will be provided eventually. – FFF Apr 16 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.