DCIPs/EIPS/eip-5409.md

2.8 KiB

eip title description author discussions-to status type category created requires
5409 EIP-1155 Non-Fungible Token extension Allow EIP-1155 to represent Non-Fungible Tokens (tokens who have a unique owner) Ronan Sandford (@wighawag) https://ethereum-magicians.org/t/eip-5409-non-fungible-token-extension-for-eip-1155/10240 Stagnant Standards Track ERC 2022-07-23 165, 721, 1155

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.

Backwards Compatibility

This EIP is fully backward compatible with EIP-1155.

Security Considerations

Needs discussion.

Copyright and related rights waived via CC0.