1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

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

Posted at

はじめに

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

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

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

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

概要

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

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

動機

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

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

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

仕様

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

ポイント

EIP1155に準拠する

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

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

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

EIP165のsupportsInterfaceを実装すること

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

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

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

IERC6268 の機能

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

IERC6268

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

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

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?