ERC-5187 · Stagnant · ERC · 2022-04-17
ERC-5187: Extend EIP-1155 with rentable usage rights
An ERC-1155 extension that separates ownership from time-limited usage rights, so one owner can rent an NFT to several users at once, with sublets, renewals and take-back after expiry.
What problem does it solve?
NFT rental has typically relied on over-collateralization, a custodian or trust. A game guild lending items to new players, or an artist leasing a work to a media outlet for a period, needs a way to hand over use without handing over ownership, and to get it back automatically when the term ends.
ERC-5187 extends ERC-1155 so that usage rights become separate, transferable, expiring units. The owner keeps the property right and can even sell it during a lease without affecting tenants.
How it works
The IRental interface (ERC-165 ID 0x6938e358) adds:
| Function | Purpose |
|---|---|
safeRent(from, to, id, amount, expire) |
Rent amount usage rights of token id to to until expire |
takeBack(user, tokenId) |
Owner reclaims usage rights after the lease ends |
renew(user, id, expire) |
Extend a user's lease |
sublet(to, id) |
A user passes their usage right to another user |
propertyRightOf(id) |
The owner of the property right |
expireAt(id, user) |
When a user's lease ends |
totalSupply(id) |
Total supply of a token ID |
Events Rented, Renew, Sublet and TakeBack track the lifecycle.
Key ideas from the rationale:
- One owner can rent usage rights to many users at the same time with different terms.
- Users can sublet freely; subletting back to the owner is how early return works.
- Renewal is requested from the owner, who calls
renew.
Sample code
Checking whether a player may use an item right now:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface IRental {
function expireAt(uint256 id, address user) external view returns (uint256);
function propertyRightOf(uint256 id) external view returns (address);
}
contract Game {
IRental public immutable items;
constructor(IRental _items) {
items = _items;
}
function canUse(address player, uint256 itemId) public view returns (bool) {
if (items.propertyRightOf(itemId) == player) return true; // owner
return items.expireAt(itemId, player) > block.timestamp; // active tenant
}
}
The spec does not state whether expire is a timestamp or a duration; this example assumes a Unix timestamp.
Things to know
- Status is Stagnant, and the spec's security considerations say only "Needs discussion".
- Several details are underspecified (units of
expire, who may calltakeBackandrenew, how usage rights relate to ERC-1155 balances). Read the implementation you depend on. - For ERC-721, the Final ERC-4907 adds a single time-limited
userrole, and ERC-5006 adds user records for ERC-1155; both are more widely referenced.