ERC-6960 · Draft · ERC · 2023-04-30
ERC-6960: Dual Layer Token
Draft multi-token standard where every balance is addressed by a mainId (asset) and a subId (its variant or fraction), aimed at tokenizing real-world assets like invoices or property.
What problem does it solve?
ERC-1155 lets one contract hold many token types, each with a single id. Real-world assets often need a second level: one invoice, building or share class (the asset) split into many pieces with their own attributes (the sub-assets). Encoding both into one id works, but makes balances, approvals and tracking awkward.
ERC-6960, the Dual Layer Token (DLT), makes this explicit: every token is identified by a pair (mainId, subId). The authors target fractional ownership of invoices, company stock, collectibles and real estate.
How it works
mainIdnames the main asset type;subIdnames a variation, tranche or fraction within it.- Balances are per
(account, mainId, subId):subBalanceOf(account, mainId, subId)and the batch formbalanceOfBatch(accounts, mainIds, subIds). - Approvals come in two forms:
approve(operator, mainId, subId, amount)withallowance(owner, operator, mainId, subId), an ERC-20-style allowance on one sub-token.setApprovalForAll(operator, approved): full operator rights over everything.
- Transfers use
safeTransferFrom(sender, recipient, mainId, subId, amount, data). It must revert on zero addresses or insufficient balance and emitsTransfer(sender, recipient, mainId, subId, amount). - A contract recipient must implement
IDLTReceiver(onDLTReceived,onDLTBatchReceived) and return the function selector, like ERC-1155 receivers. URI(oldValue, newValue, mainId)is emitted when metadata for a main asset changes.
The design can share one set of subIds across all mainIds, or give each mainId its own. Deeper hierarchies were deliberately rejected to keep supply tracking simple. It is a standalone interface, not an extension of ERC-1155.
Sample code
Receiving DLT tokens in a contract and reading a balance:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IDLT {
function subBalanceOf(address account, uint256 mainId, uint256 subId) external view returns (uint256);
}
interface IDLTReceiver {
function onDLTReceived(address, address, uint256, uint256, uint256, bytes calldata) external returns (bytes4);
function onDLTBatchReceived(address, address, uint256[] calldata, uint256[] calldata, uint256[] calldata, bytes calldata)
external returns (bytes4);
}
contract InvoiceVault is IDLTReceiver {
IDLT public immutable dlt;
constructor(IDLT d) { dlt = d; }
function onDLTReceived(address, address, uint256, uint256, uint256, bytes calldata)
external pure returns (bytes4) { return IDLTReceiver.onDLTReceived.selector; }
function onDLTBatchReceived(address, address, uint256[] calldata, uint256[] calldata, uint256[] calldata, bytes calldata)
external pure returns (bytes4) { return IDLTReceiver.onDLTBatchReceived.selector; }
/// e.g. mainId = invoice #42, subId = the 30-day tranche
function held(uint256 mainId, uint256 subId) external view returns (uint256) {
return dlt.subBalanceOf(address(this), mainId, subId);
}
}
Things to know
- Status is Draft: names and signatures may still change.
- Not compatible with ERC-1155 tooling; wallets and marketplaces need DLT-specific support.
- The per-sub-token allowance has the same approve/transferFrom race condition as ERC-20; prefer increase/decrease helpers or reset to zero first.
- Batch operations loop over caller-supplied arrays and can run out of gas if they are too long.
- Summing many sub-balances into a main-asset total can overflow; the reference implementation tracks main balances separately.
- For a related "slot plus value" model, see ERC-3525.