Alert Source Discuss
⚠️ Draft Standards Track: ERC

ERC-7891: NFT 的拆分和合并

分层 NFT 的接口,支持拆分单个 NFT 和合并多个 NFT

Authors Nitin Bhagat (@nitin312) <bhagatnitin312@gmail.com>, JongWook Bae <bae@cwnu.ac.kr>, Su-Hyun Lee <sleepl@changwon.ac.kr>
Created 2025-02-15
Discussion Link https://ethereum-magicians.org/t/eip-7891-hierarchical-nfts-with-splitting-and-merging/22986
Requires EIP-721, EIP-6150

摘要

本标准扩展了 EIP-721EIP-6150。它引入了 NFT 之间结构化的父子关系,允许将一个 NFT 拆分为多个子 NFT,然后再合并回一个实体。它提供了检索 NFT 的父级、子级和分层状态的接口,确保灵活的所有权管理。此标准对于分数所有权、资产分配和可组合数字资产中的应用尤其有用,为房地产、游戏和去中心化金融等领域开辟了新的可能性。

动机

此 EIP 引入了具有拆分和合并功能的分层 NFT,允许动态重构资产。该提案对于分数所有权、游戏资产和金融工具至关重要,在这些领域,资产需要被拆分或合并。

  1. 拆分EIP-6150 的主要限制之一是其刚性的层次结构,其中 NFT 被永久分配给父级,而无法重构所有权。在许多现实场景中,资产需要被拆分为更小、更独立的单元。此 EIP 引入了一种标准化方法,将 NFT 拆分为多个子 NFT,从而实现动态资产管理。例如,在金融市场中,股份 NFT 可以拆分为多个零股 NFT,允许投资者拥有和交易较小部分的股份。

  2. 合并:正如资产需要被拆分一样,在某些情况下,多个 NFT 应该合并为一个实体。拟议的 EIP 启用了合并机制,允许将子 NFT 合并为一个父 NFT,从而实现资产管理和交易。例如,在金融领域,零股 NFT 可以合并回完整的股份 NFT,从而实现无缝的所有权合并。这对于逐渐积累少量股票并希望稍后拥有完整股票的投资者特别有用。

  3. 份额分配:此 EIP 引入了所有权份额管理,允许 NFT 跟踪并在多个利益相关者之间分配分数所有权。这解决了父子 NFT 结构中的分数所有权跟踪问题。这也允许根据拆分和合并操作动态调整所有权。例如,代表建筑物的不动产 NFT 可以有多个所有者,其股份百分比不同。当 NFT 被拆分时,新的 NFT 会保留原始所有权份额的一部分。合并后,系统会相应地重新分配股份。这实现了数字资产中的多方所有权。

拟议的 EIP 如何改进现有标准

功能 EIP-721 EIP-1155 EIP-6150 EIP (拟议)
独特的 NFT
可替代和不可替代
分层结构
父子关系
NFT 拆分
NFT 合并
分数所有权
所有权重新分配

规范

本文档中的关键词“必须 (MUST)”、“禁止 (MUST NOT)”、“必需 (REQUIRED)”、“应该 (SHALL)”、“不应该 (SHALL NOT)”、“推荐 (SHOULD)”、“不推荐 (SHOULD NOT)”、“可以 (MAY)”和“可选 (OPTIONAL)”应按照 RFC 2119 和 RFC 8174 中的描述进行解释。

每个符合标准的合约都必须实现此提案、EIP-721EIP-165ERC-6150

pragma solidity ^0.8.0;

// Note: the ERC-165 identifier for this interface is 0x43cb816b.
// 注意:此接口的 ERC-165 标识符是 0x43cb816b。
interface IERC7891 /* is IERC6150, IERC721, IERC165 */ {
    /**
     * @notice Emitted when a child token is minted under a parent with an assigned share.
     * @notice 当在具有分配份额的父级下铸造子代币时发出。
     * @param parentId The ID of the parent token
     * @param parentId 父代币的 ID
     * @param childId The ID of the newly minted child token
     * @param childId 新铸造的子代币的 ID
     * @param share Share percentage assigned to the child token
     * @param share 分配给子代币的股份百分比
     */
    event Split(uint256 indexed parentId, uint256 indexed childId, uint8 share);

