---
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/ja/eip-2135/
lang: ja
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/) トークンの上に載る、消費のための小さなインターフェースを 1 つ定義します。

## 仕組み

準拠するコントラクトは次を実装します。

| メンバー | 役割 |
| --- | --- |
| `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
