---
eip: 6960
label: ERC-6960
title: Dual Layer Token
status: Draft
type: Standards Track
category: ERC
created: 2023-04-30
official: https://eips.ethereum.org/EIPS/eip-6960
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-6960.md
canonical: https://eips.huatuo.xyz/ko/eip-6960/
lang: ko
tldr: 모든 잔액을 mainId(자산)와 subId(그 변형이나 지분)로 지정하는 멀티 토큰 표준 초안. 청구서나 부동산 같은 실물 자산의 토큰화를 목표로 한다.
tags: [token, multi-token, rwa, fractional, standard]
---

# ERC-6960: Dual Layer Token

> Token with a two-level classification system using mainId and subId

**TL;DR:** 모든 잔액을 mainId(자산)와 subId(그 변형이나 지분)로 지정하는 멀티 토큰 표준 초안. 청구서나 부동산 같은 실물 자산의 토큰화를 목표로 한다.

## 어떤 문제를 해결하나요?

[ERC-1155](/eip-1155/)는 컨트랙트 하나에 여러 토큰 종류를 담을 수 있지만, 각각 `id`가 하나뿐입니다. 실물 자산에는 두 번째 계층이 필요한 경우가 많습니다. 청구서 한 장, 건물 한 채, 주식 종류 하나(자산)가 각자 속성을 가진 여러 조각(하위 자산)으로 나뉘는 경우입니다. 둘을 하나의 `id`에 인코딩할 수도 있지만, 잔액, 승인, 추적이 불편해집니다.

ERC-6960의 **Dual Layer Token(DLT)**은 이를 명시적으로 만듭니다. 모든 토큰은 `(mainId, subId)` 쌍으로 식별됩니다. 저자들은 청구서, 회사 주식, 수집품, 부동산의 분할 소유를 대상으로 합니다.

## 어떻게 동작하나요?

- **`mainId`**는 주 자산 종류를, **`subId`**는 그 안의 변형, 트랜치, 지분을 나타냅니다.
- 잔액은 `(account, mainId, subId)`별로 관리됩니다. `subBalanceOf(account, mainId, subId)`와 배치 형태인 `balanceOfBatch(accounts, mainIds, subIds)`가 있습니다.
- 승인은 두 가지 형태가 있습니다.
  - `approve(operator, mainId, subId, amount)`와 `allowance(owner, operator, mainId, subId)`. 하위 토큰 하나에 대한 ERC-20 방식의 allowance입니다.
  - `setApprovalForAll(operator, approved)`: 모든 것에 대한 전체 오퍼레이터 권한.
- 전송은 `safeTransferFrom(sender, recipient, mainId, subId, amount, data)`를 사용합니다. 제로 주소이거나 잔액이 부족하면 반드시 revert해야 하며, `Transfer(sender, recipient, mainId, subId, amount)`를 emit합니다.
- 컨트랙트 수신자는 `IDLTReceiver`(`onDLTReceived`, `onDLTBatchReceived`)를 구현하고 ERC-1155 수신자처럼 함수 셀렉터를 반환해야 합니다.
- 주 자산의 메타데이터가 바뀌면 `URI(oldValue, newValue, mainId)`가 emit됩니다.

설계상 모든 mainId가 subId 한 세트를 공유하게 할 수도 있고, mainId마다 자기만의 subId를 갖게 할 수도 있습니다. 공급량 추적을 단순하게 유지하기 위해 더 깊은 계층 구조는 의도적으로 채택되지 않았습니다. ERC-1155의 확장이 아니라 독립된 인터페이스입니다.

## 샘플 코드

컨트랙트에서 DLT 토큰을 받고 잔액을 읽는 예:

```solidity
// 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);
    }
}
```

## 알아둘 점

- 상태는 **Draft**입니다. 이름과 시그니처가 아직 바뀔 수 있습니다.
- ERC-1155 도구와 호환되지 않으며, 지갑과 마켓플레이스에 DLT 전용 지원이 필요합니다.
- 하위 토큰별 allowance에는 [ERC-20](/eip-20/)과 같은 approve/transferFrom 경쟁 조건이 있습니다. increase/decrease 헬퍼를 쓰거나 먼저 0으로 초기화하세요.
- 배치 연산은 호출자가 넘긴 배열을 순회하므로, 배열이 너무 길면 gas가 부족해질 수 있습니다.
- 많은 하위 잔액을 합산해 주 자산 총합을 만들면 오버플로가 날 수 있습니다. 참조 구현은 주 잔액을 따로 추적합니다.
- 관련된 "슬롯과 값" 모델은 [ERC-3525](/eip-3525/)를 참고하세요.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-6960
