⚠️ 该 EIP 不建议普遍使用或实施,因为它可能会发生变化。

EIP-5409: EIP-1155 Non-Fungible Token extension Source

Allow EIP-1155 to represent Non-Fungible Tokens (tokens who have a unique owner)

作者 Ronan Sandford
讨论-To https://ethereum-magicians.org/t/eip-5409-non-fungible-token-extension-for-eip-1155/10240
状态 Draft
类型 Standards Track
分类 ERC
创建日期 2022-07-23
依赖 165, 721, 1155
英文版 https://eips.ethereum.org/EIPS/eip-5409

Abstract

This standard is an extension of EIP-1155. It proposes an additional function, ownerOf, which allows EIP-1155 tokens to support Non-Fungibility (unique owners). By implementing this extra function, EIP-1155 tokens can benefit from EIP-721’s core functionality without implementing the (less efficient) EIP-721 specification in the same contract.

Motivation

Currently, EIP-1155 does not allow an external caller to detect whether a token is truly unique (can have only one owner) or fungible. This is because EIP-1155 do not expose a mechanism to detect whether a token will have its supply remain to be “1”. Furthermore, it does not let an external caller retrieve the owner directly on-chain.

The EIP-1155 specification does mention the use of split id to represent non-fungible tokens, but this requires a pre-established convention that is not part of the standard, and is not as simple as EIP-721’s ownerOf.

The ability to get the owner of a token enables novel use-cases, including the ability for the owner to associate data with it.

Specification

The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY” and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

Contract Interface

interface IERC1155OwnerOf {

    /// @notice Find the owner of an NFT
    /// @dev The zero address indicates that there is no owner: either the token does not exist or it is not an NFT (supply potentially bigger than 1)
    /// @param tokenId The identifier for an NFT
    /// @return The address of the owner of the NFT
    function ownerOf(uint256 tokenId) external view returns (address);
}

The ownerOf(uint256 tokenId) function MAY be implemented as pure or view.

The supportsInterface method MUST return true when called with 0x6352211e.

Rationale

ownerOf does not throw when a token does not exist (or does not have an owner). This simplifies the handling of such a case. Since it would be a security risk to assume all EIP-721 implementation would throw, it should not break compatibility with contract handling EIP-721 when dealing with this EIP-1155 extension.

向后兼容性

This EIP is fully backward compatible with EIP-1155.

Security Considerations

Needs discussion.

Copyright and related rights waived via CC0.

参考文献

Please cite this document as:

Ronan Sandford, "EIP-5409: EIP-1155 Non-Fungible Token extension [DRAFT]," Ethereum Improvement Proposals, no. 5409, July 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5409.