EIPs Explained

ERC-3475 · Final(확정) · ERC · 2021-04-05

ERC-3475: Abstract Storage Bonds

채권 등 채무를 위한 토큰 표준. class/nonce 쌍마다 별도의 토큰 유형이 되며, 온체인 메타데이터, 발행량 추적, 일괄 발행·전송·상환을 제공한다.

어떤 문제를 해결하나요?

유동성 공급자 지분과 비슷한 청구권은 보통 일반 ERC-20 토큰입니다. 대체 가능한 단일 포지션에는 그것으로 충분하지만, 채권은 구조가 더 복잡합니다. 발행 조건, 만기, 상환 규칙, 그리고 서로 다른 시점에 발행된 여러 트랜치가 있을 수 있습니다. 이를 ERC-20으로 표현하면 트랜치마다 컨트랙트가 하나씩 필요하고 메타데이터는 오프체인에 보관하게 됩니다.

ERC-3475는 여러 채권 유형을 담을 수 있는 컨트랙트 하나를 정의합니다. 각 유형은 자체 메타데이터와 발행량 수치를 갖고, 어떤 지갑이나 거래소든 같은 인터페이스로 읽을 수 있습니다.

어떻게 동작하나요?

  • 클래스(classId): 채권 유형, 예를 들어 "6개월 고정". 클래스에는 심볼이나 위험 정보 같은 메타데이터가 있습니다.
  • Nonce(nonceId): 클래스 안의 발행, 예를 들어 특정 발행일. 각 (classId, nonceId) 쌍은 자체 잔액, 발행량, 메타데이터를 가집니다. 한 nonce 안의 단위는 대체 가능합니다.
  • 일괄 작업은 Transaction { classId, nonceId, _amount } 배열을 받으므로, 호출 한 번으로 여러 채권 유형을 옮길 수 있습니다.
    • issue(to, txs), redeem(from, txs), burn(from, txs): 발행 주체(스펙은 "Bank"라 부름)로 제한됩니다.
    • transferFrom(from, to, txs), transferAllowanceFrom(from, to, txs).
    • 클래스/nonce별 approve(spender, txs)와, 운영자를 위한 setApprovalFor(operator, approved).
  • 클래스/nonce별 발행량 view: totalSupply, activeSupply, redeemedSupply, burnedSupply, 그리고 balanceOf(account, classId, nonceId).
  • 만기: getProgress(classId, nonceId)는 상환까지 달성한 진행도와 남은 진행도를 반환합니다(시간, 유동성, 또는 발행자가 정의하는 무엇이든).
  • 추상 메타데이터: classMetadata / nonceMetadata는 필드(title, _type, description)를 설명하고, classValues / nonceValues는 범용 Values 구조체(string, uint, address, bool, bytes)로 값을 반환합니다. 덕분에 고정된 스토리지 레이아웃을 피할 수 있습니다.
  • 이벤트: Issue, Redeem, Transfer, ApprovalFor, 그리고 소각 이벤트.

샘플 코드

핵심 타입과 몇 가지 함수:

// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

interface IERC3475Core {
    struct Transaction { uint256 classId; uint256 nonceId; uint256 _amount; }
    struct Metadata { string title; string _type; string description; }
    struct Values { string stringValue; uint uintValue; address addressValue; bool boolValue; bytes bytesValue; }

    event Transfer(address indexed _operator, address indexed _from, address indexed _to, Transaction[] _transactions);

    function transferFrom(address _from, address _to, Transaction[] calldata _transactions) external;
    function balanceOf(address _account, uint256 classId, uint256 nonceId) external view returns (uint256);
    function activeSupply(uint256 classId, uint256 nonceId) external view returns (uint256);
    function getProgress(uint256 classId, uint256 nonceId)
        external view returns (uint256 progressAchieved, uint256 progressRemaining);
}

호출 한 번으로 트랜치 두 개 옮기기(ethers v6):

await bond.transferFrom(me, buyer, [
  { classId: 1n, nonceId: 14n, _amount: 500n },
  { classId: 1n, nonceId: 15n, _amount: 200n },
]);

알아둘 점

  • 상태: Final.
  • ERC-20, ERC-721, ERC-1155를 요구 사항으로 나열하지만 별도의 인터페이스입니다. ERC-20이나 ERC-1155 지갑은 명시적인 지원 없이는 이 채권을 표시하거나 전송할 수 없습니다.
  • 스펙 본문은 예시, 파라미터 이름, 주석 사이에 불일치가 있습니다(예를 들어 예시의 클래스/nonce 값과 수량이 보여 준 호출과 항상 일치하지는 않고, docstring과 함수 사이에 시그니처가 다른 경우도 있습니다). 글만 보지 말고 레퍼런스 구현을 확인하세요.
  • 메타데이터 스키마는 본문이 아니라 함께 제공되는 Metadata.md 자산에 정의되어 있습니다.
  • issue, redeem, burn은 권한이 필요한 작업입니다. 보유자는 발행자의 컨트랙트가 만기 조건을 올바르게 강제하는 데 의존합니다. 표준은 상환이 그 조건이 충족된 후에 이뤄져야 한다고만 말합니다.

#token #bonds #defi #multi-token #metadata

상세 정보

저자
Yu Liu (@yuliu-debond), Varun Deshpande (@dr-chain), Cedric Ngakam (@drikssy), Dhruv Malik (@dhruvmalik007), Samuel Gwlanold Edoumou (@Edoumou), Toufic Batrice (@toufic0710)
상태
Final(확정)
유형
Standards Track / ERC
작성일
2021-04-05
의존하는 제안
이 제안에 의존하는 제안

기계 판독용 데이터: Markdown · JSON