ERC-5187 EIP-1155 Rental Usage Rights Extension (Extend EIP-1155 with rentable usage rights)
Stagnant · NFTs & multi-token · created 2022-04-17
Adds a rental function to EIP-1155 tokens, separating ownership from usage rights. The owner can lend usage rights to multiple users for a fixed term, and the smart contract automatically reclaims them upon expiration.
Why it is needed
EIP-721 and EIP-1155 have focused on proving ownership of unique assets. However, as NFTs increasingly see actual use, such as game items or media assets, demand has grown for borrowing them for a limited period without owning them. Previously, such rentals had to rely on over-collateralization, centralized custody, or pure trust: the renter would post collateral worth the NFT's value, a third party would hold the asset in escrow, or the parties would simply trust each other, and returning the asset at expiration had to be handled manually. This made it difficult for a decentralized NFT rental market to take hold.
What to implement
event Rented(uint256 indexed id,address indexed user,uint256 amount,uint256 expire);: An event emitted when a user is granted a rental of an NFT.event Renew(uint256 indexed id,address indexed user,uint256 expire);: Emitted when a renew call succeeds, recording the new expiration time.event Sublet(uint256 indexed id,address indexed from,address to);: Emitted when usage rights are transferred (subletted) to another user.event TakeBack(uint256 indexed id, address indexed user, uint256 amount);: Emitted when the owner reclaims usage rights from a renter.function safeRent(address from,address to,uint256 id,uint256 amount,uint256 expire) external;: The owner lends the usage rights of a given token to another address, specifying an amount and an expiration time.function takeBack(address user,uint256 tokenId) external;: Reclaims usage rights from a user after the rental period has ended.function propertyRightOf(uint256 id) external view returns (address);: Returns the address of the property right holder (owner) of the given token.function totalSupply(uint256 id) external view returns (uint256);: Returns the total supply of the given token.function expireAt(uint256 id,address user) external view returns(uint256);: Returns the expiration time of a particular user's rental.function renew(address user,uint256 id,uint256 expire) external;: Extends the expiration time of an existing rental to a new value.function sublet(address to,uint256 id) external;: Transfers (sublets) usage rights held by a user to another address.
In depth
Separation of ownership and usage rights
propertyRightOf(id) returns the address of the token's property right holder (owner), which is distinct from the renter who received usage rights via safeRent. The owner transfers only usage rights through safeRent while retaining ownership, and can still transfer the NFT itself to someone else even during the rental period.
Multiple rentals via safeRent
safeRent(address from,address to,uint256 id,uint256 amount,uint256 expire) lends the usage rights of token id from from to to, in the given amount, up until the expire time, under from's approval. If a token has multiple units, the owner can simultaneously lend to several users for different terms.
Checking expiration and reclaiming
expireAt(id,user) returns the expiration time of a particular user's rental. Once a rental expires, the owner can call takeBack(user,tokenId) to reclaim the usage rights, which emits a TakeBack event.
Resubletting usage rights via sublet
Calling sublet(address to,uint256 id) lets the user currently holding usage rights transfer them to another address to without the owner's consent. This call emits a Sublet event. If a user sublets their usage rights back to the owner, this has the effect of an early return before the rental period ends.
Extending the term via renew
renew(address user,uint256 id,uint256 expire) changes the expiration time of user's rental of token id to the new expire value. A successful call emits a Renew event. According to the original Rationale, a user may ask the owner to perform this renewal on their behalf.
ERC-165 identifier and inheritance
This interface, IRental, has the ERC-165 identifier 0x6938e358 and is defined to inherit from IERC165 and IERC1155.
Backward compatibility with EIP-1155
Since this standard is an extension of EIP-1155, it is fully backward compatible with EIP-1155.
Proposal status
This proposal is currently in Stagnant status, and its Security Considerations section is written only as "Needs discussion," meaning security review has not yet been completed. In other words, this specification has changed or stalled and may be revised in the future.