ZTP-1155
Simple Summary
A standard interface for contracts that manage multiple token types. A single deployed contract may include any combination of fungible tokens, non-fungible tokens or other configurations (e.g. semi-fungible tokens).
Abstract
This standard outlines a smart contract interface that can represent any number of fungible and non-fungible token types. Existing standards such as ZTP-20 require deployment of separate contracts per token type. The ZTP-721 standard’s token ID is a single non-fungible index and the group of these non-fungibles is deployed as a single contract with settings for the entire collection. In contrast, the ZTP-1155 Multi Token Standard allows for each token ID to represent a new configurable token type, which may have its own metadata, supply and other attributes.
The id
argument contained in each function’s argument set indicates a specific token or token type in a transaction.
Motivation
Tokens standards like ZTP-20 and ZTP-721 require a separate contract to be deployed for each token type or collection. This places a lot of redundant bytecode on the Ethereum blockchain and limits certain functionality by the nature of separating each token contract into its own permissioned address. With the rise of blockchain games and platforms like Enjin Coin, game developers may be creating thousands of token types, and a new type of token standard is needed to support them. However, ZTP-1155 is not specific to games and many other applications can benefit from this flexibility.
New functionality is possible with this design such as transferring multiple token types at once, saving on transaction costs. Trading (escrow / atomic swaps) of multiple tokens can be built on top of this standard and it removes the need to “approve” individual token contracts separately. It is also easy to describe and mix multiple fungible or non-fungible token types in a single contract.
Specification Token Methods
safeTransferFrom
Transfers value
amount of an id
from the from
address to the to
address specified (with safety call).
data
is an additional field with no specified format, MUST be sent unaltered in call to onZTP1155Received
on to
.
safeBatchTransferFrom
Transfers values
amount(s) of ids
from the from
address to the to
address specified (with safety call).
data
is an additional data with no specified format, MUST be sent unaltered in call to the ZTP1155TokenReceiver
hook(s) on to
.
balanceOf
Get the balance of an account's tokens for the token type requested.
balanceOfBatch
The owner's balance of the token types requested (i.e. balance for each (owner, id) pair).
setApprovalForAll
Enable or disable approval for a third party ("operator") to manage all of the caller's tokens. Returns true if the operator is approved, false to revoke approval.
isApprovedForAll
Queries the approval status of an operator for a given owner.
Last updated