--- title: Learning about token standards tags: views --- # Knowlege - Learning about Token standards ## Standard tokens in Tezos FA1.2 and FA2 are standards token in Tezos. Token standards are a set of rules that ensure smooth interactions between different contracts operating with tokens. Token standards in Tezos are described in the Tezos Interoperability Proposal (TZIP) documents. Among other TZIPs, token standards are identified as Financial Applications (FA). There are 3 version of FA Tezos token standards: - FA1 ([TZIP 5](https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-5/tzip-5.md) Abstract Ledger), this is already deprecated. - FA1.2 ([TZIP 7](https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-7/tzip-7.md) Approvable Ledger) - FA2 ([TZIP 012](https://gitlab.com/tezos/tzip/-/blob/master/proposals/tzip-12/tzip-12.md) Multi-Asset Interface) ### FA1 - Abstract Ledger Main purpose was to: - map identities to balances - provide interactions with fungible assets for contract developers, libraries, client tools, etc. For FA1, parameter should contain the following leaves: ![](https://hackmd.io/_uploads/HkLsUI2ko.png) So this standard has **views**: getBalance, getTotalSupply Example: ![](https://hackmd.io/_uploads/SyI7OUhyj.png) **NOTE**: the view terminology here is a callback views, it is different than an on-chain views. ### FA1.2 - Approvable Ledger FA1.2 refers to an [ERC20](https://eips.ethereum.org/EIPS/eip-20)-like fungible[^1]. [^1]: 3 common types: Fungible (equal to each other, can be used as currency). Semi-fungible (unique, although they might seem to be similar and even have the same cost0, non-fungible (NFT, completely unique and non-interchangable tokenized objects) The key of this standard is: - the ability to approve the spending of tokens from other accounts. - This standard can **only be used** for <u>fungible tokens</u> Implementation: - You **must include all** the following entry points in its interface. 2 regular methods and 3 views methods: ![](https://hackmd.io/_uploads/rkXD9vn1j.png) FA1.2 allow developers extending the token contract with additional functionality. For example, this [SmartPy template contract](https://smartpy.io/releases/20210212-2affd5164a82b2238c9ee9593cf2a03a58bec979/ide?template=FA1.2.py) has additional [entry point](https://tezos.gitlab.io/active/michelson.html#entrypoints) for: minting, burning tokens, governance management, etc. Limitations (mentions only views, a full list can be found at [this article](https://story.madfish.solutions/do-we-need-a-new-tezos-token-standard/)): - View methods are just the methods that return operations (fake views: views are methods with callback) ### FA2 - Multi-Asset Interface It is not a direct heir of FA1.2. Specification: - FA2 supports multiple assets. - Token transfer permissions in FA2: - permission can be granted using the **update_operators** entry point. - an **operator** is an address that can create transactions on behalf of the owner (whose address already stores tokens). - The interface includes the following necessary entry points: ![](https://hackmd.io/_uploads/SkmY1d2yo.png) Limitations: - View methods are just the methods that return operations (fake views: views are methods with callback). - There are no views for supply metrics Question: - Then what is the true views? (True views is integrate it in a new token standard but integrating it into the existing infrastructure seems to be too tricky) <!-- Contract Metadata (TZIP-016) with `views` **field is optional**, it is an off-chain-views. It has 5 optional views: get_balance, total_supply, all_tokens, is_operator, and token_metadata. Several backwards-compatible TZIP-012: - Views and Events: - Extending TZIP-012 to include on-chain view (and removeal of balance_of). Reduce complexity of off-chain views and events. --> ### Summary ![](https://hackmd.io/_uploads/rJBCydnJj.png) ![](https://hackmd.io/_uploads/H1KWZd3Ji.png) ## Links to this doc - [Knowledge about token](https://www.apriorit.com/dev-blog/756-blockchain-tezos-token-standards)