# [ERC6268] ERC1155形式のNFTをSBTにする仕組みを理解しよう！

> ERC6268は、EIP1155に対応するトークンの「譲渡不可（送付できない）」を示すためのインターフェースを標準化する提案です。EIP165の機能検出を活用して、トークンを譲渡できるかどうかを判別できるようにします。

- URL: https://cardene.dev/articles/5ac107681eac3328258d
- 公開日: 2025-03-18
- 更新日: 2025-03-18
- トピック: Blockchain
- タグ: ethereum, solidity, smartcontract, ブロックチェーン

## はじめに

『DApps開発入門』という本や色々記事を書いているかるでねです。

https://amzn.asia/d/gxvJ0Pw

今回は、**ERC1155**形式のNFTを`transfer`できないようにする仕組みを提案している**ERC6268**についてまとめていきます！

:::message
以下にまとめられているものを翻訳・要約・補足しながらまとめていきます。
:::

https://eips.ethereum.org/EIPS/eip-6268

他にも様々なEIPについてまとめています。

https://cardene.notion.site/ERC-EIP-2a03fa3ea33d43baa9ed82288f98d4a9?pvs=4

## 概要

**ERC6268**は、**EIP1155**に対応するトークンの「譲渡不可（送付できない）」を示すためのインターフェースを標準化する提案です。
**EIP165**の機能検出を活用して、トークンを譲渡できるかどうかを判別できるようにします。

:::message
**EIP165**については以下の記事を参考にしてください。
:::

[\[ERC165\] コントラクトが特定のインターフェースをサポートしているか確認する仕組みを理解しよう！](/articles/541184977a5cba51b759)

## 動機

ソウルバウンドトークン（SBT）は、NFTの保有者が自由に譲渡できないトークンのことです。
**EIP5192**ではNFTのソウルバウンド仕様が標準化されていますが、セミファンジブルトークンや完全に代替可能なトークン（FT）には、まだ統一された規格がありませんでした。

:::message
**EIP5192**については以下の記事を参考にしてください。
:::

[\[ERC5192\] NFTを送付できなくする『SBT』について理解しよう！](/articles/01b2463cb87f391498a8)

このEIPが提案する「譲渡不可」を示す標準インターフェースを使えば、トークンがファンジブルかどうかに関係なく、ソウルバウンドトークンとして扱えるようになります。
これにより、セミファンジブルやファンジブルなソウルバウンドトークンの普及を後押しできるという狙いがあります。

## 仕様

**EIP5192**では、ソウルバウンドトークン（SBT）の「譲渡不可」をコントラクトで明確に定義するルールが定められています。 

### ポイント  

#### EIP1155に準拠する  

**EIP5192**に準拠するコントラクトは、**EIP1155**の仕様に準拠する必要があります。
つまり、基本的なトークン管理の仕組みは**EIP1155**をベースにしながら、SBTの機能を追加する形です。  

#### IERC6268 インターフェースの実装が必須

コントラクトは、**IERC6268**インターフェースに含まれる全ての関数を実装する必要があります。
これは、「トークンがロックされているかどうか」を判別するための関数や、「ロック状態が変わったことを通知するイベント」が含まれています。  

#### EIP165の`supportsInterface`を実装すること  

コントラクトは、**EIP165**の `supportsInterface` 関数を実装し、`0xd87116f3` という識別子が渡された場合には `true` を返す必要があります。
これにより、**EIP5192**に準拠しているかどうかを簡単に判定できるようになります。  

#### ロックされたトークンは`transfer`不可  

`locked(_id)` が `true` を返すトークンは、`safeTransferFrom` や `safeBatchTransferFrom` などの送付系の関数を実行しようとするとエラーが返るようになっています。
これにより、ロックされたSBTが誤って送付されることを防ぎます。  

#### IERC6268 の機能  

このインターフェースでは、トークンのロック状態を管理するためのイベントと関数が定義されています。  

### IERC6268

```js:IERC6268.sol
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

interface IERC6268 {
  /// @notice Either `LockedSingle` or `LockedBatch` MUST emit when the locking status is changed to locked.
  /// @dev If a token is minted and the status is locked, this event should be emitted.
  /// @param _id The identifier for a token.
  event LockedSingle(uint256 _id);

  /// @notice Either `LockedSingle` or `LockedBatch` MUST emit when the locking status is changed to locked.
  /// @dev If a token is minted and the status is locked, this event should be emitted.
  /// @param _ids The list of identifiers for tokens.
  event LockedBatch(uint256[] _ids);

  /// @notice Either `UnlockedSingle` or `UnlockedBatch` MUST emit when the locking status is changed to unlocked.
  /// @dev If a token is minted and the status is unlocked, this event should be emitted.
  /// @param _id The identifier for a token.
  event UnlockedSingle(uint256 _id);

  /// @notice Either `UnlockedSingle` or `UnlockedBatch` MUST emit when the locking status is changed to unlocked.
  /// @dev If a token is minted and the status is unlocked, this event should be emitted.
  /// @param _ids The list of identifiers for tokens.
  event UnlockedBatch(uint256[] _ids);


  /// @notice Returns the locking status of the token.
  /// @dev SBTs assigned to zero address are considered invalid, and queries
  /// about them do throw.
  /// @param _id The identifier for a token.
  function locked(uint256 _id) external view returns (bool);

  /// @notice Returns the locking statuses of the multiple tokens.
  /// @dev SBTs assigned to zero address are considered invalid, and queries
  /// about them do throw.
  /// @param _ids The list of identifiers for tokens
  function lockedBatch(uint256[] _ids) external view returns (bool);
}
```

#### イベント

##### `LockedSingle(uint256 _id)`

トークンがロックされたときに発行されるイベント。  

##### `LockedBatch(uint256[] _ids)`

複数のトークンがロックされたときに発行されるイベント。

##### `UnlockedSingle(uint256 _id)`

トークンのロックが解除されたときに発行されるイベント。

##### `UnlockedBatch(uint256[] _ids)`

複数のトークンのロックが解除されたときに発行されるイベント。 

#### 関数

##### `locked(uint256 _id)`

指定したトークンがロックされているかを返す関数。 

##### `lockedBatch(uint256[] _ids)`

複数のトークンのロック状態をまとめて返す関数。

## 互換性

**ERC6268**は、ERC1155と完全な互換性があります。

## 引用

Yuki Aoki (@yuki-js), "ERC-6268: Untransferability Indicator for EIP-1155 [DRAFT]," Ethereum Improvement Proposals, no. 6268, January 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-6268.

## 最後に

今回は「**ERC1155**形式のNFTを`transfer`できないようにする仕組みを提案している**ERC6268**」についてまとめてきました！
いかがだったでしょうか？

質問などがある方は以下のTwitterのDMなどからお気軽に質問してください！

[Twitter @cardene777](https://twitter.com/cardene777)

他の媒体でも情報発信しているのでぜひ他も見ていってください！

https://chaldene.net/

https://zenn.dev/heku

https://cardene.substack.com/

https://mirror.xyz/0xcE77b9fCd390847627c84359fC1Bc02fC78f0e58

https://cardene.notion.site/ERC-EIP-2a03fa3ea33d43baa9ed82288f98d4a9?pvs=4
