-
Notifications
You must be signed in to change notification settings - Fork 678
Add ERC: Splitting and Merging of NFTs #930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
235a5d6
033f0ab
e28d144
e7ceecf
7be7e94
1a7c5aa
8b43ddf
8a8106b
36354d3
23d2899
bbfa84e
87e8df9
babe5f6
cc2abe1
6404454
22d7bf6
b24410f
ac3a04b
0d7871e
31869a8
e0b9ee9
0f09729
841115f
365f4e1
5fdc854
12e4055
9efac68
8b7a902
bc96267
ae10ed6
2cf8a97
0aa9d13
fa243d2
18437fd
e58444c
e38fd46
219eb4c
5a262e6
a5b0994
d06cb0e
dc01462
5d187ac
75ddce4
91991c5
3927d3b
203a7fd
c757889
d8214a9
0843dc8
a29de84
90a23fc
ecd19b2
c200326
1fdcfa9
28eb4d7
b67e0fb
567f0db
c301db3
c96db69
b6e1ede
5acf54e
9f3f94d
9efe4fd
5aa0b8d
57d174e
bea5828
1c04e64
c14d0ea
fe9b250
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
--- | ||
Check failure on line 1 in ERCS/erc-7891.md
|
||
eip: 7891 | ||
title: Splitting and Merging of NFTs | ||
description: Hierarchical NFTs with Splitting and Merging | ||
author(s): Nitin Bhagat <[email protected]>, JongWook Bae <[email protected]>, Su-Hyun Lee <[email protected]> | ||
Check failure on line 5 in ERCS/erc-7891.md
|
||
nitin312 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
discussions-to: https://ethereum-magicians.org/t/eip-6312-hierarchical-nfts-with-splitting-and-merging/22986 | ||
status: Draft | ||
type: Standards Track | ||
category: ERC | ||
created: 2025-02-15 | ||
requires: 721, 6150 | ||
--- | ||
|
||
## Abstract | ||
|
||
This standard extends [ERC-721](./erc-721.md) and [ERC-6150](./erc-6150.md). This introduces a structured parent-child relationship between NFTs, allowing an NFT to be fractionally split into multiple child NFTs and merged back into a single entity. It provides interfaces to retrieve an NFT’s parent, children, and hierarchical status, ensuring flexible ownership management. This standard is particularly useful for applications in fractional ownership, asset distribution, and composable digital assets, opening new possibilities in fields like real estate, gaming, and decentralized finance. | ||
|
||
## Motivation | ||
|
||
This eip introduces hierarchical NFTs with splitting and merging capabilities, allowing assets to be dynamically restructured. This proposal is crucial for fractional ownership, gaming assets, and financial instruments, where assets need to be split or merged. | ||
|
||
1. **Splitting**: One of the key limitations of [ERC-6150](./erc-6150.md) is its rigid hierarchy, where NFTs are permanently assigned to a parent without the ability to restructure ownership. In many real-world scenarios, assets need to be split into smaller, independent units. This eip introduces a standardized way to split an NFT into multiple child NFTs, enabling dynamic asset management. For example, in financial markets, a share NFT can be split into multiple fractional share NFTs, allowing investors to own and trade smaller portions of a share. | ||
|
||
2. **Merging**: Just as assets need to be split, there are scenarios where multiple NFTs should be combined into a single entity. The proposed eip enables a merging mechanism, allowing child NFTs to be consolidated into a single parent NFT, allowing asset management and transactions. For instance, in finance, fractional share NFTs can be merged back into a full share NFT, enabling seamless ownership consolidation. This is particularly useful for investors who gradually accumulate fractions of a stock and later want to own a full share. | ||
nitin312 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
3. **Share Distribution**: This eip introduces ownership share management, allowing NFTs to track and distribute fractional ownership among multiple stakeholders. This solves fractional ownership tracking within parent-child NFT structures. This also allows dynamic adjustments of ownership based on splitting and merging actions. For example, a real estate NFT representing a building can have multiple owners with different share percentages. When the NFT is split, the new NFTs retain a proportion of the original ownership share. When merged, the system redistributes the shares accordingly. This Enables multi-party ownership in digital assets. | ||
nitin312 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Specification | ||
|
||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174. | ||
|
||
### Interface Definition | ||
|
||
```solidity | ||
// SPDX-License-Identifier: MIT | ||
nitin312 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pragma solidity ^0.8.0; | ||
/** | ||
* @title ERC-7891: Hierarchical NFTs with Splitting, Merging, and Share Management | ||
* @dev This interface extends ERC-6150 for hierarchical NFTs with share-based ownership management. | ||
*/ | ||
interface IERC7891 /* is IERC6150, IERC721 */ { | ||
|
||
/** | ||
* @dev Mints a new parent NFT. | ||
* @param _tokenURI URI for the NFT metadata | ||
* @return tokenId, the minted token ID | ||
*/ | ||
function mintParent(string memory _tokenURI) external payable returns (uint256 tokenId); | ||
|
||
/** | ||
* @dev Mints a new child NFT from a parent NFT with a share allocation. | ||
* @param parentId, the ID of the parent NFT | ||
* @param _share Share percentage assigned to the child | ||
* @return tokenId, the minted child NFT ID | ||
*/ | ||
function mintSplit(uint256 parentId, uint8 _share) external payable returns (uint256 tokenId); | ||
|
||
/** | ||
* @dev Merges multiple child NFTs into a new token under the same parent. | ||
* @param parentId, the parent NFT ID | ||
* @param _tokenIds Array of child token IDs to be merged | ||
* @return newTokenId, the ID of the newly minted merged NFT | ||
*/ | ||
function mintMerge(uint256 parentId, uint256[] memory _tokenIds) external payable returns (uint256 newTokenId); | ||
|
||
/** | ||
* @dev Transfers share ownership from one NFT to another. | ||
* @param to, Token ID receiving the share | ||
* @param from, Token ID sending the share | ||
* @param _share Share percentage to transfer | ||
*/ | ||
function sharePass(uint256 to, uint256 from, uint8 _share) external; | ||
} | ||
``` | ||
|
||
Optional Extensions: ERC-7891 Burnable | ||
Check failure on line 76 in ERCS/erc-7891.md
|
||
|
||
```solidity | ||
interface IERC6312Burnable is IERC7891 { | ||
/** | ||
* @dev Burns an NFT and transfers its share back to the parent NFT. | ||
*/ | ||
function burn (uint256 tokenId) external; | ||
} | ||
``` | ||
|
||
## Rationale | ||
|
||
### How ERC-7891 Improves Over Existing Standards | ||
Check failure on line 89 in ERCS/erc-7891.md
|
||
|
||
| Feature | ERC-721 | ERC-1155 | ERC-6150 | ERC-7891 (Proposed) | | ||
Check failure on line 91 in ERCS/erc-7891.md
|
||
|--------------------------|---------|---------|---------|------------------| | ||
| Unique NFTs | ✅ | ❌ | ✅ | ✅ | | ||
| Fungible & Non-Fungible | ❌ | ✅ | ❌ | ✅ | | ||
| Hierarchical Structure | ❌ | ❌ | ✅ | ✅ | | ||
| Parent-Child Relationship | ❌ | ❌ | ✅ | ✅ | | ||
| NFT Splitting | ❌ | ❌ | ❌ | ✅ | | ||
| NFT Merging | ❌ | ❌ | ❌ | ✅ | | ||
| Fractional Ownership | ❌ | ✅ | ❌ | ✅ | | ||
| Ownership Redistribution | ❌ | ❌ | ❌ | ✅ | | ||
|
||
|
||
## Backwards Compatibility | ||
|
||
The proposed ERC-7891 extends [ERC-721](./erc-721.md) and [ERC-6150](./erc-6150.md), making it backward compatible. | ||
Check failure on line 105 in ERCS/erc-7891.md
|
||
|
||
## Reference Implementation | ||
|
||
A Solidity implementation of ERC-7891 is provided below. | ||
Check failure on line 109 in ERCS/erc-7891.md
|
||
|
||
```solidity | ||
// SPDX-License-Identifier: MIT | ||
nitin312 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pragma solidity ^0.8.0; | ||
|
||
import "./ERC6150.sol"; | ||
import "@openzeppelin/contracts/utils/Counters.sol"; | ||
|
||
contract ERC7891 is ERC6150 { | ||
using Counters for Counters.Counter; | ||
Counters.Counter private _tokenIds; | ||
|
||
mapping(uint256 => string) private _tokenURIs; | ||
mapping(uint256 => uint8) public share; | ||
|
||
constructor() ERC6150("ERC7891", "NFT") {} | ||
|
||
function mintParent(string memory tokenURI) external returns (uint256) { | ||
_tokenIds.increment(); | ||
uint256 tokenId = _tokenIds.current(); | ||
_safeMintWithParent(msg.sender, 0, tokenId); | ||
share[tokenId] = 100; | ||
_tokenURIs[tokenId] = tokenURI; | ||
return tokenId; | ||
} | ||
|
||
function mintSplit(uint256 parentId, uint8 _share) external returns (uint256) { | ||
require(share[parentId] >= _share, "Insufficient parent share"); | ||
_tokenIds.increment(); | ||
uint256 childId = _tokenIds.current(); | ||
_safeMintWithParent(msg.sender, parentId, childId); | ||
share[parentId] -= _share; | ||
share[childId] = _share; | ||
_tokenURIs[childId] = _tokenURIs[parentId]; | ||
emit NFTSplit(parentId, childId, _share); | ||
return childId; | ||
} | ||
|
||
function mintMerge(uint256 parentId, uint256[] memory tokenIds) external returns (uint256) { | ||
uint8 totalShare = 0; | ||
for (uint256 i = 0; i < tokenIds.length; i++) { | ||
require(parentOf(tokenIds[i]) == parentId, "Not a child of the same parent"); | ||
totalShare += share[tokenIds[i]]; | ||
_burn(tokenIds[i]); | ||
} | ||
_tokenIds.increment(); | ||
uint256 newParentId = _tokenIds.current(); | ||
_safeMintWithParent(msg.sender, parentId, newParentId); | ||
share[newParentId] = totalShare; | ||
emit NFTMerged(newParentId, tokenIds); | ||
return newParentId; | ||
} | ||
} | ||
``` | ||
|
||
## Security Considerations | ||
|
||
No security considerations were found. | ||
|
||
## Copyright | ||
|
||
Copyright and related rights waived via CC0. | ||
|
||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.