    /**
     * @notice Emitted when multiple child tokens are merged into a new token.
     * @notice 当多个子代币合并为一个新代币时发出。
     * @param newTokenId The ID of the newly minted merged token
     * @param newTokenId 新铸造的合并代币的 ID
     * @param mergedTokenIds Array of token IDs that were merged
     * @param mergedTokenIds 已合并的代币 ID 数组
     */
    event Merged(uint256 indexed newTokenId, uint256[] mergedTokenIds);
    /**
     * @notice Mints a new root-level parent NFT.
     * @notice 铸造一个新的根级别父 NFT。
     * @param _tokenURI URI string pointing to token metadata
     * @param _tokenURI 指向代币元数据的 URI 字符串
     * @return tokenId The ID of the newly minted parent token
     * @return tokenId 新铸造的父代币的 ID
     */
    function mintParent(string memory _tokenURI) external payable returns (uint256 tokenId);

    /**
     * @notice Mints a child NFT under a given parent with a specific share allocation.
     * @notice 在给定父节点下铸造具有特定份额分配的子 NFT。
     * @param parentId ID of the parent token
     * @param parentId 父代币的 ID
     * @param _share Share percentage assigned to the child token
     * @param _share 分配给子代币的股份百分比
     * @return tokenId The ID of the newly minted child token
     * @return tokenId 新铸造的子代币的 ID
     */
    function mintSplit(uint256 parentId, uint8 _share) external payable returns (uint256 tokenId);

    /**
     * @notice Merges multiple child NFTs into a new token under the same parent.
     * @notice 将多个子 NFT 合并为同一父节点下的新代币。
     * @param parentId ID of the parent token
     * @param parentId 父代币的 ID
     * @param _tokenIds Array of child token IDs to be merged
     * @param _tokenIds 要合并的子代币 ID 数组
     * @return newTokenId The ID of the newly minted merged token
     * @return newTokenId 新铸造的合并代币的 ID
     */
    function mintMerge(uint256 parentId, uint256[] memory _tokenIds) external payable returns (uint256 newTokenId);

    /**
     * @notice Transfers share ownership from one NFT to another.
     * @notice 将股份所有权从一个 NFT 转移到另一个 NFT。
     * @param to Token ID receiving the share
     * @param to 接收股份的代币 ID
     * @param from Token ID sending the share
     * @param from 发送股份的代币 ID
     * @param _share Share percentage to transfer
     * @param _share 要转移的股份百分比
     */
    function sharePass(uint256 to, uint256 from, uint8 _share) external;

    /**
     * @notice Burns an NFT and transfers its share back to the parent NFT.
     * @notice 销毁一个 NFT 并将其股份转回父 NFT。
     * @param tokenId The ID of the token to burn
     * @param tokenId 要销毁的代币的 ID
     */
    function burn (uint256 tokenId) external;
}

原理

此 EIP 基于 ERC-721ERC-6150 构建,引入了一种结构化的基于份额的分层 NFT 机制,可以直接在代币标准中实现拆分、合并和分数所有权。该提案重用了 ERC-6150 的父子架构,以保持兼容性并降低实现复杂性。通过内部映射以原生方式嵌入份额管理,允许每个代币独立跟踪其分数所有权,而无需依赖外部协议。mintSplitmintMerge 等函数旨在反映现实世界的资产行为,明确区分资产分解和整合。sharePass 函数有助于在代币之间重新分配份额,而无需铸造或销毁,从而提供高效的内部转移机制。包含了一个 burn 函数,允许在销毁时股份返回给父级,这与所有权保持一致。总体而言,该接口具有明确的目的,并且直观,专为可扩展性而设计,同时保持 gas 效率和语义清晰。

向后兼容性

拟议的 EIP 扩展了 EIP-721EIP-6150,使其向后兼容。

参考实现

实现:EIP-7891.

安全注意事项

未发现任何安全注意事项。

版权

CC0 下放弃版权及相关权利。

Citation

Please cite this document as:

Nitin Bhagat (@nitin312) <bhagatnitin312@gmail.com>, JongWook Bae <bae@cwnu.ac.kr>, Su-Hyun Lee <sleepl@changwon.ac.kr>, "ERC-7891: NFT 的拆分和合并 [DRAFT]," Ethereum Improvement Proposals, no. 7891, February 2025. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7891.