ERC-5501 NFT rental and delegation extension (Rental & Delegation NFT - EIP-721 Extension)

Stagnant · NFTs & multi-token · created 2022-08-18

Adds a 'user' role to ERC-721, separate from the owner, so an NFT can be lent out or delegated to another wallet while remaining in the owner's wallet.

Why it is needed

In ERC-721, only the owner can enjoy the token's benefits. There are many cases, such as game assets, metaverse land, and event tickets, where separating ownership from usage would be useful, but the standard itself makes no such distinction. Existing lending approaches commonly rely on staking, where the NFT is deposited into a contract as collateral; in that case the owner effectively gives up ownership and loses owner benefits such as airdrops or free mints. Also, if the owner can reset the user at any time, the lender can revoke usage rights during the lending period at will, leaving the borrower unprotected. Delegation has the same problem: if someone only wants to hand usage rights to a hot wallet, without a standardized method every service ends up using its own ad hoc workaround.

What to implement

In depth

Scope of authority for the user role

The user is not the owner and cannot execute transfers or approvals. Beyond that, exactly what specific rights are granted to the user is left to the implementing contract to define.

setUser call conditions and rental protection

setUser should only be callable by the owner or an approved operator (SHOULD revert otherwise), and the user address must not be zero. If userIsBorrowed is true and userExpires is greater than or equal to block.timestamp, setUser must revert.

Handling the user on transfer

When a token is transferred, the user must be reset if it is not currently borrowed, and must remain unchanged if it is currently borrowed.

EIP-165 interface identifier

IERC5501 is 0xf808ec37, IERC5501Balance is 0x0cb22289, IERC5501Enumerable is 0x1d350ef8, and IERC5501Terminable is 0x6a26417e. supportsInterface(0xf808ec37) must return true.

Balance and Enumerable extensions

Both are optional. userBalanceOf should revert for the zero address, and tokenOfUserByIndex should handle the case where the address is zero or the index is greater than or equal to userBalanceOf. How to determine expiry of user status and reflect it in balance is left to the implementation.

Terminable extension: early termination

setBorrowTermination records the agreement of the calling party (lender = ownerOf, borrower = userOf); if both are the same address, it records agreement from both sides at once. getBorrowTermination returns each party's agreement status separately. terminateBorrow only executes once both parties have agreed, and must revert otherwise. On success it should (SHOULD) change isBorrowed from true to false. On transfer, the termination agreement status of a token that was being borrowed must be reset.

The meaning of retaining ownership

Because the token stays in the owner's wallet even while on loan, benefits such as receiving airdrops, claiming free mints, and keeping a sale listing active are preserved. Existing collateral (staking) based rental approaches required a separate implementation to obtain these benefits.

Proposal status

This proposal is a follow-up to EIP-4400 and EIP-4907, written on 2022-08-18, but its current status is Stagnant, with discussion stalled.

Things to watch out for

Original ERC · ← ERCs