Skip to content

Commit

Permalink
Add EIP-5585: EIP-721 NFT Authorization (ethereum#5585)
Browse files Browse the repository at this point in the history
* NFT authorization - ERC721 extension

* Update and rename eip-4966.md to eip-5585.md

* Update eip-5585.md

* Update eip-5585.md

* Update eip-5585.md

* Update eip-5585.md

* + Change CRLF to LF

* Update EIPS/eip-5585.md

* Update EIPS/eip-5585.md

* Update the author and discussion info

* Update the abstract info

* Delete the information

* Updated the description of this EIP

* Update contract interfaces and EIP-5585 content

* Update based on reviewer's suggestions

* Update some descriptions of this EIP.

* Update the sequences of the contract interfaces

* Update some Typos

* Update the EIP-721 reference Link

* Update based on the reviewer's suggestions

* Update the author info

* Update the author info

Co-authored-by: Pandapip1 <45835846+Pandapip1@users.noreply.github.com>
  • Loading branch information
2 people authored and nachomazzara committed Jan 13, 2023
1 parent 12c34ee commit ac44433
Showing 1 changed file with 137 additions and 0 deletions.
137 changes: 137 additions & 0 deletions EIPS/eip-5585.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
---
eip: 5585
title: EIP-721 NFT Authorization
description: Allows NFT owners to authorize other users to use their NFTs.
author: Veega Labs (@VeegaLabsOfficial), Sean NG (@ngveega), Tiger (@tiger0x), Fred (@apan), Fov Cao (@fovcao)
discussions-to: https://ethereum-magicians.org/t/nft-authorization-erc721-extension/10661
status: Draft
type: Standards Track
category: ERC
created: 2022-08-15
requires: 721
---

## Abstract

This EIP separates an [EIP-721](./eip-721.md) NFT's ownership from its commercial usage rights to allow for the independent management of those rights.

## Motivation

Most NFTs have a simplified ownership verification mechanism, with a sole owner of an NFT. Under this model, other rights, such as exhibition, or derivative works, are not possible to grant, limiting the value and commercialization of NFTs. Therefore, the separation of an NFT's ownership and user rights can enhance its commercial value.

With the development of the Metaverse, NFTs are becoming more diverse, with new use cases such as digital collections, virtual real estate, and commercial copyrights. Meanwhile, the commercial rights, such as exhibition, derivative or commercial authorization based on NFTs are becoming a potential business form.


## 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

```solidity
interface IERC5585 {
struct UserRecord {
address user;
uint expires
}
/// @notice NFT holder authorizes his NFT to a user for a specified period of time
/// @dev The zero address indicates there is no user
/// @param tokenId The NFT which is authorized
/// @param user The user to whom the NFT is authorized
/// @param duration The period of time the authorization lasts
function userAuthorization(uint256 tokenId, address user, uint duration) external returns(uint);
/// @notice NFT holder extends the duration of authorization
/// @dev The zero address indicates there is no user
/// @param tokenId The NFT which has been authorized
/// @param user The user to whom the NFT has been authorized
/// @param duration The new duration of the authorization
function durationUpdate(uint256 tokenId, address user, uint duration) external;
/// @notice Get the authorization expired time of the specified NFT and user
/// @dev The zero address indicates there is no user
/// @param tokenId The NFT to get the user expires for
/// @param user The user who has been authorized
/// @return The authorization expired time
function userExpiresTime(uint256 tokenId, address user) external view returns(uint);
/// @notice The contract owner can update the number of users that can be authorized per NFT
/// @param userLimit The number of users set by operators only
function userLimitUpdate(unit256 userLimit) external onlyOwner;
/// @notice resetAllowed flag can be updated by contract owner to control whether the authorization can be revoked or not
/// @param resetAllowed It is the boolean flag
function resetAllowedUpdate(bool resetAllowed) external onlyOwner;
/// @notice Check if the token is available for authorization
/// @dev Throws if tokenId is not a valid NFT
/// @param tokenId The NFT to be checked the availability
/// @return true or false whether the NFT is available for authorization or not
function authorizationAvailabilityCheck (uint256 tokenId) public view returns(bool);
/// @notice Clear authorization of a specified user
/// @dev The zero address indicates there is no user. The function works when resetAllowed is true and it will throw exception when false
/// @param tokenId The NFT on which the authorization based
/// @param user The user whose authorization will be cleared
function resetUser(uint256 tokenId, address user) external;
/// @notice This is an OPTIONAL function that the operator MAY call, he can set the starting time of staking as a reward of the authorization for each user
/// @dev The zero address indicates there is no user
/// @param user To which user the staking time will be set
/// @param stakingTime The starting time of the staking for each user
function stakingTimeUpdate(address[] user, uint[] stakingTime) external;
/// @notice Emitted when the user of a NFT is changed or the authorization expires time is updated
/// param tokenId The NFT on which the authorization based
/// param indexed user The user to whom the NFT authorized
/// param expires The expires time of the authorization
event userAuthorization(uint256 indexed tokenId, address indexed user, uint expires);
}
```


The `userAuthorization(uint256 tokenId, address user, uint duration)` function MAY be implemented as `public` or `external`.

The `durationUpdate(uint256 tokenId, address user, uint duration)` function MAY be implemented as `public` or `external`.

The `userExpiresTime(uint256 tokenId, address user)` function MAY be implemented as `pure` or `view`.

The `userLimitUpdate(unit256 userLimit)` function MAY be implemented as`public` or `external`.

The `resetAllowedUpdate(bool resetAllowed)` function MAY be implemented as `public` or `external`.

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

The `resetUser(uint256 tokenId, address user)` function MAY be implemented as `public` or `external`.

The `stakingTimeUpdate(address[] user, uint[] stakingTime)` function MAY be implemented as `public` or `external`.

The `userAuthorization` event MUST be emittedwhen the user of a NFT is changed or the authorization expires time is updated.

## Rationale

First of all, NFT contract owner can set the maximum number of authorized users to each NFT and whether the NFT owner can cancel the authorization at any time to protect the interests of the parties involved.

Secondly, this EIP combines the functions of staking and authorization, which means the NFT contract owner can update the number of authorized users to NFT owners depending on the period of staking. The function is optional, but it is a way to protect all parties from overhype and to ensure that the price of the NFT is more accurately to match its value.

Thirdly, there is a resetAllowed flag to control the rights between the NFT owner and the users for the contract owner. If the flag is set to true, then the NFT owner can disable usage rights of all authorized users at any time.

Finally, this design can be seamlessly integrated with third parties. It is an extension of EIP-721, therefore it can be easily integrated into a new NFT project. Other projects can directly interact with these interfaces and functions to implement their own types of transactions. For example, an announcement platform could use this EIP to allow all NFT owners to make authorization or deauthorization at any time.

## Backwards Compatibility

This standard is compatible with [EIP-721](./eip-721.md) since it is an extension of it.

## Security Considerations

If someone buys an NFT within the duration of an authorization, they will not have to stake anything, providing no incentive to cancel the authorization.

To solve this problem, the authorization fee paid by the users will be held in an escrow contract for a period of time depending on the duration of the authorization. For example, if the authorization duration is 12 months and the fee in total is 10 ETH, then if the NFT is transferred after 3 months, then only 2.5 ETH would be sent and the remaining 7.5 ETH would be refunded.

## Copyright

Copyright and related rights waived via [CC0](../LICENSE.md).

0 comments on commit ac44433

Please sign in to comment.