ERC-6960 Dual Layer Token (DLT) (Dual Layer Token)

Draft · NFTs & multi-token · created 2023-04-30

A standard that classifies and manages tokens within a single contract using two levels: mainId (the main asset type) and subId (detailed attributes or variants). It allows assets that need fine-grained distinctions, such as fractional ownership of real-world assets, to be handled systematically.

Why it is needed

The existing multi-token standard ERC-1155 is widely used in the Ethereum ecosystem, but it has design limitations when a token requires multiple levels of classification. This is especially true when tokenizing real-world assets (RWA) and splitting their ownership into multiple pieces. For example, assets such as invoices, company shares, digital collectibles, and real estate have multiple detailed items with different attributes under one broad category, and a single-level ID makes it difficult to organize and capture this structure. This standard proposes introducing a two-level classification consisting of mainId, which points to the main asset, and subId, which points to the detailed items beneath it, so that token types can be organized and tracked in finer detail. It also allows fungible and non-fungible assets to be managed together within the same contract.

What to implement

In depth

The dual classification structure of mainId and subId

This standard combines the functionality of ERC-20, ERC-721, and ERC-1155 while adding one more classification layer. mainId is the identifier for the main asset type, and subId points to the unique attributes or variants of that main asset. Because one main asset (layer 1) is divided into multiple sub-assets (layer 2), the name is also dual layer. For each account, the mainBalance of the main asset and the subBalance of the sub-assets can be tracked separately. The original text cites invoices, company shares, digital collectibles, and real estate as examples of assets whose fractional ownership can be expressed with this structure. The subId operation method can be extended in two ways: the Shared SubIds method, in which all mainIds share the same set of subIds, and the Mixed SubIds method, in which each mainId has its own unique set of subIds.

Transfer rules and events

safeTransferFrom moves an amount of the sender's tokens to the recipient using the allowance mechanism, and deducts that amount from the caller's allowance. It MUST revert if the sender or recipient is the zero address, and it MUST revert if the holder's balance for the relevant subId is less than the amount being sent. On success, it MUST emit a Transfer event, and the return value reports success as a bool. When a batch transfer occurs, a TransferBatch event MUST be emitted. The data parameter is additional data with no fixed format. Requirement-level terms such as MUST and SHOULD in the specification follow the definitions in RFC 2119 and RFC 8174.

Two kinds of approval systems

Approval is split into two levels. approve sets the quantity limit that an operator can use for a specific (mainId, subId) combination. The operator must not be the caller itself; it MUST revert if the operator is the zero address, and it MUST emit an Approval event on success. setApprovalForAll grants or revokes transfer rights over all of the caller's subId tokens to an operator as a whole, and MUST emit an ApprovalForAll event. The remaining limit is queried via allowance, which changes when approve or transferFrom is called and defaults to 0. Overall approval status is checked via isApprovedForAll.

Balance query functions

subBalanceOf returns the quantity of tokens held by a specific account for a given mainId and subId combination. balanceOfBatch takes an array of accounts, an array of mainIds, and an array of subIds, and returns multiple balances as an array in a single call. The reference implementation stores balances using a nested mapping of the form mapping(uint256 mainId => mapping(address => mapping(uint256 subId => uint256))), allowing any (account, mainId, subId) combination to be looked up in O(1). Allowances are stored using the same pattern with an additional spender dimension.

The receiving contract interface DLTReceiver

For a smart contract to receive transfers under this standard, it MUST implement all functions of the DLTReceiver interface. When tokens are transferred to a contract via safeTransferFrom, onDLTReceived is called for a single transfer and onDLTBatchReceived is called for a batch transfer. Both functions MUST return their own Solidity selector to confirm the transfer, and it MUST revert if a different value is returned or if the recipient does not implement the interface. The selector can be obtained in Solidity as IDLTReceiver.onDLTReceived.selector. This mechanism prevents tokens from getting stuck in a contract that cannot handle them.

Metadata URI event

Metadata for each main asset type is announced via a URI event. When the URI of a specific mainId is updated, a URI event containing the previous value (oldValue), the new value (newValue), and the corresponding mainId MUST be emitted. The URI follows the format defined in RFC 3986 and must point to a JSON file conforming to the DLT Metadata URI JSON Schema. The fact that metadata is grouped by mainId rather than by subId is the part that aligns with this standard's classification structure.

Design decisions: why two levels and why an independent implementation

The original Rationale section addresses three design questions. First, why classification is limited to two levels: the implementation tracks the total supply of each sub-asset via a mapping, and if sub-assets were allowed to have children of their own, additional methods would be needed to track each sub-asset, which would be impractical and would complicate the contract. Second, why ERC-1155 was not extended: ERC-1155 was not designed to support hierarchical classification and would require substantial modification, so an independent implementation was judged more suitable than an extension. Third, the name was chosen as Dual Layer Token to reflect the hierarchical structure in which a main asset is divided into multiple sub-assets. The text states that no backward-compatibility issues were found.

Proposal status: Draft

This proposal is still in Draft status, meaning its content may change and it is not yet a finalized standard. The original text provides a reference implementation consisting of the IDLT and IDLTReceiver interfaces and the core token contract DLT.sol, along with a test suite covering minting and burning, batch transfers, approval flows, zero-address validation, and the unlimited approval pattern using type(uint256).max.

Things to watch out for

Original ERC · ← ERCs