tezos-commons / baseDAO

BaseDAO - a generic smart contract framework for DAOs on Tezos
57 stars 15 forks source link

[#240] Support TZIP-21 in the generated contract metadata #310

Closed rinn7e closed 2 years ago

rinn7e commented 3 years ago

Description

Problem: There is a new TZIP-21 which is an extension of TZIP-16 that we should support.

Solution: Add support for TZIP-21.

Related issue(s)

Resolves #240

:white_check_mark: Checklist for your Pull Request

Related changes (conditional)

Stylistic guide (mandatory)

rinn7e commented 3 years ago

@pasqu4le From what I understand TZIP-21 is an extension of TZIP-12 and TZIP-16. Basically it provides extra information about the tokens (call asset in the docs) in the contract.

Since our contract is TZIP-16 compliance only, I added a fields assets containing some info about the frozen token.

If provided at the contract metadata level, to prevent pollution in the top level of the metadata, content should be provided as a nested object under the key assets.

I only added description and creators field for now for the frozen token asset. Let me know if I should add more.

One confusion that I have is that, it seems like TZIP-21 targets contract that is either an FA2 token contract or a contract that manages FA2 tokens. Since we only have frozen token which is more like a special kind of token (cannot be transfer or mint), I'm not sure if it make sense to support TZIP-21. Probably the need for support would be on the governance contract instead. Hope to get your view on this.

pasqu4le commented 3 years ago

@rinn7e AFAICT TZIP-21 is a specification that extends TZIP-16 for any token's metadata.

It has been clearly written with FA2/TZIP-12 in mind (which makes sense, given that this is a token standard), but it doesn't seem to require that and can be used for any token (in fact, it also mentions FA1.2 ones).

Here in baseDAO, the main tokens (contained withing the contract itself) are frozen tokens, so we want to have metadata for those.

Following the Base Token Metadata Standard section we need to have fields for:

  1. name or symbol or both (but at least one of them)
  2. decimals

I suggest going with name for point number 1.

frozen tokens are also fungible, so following the Fungible Token Recommendations section, we should also add, if possible:

Note: for thumbnailUri I think we should ask on the shared slack channel, as some graphic already exist and this may very well have been uploaded to a fixed location already.

AFAIK these fields should cover everything we need (I see you added more that seem incorrect to me as they are about NFTs or other kinds of tokens, but I may be wrong).

I noticed you added an assets sub-field too, but that doesn't seem to be needed, as per documentation:

Properties of the asset object are designed to live at the root level of the token metadata, or as an object array under the key assets. at the contract metadata level.

we only have one "asset" here, so there is no need for an array of them and instead we can use the root of the JSON instead (as you did for some fields already).