-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERC: Renting Standard for Rival, Non-Fungible Tokens #809
Comments
Hi Steven, I like the idea. You can check this article/code I wrote a while ago about renting smart contracts (it's specifically about renting smart contracts and not NF tokens), if it helps: https://hackernoon.com/renting-items-on-the-blockchain-de4e2663dfc6 I'm concerned about the way a reservation is made and checked:
If I understand correctly, you propose storing each time that falls within |
Hi Pablo, thanks for the feedback. Just checked out your article and Rentable contract. It looks good. Have you thought of a different way of using your rentable contract to make reservations in the future? For example, with movies this wouldn't matter since many people can rent simultaneously (the good is non-rival), but in the case of renting a seat on an airplane, rental car, or hotel room, you would want to know that you alone have access to that asset at a specific time. I totally agree with the issue of renting by the second. My idea is use (as in your rentable idea) a minimum unit of rent. For example, to rent by the hour we could say This does still pose potential rounding issues, but then I think we could find a reasonable tolerance around the rent date (i.e. search the |
I’m also interested in this and would plan to implement it in my next project. |
I heard Arthur Camara of CrypoKitties on The Blockchain Guy podcast. Arthur talked about ERC-721. I can't help but think how your functions give more power to the participants. While CrypoKitties maintain ultimate control of the tokens(kitties) via their marketplace. @slee981 What are your thoughts on how much control over a token should fall under the owner vs fall under some kind of marketplace overseer? |
This is great! Are you thinking this would also work for time sharing for others to be able to re-rent their timeshare? Also, this looks like it could also work for items? |
@finnious I think the main reason that the CryptoKitties creators may have so much control over their tokens is that standard wallets aren't yet compatible with the ERC-721 interface. Thus, they control the interaction. Same applies here. Wallets will most likely adapt once there are more applications that use non-fungible tokens, and hopefully the same applies for renting. |
@jruffer in principle this should work with timeshares, but depends on how payments are incorporated. Right now I see a few options:
Timeshares could probably be made feasible by applying a modified version of this rental standard on top of an existing rental agreement. For example, if you rent a beach house from someone, you could open up a second rentable token on top of their token, but only for the dates you've reserved. |
If the minimum times are going to be standard throughout the contract (i.e. daily for hotel, or hourly for bike rental). Instead of having minimum times, you could partition each tokens time by that time block. For a hotel each individual day would in essence be its own token within each NFT room token. So lets say initialTime is noon (43200) and each _timeBlock is a day (86400), and _startTime is the starting date someone wants to reserve something. Then the mapping would be That way the tokens are more uniform and are able to trade timeblocks between people |
May I suggest that we work towards making individual reservations NFTs conformant to ERC821/721? This would allow reusing contracts that handle these kinds of NFTs for individual reservations, and reimplementing e.g. transfers, auctions and sales could be avoided. Also it is not entirely clear to me how this compares to ERC #808, it appears there is some overlap which would allow either a cross-compatible subset or merging? |
This looks really promising not just for accomodation reservation but like laid out in the proposal, it can be applicable to other rival goods. It is helpful to create some toy implementations of different use cases and it can help us decide what is the largest common denominator that should make into the interface specification. I started a basic implementation of a virtual ads billboard. The idea is to simulate renting out a virtual space on your website for ads. People can bid on ad impression for a future period. It is not intended to be a real product but for exploring flexibility of ERC809 only since BookLocal already demonstrated its use on accomodation. I intend to make a front-end eventually but for now, you can refer to the test cases on its usage. A lot of what I have here is a working in progress but I feel there is enough progress to get some feedbacks and I want to incorporate your ideas and suggestions to the iterations. Availability StorageWe can avoid storing reservation for each time unit by only storing start and stop timestamp in a sorted treemap. It translates the problem into a calendar scheduling problem that can be solved in O(logn) for each insertion and lookup w.r.t number of reservations in the system. I started a treemap implementation under solidity-treemap (WIP. Again see tests for its usage.) I found some existing solidity AVL tree implementation but they don't appear to be well documented or tested. I use this treemap to maintain availability here. It is actually pretty simple and sweet with treemap. ERC809 InterfaceI copied Steven's proposal into a contract interface here with some modifications. @slee981 Can you share some concrete examples on what you had in mind for I have some worry over the usefulness of ERC809 is ERC721?I think @hyperfekt has a great idea that ERC809 leases themselves can be ERC721 tokens. Currently, the proposal frames that ERC809 enhances an ERC721 token with the ability to lease out a specific token for a period of time to a renter. Meanwhile, renting/leasing is really just "access", a (usually) non-tangible non-fungible tokenizable resource:
While "access"s are tied to a non-fungible resource, they only provide up to the level of rights they promised. If I rent a room from a home-owner, I don't magically own the home and I cannot make modifications to the home. While each "access" can be rival, a tokenized asset might have different kinds of "access" one can derive. It seems sub-optimal to tightly couple a specific type of "access" to the token contract itself. In a contrived example, if I deploy an ERC721 Car token, I can have two ERC809 access tokens related to this car:
where car rider reserve the car for a ride and car operator lease the car to drive, and make money by providing rides. Long story short, I think tokenizing access (reservation/booking), isolated from the underlying token contract, enable a lot more interesting capabilities:
|
So I took @hyperfekt's idea and @zemingyu's #1201 and ran with it a bit. I think we come to the realization that ownership and rental rights equally deserve to be a token by themselves. Instead of jamming both in a single contract, what do you all think about composing them with two ERC721 contracts instead like so:
By the way, this was motivated by @shrugs's suggestion in ERC1155 of composing ERC721. Before that, I struggled for a long time on the tradeoff between two tokens: putting them in one contract would put one of them as a second-class citizen, but creating separate contracts doesn't seem have benefit because most of the logic is so intertwined and doesn't allow a separation of concerns. I wrote a Medium post about this exploration and a proof of concept implementation called MeetETH. I appreciate your thoughts and suggestions. |
There has been no activity on this issue for two months. It will be closed in a week if no further activity occurs. If you would like to move this EIP forward, please respond to any outstanding feedback or add a comment indicating that you have addressed all required feedback and are ready for a review. |
This issue was closed due to inactivity. If you are still pursuing it, feel free to reopen it and respond to any feedback or request a review in a comment. |
I am not able to find ERC-809, does it not exists anymore? |
It appears this never got turned into an EIP, it was just an idea that no one ran with. |
I really like this idea. But it would need to be expanded to cater for rentals where there is no pre-determined end date too. I.e., I want to borrow your car, and when I return it, I will then know how much I owe you (i.e., based on a price per minute). I agree the mapping for time incrementals is not efficient, but you could track a binary of whether the item was currently in rental to keep this simple - but then use some kind of trigger to set this to false when the end of the contract occurs. I'm guessing this may be replaced by EIP-4907? |
Preamble
Summary
A standard interface for renting rival non-fungible tokens.
Definitions
Rival good: a good is rival if its consumption by one individual prevents simultaneous consumption by other individuals. For example, driving a car is rival but watching the sunset is non-rival.
Non-Fungible good: a good is non-fungible if it is not interchangeable. For example, cars are non-fungible but Ether is fungible.
Abstract
The following suggests a standard API for renting access to rival non-fungible tokens within smart contracts.
Motivation
A standard interface would allow for any rival non-fungible token (rival NFT) on Ethereum to be handled by general purpose applications for renting purposes. Specifically, this would allow an owner to rent access to their rival NFTs using a standard set of commands, thus allowing users to view all past and current rental agreements from a single wallet interface.
Specifications
ERC-721 Compatibility
This section taken from ERC721. Follow link for a more detailed description of the ERC721 methods.
name
OPTIONAL - It is recommend that this method is implemented for enhanced usability with wallets and exchanges, but interfaces and other contracts MUST NOT depend on the existence of this method.
symbol
OPTIONAL - It is recommend that this method is implemented for enhanced usability with wallets and exchanges, but interfaces and other contracts MUST NOT depend on the existence of this method.
totalSupply
Returns the total number of NFTs currently tracked by this contract.
balanceOf
Returns the number of NFTs assigned to address
_owner
.ownerOf
Returns the address currently marked as the owner of
_tokenID
.approve
Grants approval for address
_to
to take possession of the NFT with ID_tokenId
.transferFrom
Assigns ownership of the NFT with ID
_tokenId
to_to
if and only if_from
has been previously granted approvaltransfer
Assigns the ownership of the NFT with ID
_tokenId
to_to
if and only ifmsg.sender == ownerOf(_tokenId)
. A successful transfer MUST fire the Transfer event (defined below).Basic Renting
reserve
Reserve access to token (
_tokenId
) from time_start
to time_stop
. A successful reservation must ensure each time slot in the range_start
to_stop
is not previously reserved (by calling the functioncheckAvailable()
described below) and then emit a Reserve event. For example, this could be implemented through a double mapping given by,In this case, we could map
_tokenId
to a range of time slots, and each time slot to an address. If each time in the range_start
to_stop
returns address(0), then addreservations[_tokenId][_time] = msg.sender
for every_time
in range_start
to_stop
.Further considerations include adding a reservation price, although this may not be necessary in the case of an auction for rental price.
access
If
msg.sender == reservations[_tokenId][now]
then grant access. Due to the possibility of different units of time preferred in the reservation (i.e. reserving by the second, hour, day, week, and so on),now
may need to be checked to the nearest reservation unit. This is to say that access must ensure thatmsg.sender
has a reservation for that time slot.settle
Removes
_renter
access to_tokenId
and transfers any agreed upon funds only if_renter == reservations[_tokenId][_stop]
. Analogous to checking out of a hotel room or returning a rental car.This function should be callable by either the owner of
_tokenId
or_renter
, however, the owner should only be able to call this function ifnow >= _stop
to prevent premature settlement of funds.checkAvailable
Returns true if
reservations[_tokenId][_time] == address(0)
and false otherwise.cancelReservation
Returns true if
msg.sender == reservations[_tokenId][_time]
for every_time
in range_start
to_stop
and deletes reservation.Events
Transfer
Consistent with ERC721.
Approval
Consistent with ERC721.
Reserve
Must trigger on any successful call to reservation.
Cancel
Must trigger on any successful call to cancelReservation.
Rationale
The Ethereum blockchain provides the opportunity for reimagined distribution systems in asset rental markets (i.e. the travel industry). A community standard would help encourage secure rental contracts with common interfaces, thus allowing renters and owners alike to view all of their rental agreements from a single application.
Implementation
https://github.com/BookLocal/EthMemphis
The text was updated successfully, but these errors were encountered: