---
eip: 2135
label: ERC-2135
title: Consumable Interface (Tickets, etc)
status: Final
type: Standards Track
category: ERC
created: 2019-06-23
requires: 165, 721, 1155
official: https://eips.ethereum.org/EIPS/eip-2135
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-2135.md
canonical: https://eips.huatuo.xyz/ko/eip-2135/
lang: ko
tldr: NFT나 멀티 토큰을 이벤트 티켓처럼 소모 가능한 것으로 표시하기 위한 최소 인터페이스. 표준 consume() 호출, 사전 확인, OnConsumption 이벤트를 정의한다.
tags: [nft, tickets, erc721, erc1155, interface]
---

# ERC-2135: Consumable Interface (Tickets, etc)

> An interface extending ERC-721 and ERC-1155 for consumability, supporting use case such as an event ticket.

**TL;DR:** NFT나 멀티 토큰을 이벤트 티켓처럼 소모 가능한 것으로 표시하기 위한 최소 인터페이스. 표준 consume() 호출, 사전 확인, OnConsumption 이벤트를 정의한다.

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

많은 디지털 자산은 쓰고 나면 사라지도록 만들어집니다. 콘서트 티켓은 입구에서 "소모"되고, 바우처는 교환할 때, 패스는 스캔할 때 소모됩니다. 표준이 없으면 티켓 컨트랙트마다 자기만의 `redeem`, `use`, `checkIn` 함수를 만들어, 스캐너·지갑·마켓플레이스·다른 컨트랙트가 이를 범용적으로 다룰 수 없습니다.

ERC-2135는 [ERC-721](/eip-721/) 또는 [ERC-1155](/eip-1155/) 토큰 위에 얹는 작은 소모용 인터페이스 하나를 정의합니다.

## 어떻게 동작하나요?

호환되는 컨트랙트는 다음을 구현합니다.

| 멤버 | 역할 |
| --- | --- |
| `consume(consumer, assetId, amount, data)` | `consumer`를 대신해 `assetId`를 `amount`만큼 소모하며 `bool`을 반환 |
| `isConsumableBy(consumer, assetId, amount)` | view 확인: 이 소모가 성공할 수 있는가? |
| `event OnConsumption(consumer, assetId, amount, data)` | 소모가 성공할 때마다 발생 |

규칙:

- `supportsInterface(0xdd691946)`은 `true`를 반환해야 합니다([ERC-165](/eip-165/)).
- 컨트랙트가 ERC-721 또는 ERC-1155 토큰이라면, `consume`이 성공했을 때 토큰이 보유자에서 제로 주소로 이동한 것처럼 `Transfer` / `TransferSingle`도 발생시켜야 합니다. 그래야 인덱서가 토큰이 사라진 것을 볼 수 있습니다.
- `consumer`가 트랜잭션 발신자일 필요는 없으므로, 행사장의 게이트 컨트랙트나 릴레이어가 다른 사람을 대신해 소모할 수 있습니다.
- `data`는 자유 형식이며 서명된 보증 같은 확장에 쓸 수 있습니다.

이 표준은 누가 어떤 조건에서 소모할 수 있는지, 소모 가능한 것이 어떻게 만들어지는지, 어떤 메타데이터를 갖는지에 대해서는 의도적으로 아무것도 정하지 않습니다. 이는 애플리케이션에 맡겨져 있습니다.

## 샘플 코드

행사장 게이트만 소모할 수 있는 ERC-721 티켓(OpenZeppelin v5):

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";

interface IERC2135 {
    function consume(address consumer, uint256 assetId, uint256 amount, bytes calldata data)
        external returns (bool);
    function isConsumableBy(address consumer, uint256 assetId, uint256 amount)
        external view returns (bool);
    event OnConsumption(address indexed consumer, uint256 indexed assetId, uint256 amount, bytes data);
}

contract Ticket is ERC721, IERC2135 {
    address public immutable gate;

    constructor(address gate_) ERC721("Concert Ticket", "TIX") { gate = gate_; }

    function mint(address to, uint256 id) external {
        require(msg.sender == gate, "only gate");
        _mint(to, id);
    }

    function isConsumableBy(address consumer, uint256 id, uint256 amount) public view returns (bool) {
        return amount == 1 && _ownerOf(id) == consumer;
    }

    function consume(address consumer, uint256 id, uint256 amount, bytes calldata data)
        external returns (bool)
    {
        require(msg.sender == gate, "only gate");
        require(isConsumableBy(consumer, id, amount), "not consumable");
        _burn(id); // emits Transfer(owner, address(0), id) as the spec requires
        emit OnConsumption(consumer, id, amount, data);
        return true;
    }

    function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
        return interfaceId == type(IERC2135).interfaceId || super.supportsInterface(interfaceId);
    }
}
```

## 알아둘 점

- 접근 제어가 가장 중요한 보안 결정입니다. 보유자, 발행자, 게이트 컨트랙트 중 누가 `consume`을 호출할 수 있는지 명시적으로 정하고 테스트하세요.
- 소모를 전송 제한과 일관되게 유지하세요. 전송이 일시 중지되었거나 사용자가 제한된 경우 소모도 같은 방식으로 동작해야 합니다.
- ERC-721과 ERC-1155 토큰에서는 제로 주소로의 전송 이벤트가 필수이므로, 소모는 사실상 보유자의 잔액에서 토큰을 제거하게 되어 burn이 자연스러운 구현입니다.
- 저자는 [ERC-20](/eip-20/) 같은 대체 가능 토큰에도 맞춰 쓸 수 있다고 하지만, 이 인터페이스는 NFT를 염두에 두고 설계되었습니다.


---

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