ERC-4675 Multi-NFT fractionalization token (Multi-Fractional Non-Fungible Tokens)
Stagnant · NFTs & multi-token · created 2022-01-13
A standard that lets a single contract fractionalize multiple NFTs, each distinguished by a token ID, and manage ownership of those fractions in an ERC-20-like way.
Why it is needed
Until now, fractionalizing an NFT so multiple people could share ownership required deploying a separate ERC-20-compatible token contract for each NFT. Deploying one more contract every time an NFT is fractionalized stacks up duplicate code on Ethereum inefficiently, and since each contract is separated with its own authority, integrating functionality across them is difficult. As more projects sought to fractionalize NFTs, this approach hit scalability limits, creating a need for a standard that could manage fractional tokens for multiple NFTs within a single contract.
What to implement
event Transfer(address indexed _from, address indexed _to, uint256 indexed _id, uint256 _value);: Event emitted when _value of the fractional token identified by _id moves from _from to _to.event Approval(address indexed _owner, address indexed _spender, uint256 indexed _id, uint256 _value);: Event emitted when _owner grants or reconfirms to _spender an allowance of _value for the _id token.event TokenAddition(address indexed _parentToken, uint256 indexed _parentTokenId, uint256 _id, uint256 _totalSupply);: Event emitted when a new token type _id, fractionalizing the _parentTokenId NFT from the _parentToken contract, is registered with a total supply of _totalSupply.function transfer(address _to, uint256 _id, uint256 _value) external returns (bool);: Transfers _value of the _id token held by msg.sender to _to.function approve(address _spender, uint256 _id, uint256 _value) external returns (bool);: Approves _spender to withdraw up to _value of the _id token on behalf of msg.sender.function transferFrom(address _from, address _to, uint256 _id, uint256 _value) external returns (bool);: Lets an approved caller transfer _value of the _id token from _from to _to on their behalf.function setParentNFT(address _parentNFTContractAddress, uint256 _parentNFTTokenId, uint256 _totalSupply) external;: Registers the NFT (at _parentNFTTokenId of _parentNFTContractAddress) owned by this contract as a new token type and configures the minting of _totalSupply fractional tokens.function totalSupply(uint256 _id) external view returns (uint256);: Looks up the total supply of a specific _id token type.function balanceOf(address _owner, uint256 _id) external view returns (uint256);: Looks up the balance of the _id token held by _owner.function allowance(address _owner, address _spender, uint256 _id) external view returns (uint256);: Looks up the withdrawable allowance that _owner has granted to _spender for the _id token.function isRegistered(address _parentNFTContractAddress, uint256 _parentNFTTokenId) external view returns (bool);: Checks whether a specific NFT has already been registered and fractionalized in this contract.function supportsInterface(bytes4 interfaceID) external view returns (bool);: Checks via the ERC-165 method whether this contract supports a specific interface.function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external pure returns (bytes4);: The callback function this contract must implement to safely receive an NFT via safeTransferFrom.
In depth
Fractional token structure distinguished by _id
Like ERC-1155, this standard distinguishes multiple token types by _id within a single contract. However, there is a clear difference from ERC-1155: here, each _id represents (fractionalizes) one distinct NFT. That is, _id 1 means a fraction of NFT A and _id 2 means a fraction of NFT B, so the same contract can simultaneously manage fractional tokens for many different NFTs.
setParentNFT and ownership verification
setParentNFT(_parentNFTContractAddress, _parentNFTTokenId, _totalSupply) is the function that registers a new token type. The contract must itself verify that it is the owner of the given NFT, and must revert if the same NFT is already registered, if _parentNFTContractAddress is the zero address, if it is not ERC-721 compatible, or if this contract is not the NFT owner. On success, it must emit a TokenAddition event.
ERC-20-like transfer and approval interface
transfer, approve, transferFrom, balanceOf, and allowance, totalSupply follow the names and behavior of ERC-20 as is, but an _id parameter indicating the token type has been added to every function and event. transfer and transferFrom must revert if the recipient address is the zero address or the balance is insufficient, and must emit a Transfer event on success. approve must also revert if _spender is the zero address and must emit an Approval event.
Why name() and symbol() are not included
This standard does not include name() and symbol() functions. This is because most users can simply pull the name and symbol from the original NFT contract, and storing a copied name and symbol every time a token is added would pile up unnecessary redundant bytecode on Ethereum. That said, depending on project needs, it is also possible to pull metadata from the NFT contract and add it to each token type.
Designed for flexibility and backwards compatibility
This standard defines only the minimal requirements so that each project can design minting, governance, burning, and so on to fit its own architecture. Function and event names are matched to ERC-20, with only the events and functions needed to add token types appended, and the parameter order using _id is structured similarly to ERC-1155. It is designed to interact with ERC-721, but is intentionally kept independent of ERC-721's extension features.
Proposal status
This ERC was proposed on 2022-01-13 and is in Stagnant status; discussion has stalled, so its content may change or it may never be adopted.
Things to watch out for
- NFT ownership verification is mandatory: To fractionalize an NFT, ownership of that NFT must actually have been transferred to the token contract before fractionalization. The contract must thoroughly verify NFT ownership before fractionalizing, to prevent a situation where the fractional tokens become separate from the original NFT.
- Front-running risk of setParentNFT: Allowing anyone to call setParentNFT can create a front-running problem where the caller differs from the person who actually sent the NFT. To prevent this, only an admin should be allowed to call it, or NFT receipt and fractionalization should be bundled into a single atomic transaction, similar to a flash loan swap.