ERC-5700 Bindable token interface
Draft · NFTs & multi-token · created 2022-09-22
An interface that binds a token to an NFT so it moves together with the NFT at no extra cost. The NFT owner can unbind the attached token at any time to reclaim ownership.
Why it is needed
There is demand to bundle multiple assets to a single NFT and trade them as one unit, whether binding physical assets to the NFT, such as streetwear with embedded microchips, digitized car collections, or digital twin real estate, or combining digital assets such as avatar wardrobes, music tracks, or metaverse land. Without a common interface, each project ends up building its own rigid, implementation-specific ownership handling, making compatibility with wallets, marketplaces, and NFT apps hard to guarantee. Existing standards also only express token ownership at the account level, so they cannot represent an 'NFT owns a token' relationship, and moving a bundle requires transferring each token separately, which costs more. This standard creates a general-purpose token-bundling interface compatible with the existing ERC-721 and ERC-1155 to handle binding and moving N tokens to a single NFT more efficiently.
What to implement
function binderOf(uint256 tokenId) external view returns (address, uint256);: Returns the contract address and identifier of the NFT a token is bound to. If it is not bound, the address portion returns the zero address.function boundBalanceOf(address bindAddress, uint256 bindId) external view returns (uint256);: Returns the total number of tokens bound to a specific NFT.
In depth
Two interfaces and ERC-165 identifiers
This standard defines two interfaces: IERC721Bindable, which allows ERC-721 tokens to be bound, and IERC1155Bindable, which allows ERC-1155 tokens to be bound. A smart contract implementing each standard must implement the corresponding interface and must return true from supportsInterface when passed the identifier. The ERC-165 identifier for IERC721Bindable is 0x82a34a7d, and the identifier specified in the code comments for IERC1155Bindable is 0xd0d555c6. The binding target is always an ERC-721 NFT, while the binding token itself can be either ERC-721 or ERC-1155. This proposal assumes ERC-165, ERC-721, and ERC-1155, and is designed to be compatible with both existing token standards.
bind: rules for binding
bind binds a token to an NFT. In the ERC-721 version, the caller must be the current owner of the token, an approved operator, or the approved address for that token, and it must fail if the token is already bound or if from is not the token owner. It must also fail if the target NFT contract does not support the ERC-721 interface or if the target NFT does not exist. Before binding, token ownership must be transferred to the target NFT's contract address, and on completion it must emit Transfer and Bind events reflecting the implicit transfer and the bind. The ERC-1155 version of bind can only be called by an approved operator of from, must fail if from's balance is less than amount, and binds by token type and quantity.
unbind: rules for unbinding
unbind releases a bound token and sends it to the specified address, to. In the ERC-721 version, the caller must be the current owner of the NFT the token is bound to, an approved operator, or the approved address. It must fail if the token is not bound, if from is not the owner of that NFT, or if to is the zero address. After unbinding, token ownership transfers to to; if to's code size is greater than 0 (i.e., it is a contract), onERC721Received must be called, and it must fail if an invalid identifier is returned. On completion, it must emit Unbind and Transfer events. The ERC-1155 version calls onERC1155Received in the same situation, and must fail if the balance bound to the NFT is less than amount.
ERC-1155 batch functions
The ERC-1155 side has batch functions. batchBind binds multiple token types (tokenIds) together with their respective quantities (amounts) at once. It must fail if amounts and tokenIds differ in length or if from's balance is insufficient, and on completion it must emit TransferBatch and BindBatch events. batchUnbind releases multiple types at once. It must fail if the two arrays differ in length, if the balance bound to the NFT is insufficient, or if to is the zero address, and if to is a contract it must call onERC1155BatchReceived and check the returned identifier. On completion, it must emit UnbindBatch and TransferBatch events.
Query the bound state
Lookup functions check binding status. In the ERC-721 version, binderOf returns the contract address and numeric identifier of the NFT a token is bound to, and must return the zero address in the address portion to indicate no binding if the token is not bound. boundBalanceOf returns the total number of tokens bound to a specific NFT at a specific address. In the ERC-1155 version, boundBalanceOf returns the quantity of a specific token type bound to a specific NFT, and boundBalanceOfBatch returns the bound balance for each of multiple NFT and token-type pairs at once as an array.
Ownership design and limitations
While bound, technical ownership of the bindable token passes to the bound NFT, and the NFT owner can unbind it at any time. In exchange for this lightweight design, in apps that have not yet adopted this standard, a bound token will not show as owned by the NFT owner. The original text cites Dopamine as a use case, representing microchips embedded in streetwear apparel as NFTs and describing how digital assets such as music, avatars, and digital twins of clothing can be made into bindable tokens and bound to that NFT.
Draft status
The original text comes with reference implementations of both ERC-721 Bindable and ERC-1155 Bindable. However, this proposal is in Draft status, registered on September 22, 2022, and has not yet been finalized, so its content may change or progress may stall. Interface identifiers and function signatures may also change before finalization, so it is advisable to check the latest status of the original text before implementing or integrating.
Things to watch out for
- Controlling unbinding authority: Because token ownership passes to the bound NFT's contract while bound, implementations must take care to ensure that only the designated NFT owner can perform unbinding.