Implementing a mini token contract with on-chain callbacks (TZIP-12)

Learn how to implement, test, deploy and extend a simplified token contract following the interface proposed in TZIP-12.

Article by https://stove-labs.com

A video 📹 walkthrough of this article is available on YouTube as part of the Tezos Dev Day 2020, you can find it here.

Understanding the TZIP-12 standard proposal

TZIP-12 (FA2) is a new iteration of the original FA1 token standard, that was built with the idea of porting ERC-20 to Tezos. At Stove Labs, we drafted an ERC-721-like contract interface for Tezos as the base ground for the Tezos Hunt.

A natural evolution of those two efforts, is the TZIP-12 standard proposal which is inspired from the ERC-1155 standard, combining both ERC-20 & ERC-721 into a unified contract interface.

TZIP-12 is being proposed & actively worked on by the Tocqueville Group, at Stove Labs we’re working on one of the reference implementations using LIGO.

Features that are provided out of the box

The TZIP-12 standard proposal describes a token contract that can store more than a single type of a token, where the token itself is identified by a token_id .

Single feature thats already implemented in our tutorial contract, is the token transfer — it allows the token owner to transfer his very own tokens to someone else. Interface for the transfer, including entry-points and their respective type signatures are specified as the following: