ERC-7681 A dual-nature multi-token protocol (Dual Nature Multi Token Protocol)

Draft · NFTs & multi-token · created 2024-04-08

A combined standard that implements the fungible token standard ERC-20 and the multi-token standard ERC-1155 together in a single contract, keeping the balances of the two tokens moving in sync with each other.

Why it is needed

There have been attempts in Ethereum to make a single token behave both as a quantity like a coin and as an individual item like an NFT. ERC-7631, which combines the fungible token standard ERC-20 and the NFT standard ERC-721 in a single contract, is one example. However, the two standards each define a Transfer(address, address, uint256) event with the same name and shape, which made it difficult for a single contract to fully comply with both standards at once. The multi-token standard ERC-1155, by contrast, does not have events that overlap with ERC-20, so the two standards can be combined into one while both are fully honored. This makes it possible to natively implement features inside the contract such as fractionalization, similar to NFT fractional ownership, where acquiring ERC-20 tokens automatically mints ERC-1155 tokens in proportion to the holder's balance. ERC-7681 standardizes this combination approach, along with a way for users to opt out of receiving ERC-1155 tokens during the synchronization process.

What to implement

In depth

Both standards' interfaces must be implemented

Every ERC-7681 contract MUST implement both the ERC20 and ERC1155 interfaces. On the ERC-20 side, totalSupply, balanceOf(address), transfer, transferFrom, approve, and allowance are required, while name, symbol, and decimals are optional (MAY). On the ERC-1155 side, balanceOf(address, uint256), balanceOfBatch, setApprovalForAll, isApprovedForAll, safeTransferFrom, and safeBatchTransferFrom are required. The events must also include ERC-20's Transfer and Approval, and ERC-1155's TransferSingle, TransferBatch, ApprovalForAll, and URI. This is a structure where balanceOf functions of the same name coexist, distinguished by the number of arguments.

Why ERC-1155 was combined instead of ERC-721

ERC-7631, which links ERC-20 and ERC-721, revealed the problem that full compatibility is difficult because both standards define a Transfer(address, address, uint256) event of the same shape. ERC-1155 has events such as TransferSingle and TransferBatch that do not overlap, making it possible to combine the two in a way that fully satisfies both standards. At the same time, this can provide benefits similar to NFT fractional ownership by default, such as automatically minting ERC-1155 tokens in proportion to the holder's balance when ERC-20 tokens are acquired. As with ERC-7631, users are also allowed to opt out of ERC-1155 minting and transfers during the synchronization process.

Synchronization logic was deliberately left unspecified

This proposal deliberately does not specify concrete synchronization logic for how the two tokens should be kept in sync. One-to-one synchronization is possible, as is a scheme that fractionalizes ERC-1155 tokens based on ERC-20 holdings. As long as implementers fully comply with the specifications of both token standards, they are free to set their own synchronization strategy, which is intended to accommodate a variety of implementation strategies and new use cases.

Behavior rules of the skip interface

IERC7681Skippable is an optional implementation (MAY). getSkipToken(owner) SHOULD return whether ERC-1155 minting and transfers to that address should be skipped during synchronization. This function may revert, but once it has returned true or false for a given owner, it MUST NOT revert for that owner again. If it reverts, the caller should treat it as if the setSkipToken feature does not exist, hide the related functionality, and interpret that address's skip status as undefined. setSkipToken(status) sets the caller's own skip status and may revert due to insufficient permissions or other reasons. The initial skip status can be freely set to either true or false, but whenever the status changes in any way, a SkipTokenSet event must be emitted.

Contract addresses benefit from defaulting to skip

If the recipient address is a smart contract, setting the default skip status to true can prevent unnecessary ERC-1155 minting when interacting with contracts such as decentralized exchanges (DEXs) or lending protocols. Such contracts often do not need ERC-1155 tokens, so skipping minting may reduce gas costs.

Backward compatibility and proposal status

This proposal is fully backward compatible with the existing ERC-20 and ERC-1155 standards, so existing contracts that rely on either standard continue to work as is. However, ERC-7681 is a proposal in Draft status submitted on April 8, 2024, so it should be kept in mind that its content may still change.

Things to watch out for

Original ERC · ← ERCs