🌐ERC-XXXX: Reservable Token Standard
✨ Simple Summary
📜 Abstract
🎯 Motivation
🧩 Specification
Interfaces
interface IReservableToken {
/// @notice Lists a token, making it available for reservation
/// @param _tokenId The ID of the token to list
function listToken(uint256 _tokenId) external;
/// @notice Unlists a token, removing it from the reservation system
/// @param _tokenId The ID of the token to unlist
function unlistToken(uint256 _tokenId) external;
/// @notice Requests a reservation for a specific time range
/// @param _tokenId The ID of the token to reserve
/// @param _start The start timestamp of the reservation
/// @param _end The end timestamp of the reservation
function reservationRequest(uint256 _tokenId, uint32 _start, uint32 _end) external;
/// @notice Cancels a pending reservation request
/// @param _reservationKey The unique key identifying the reservation
function cancelReservationRequest(bytes32 _reservationKey) external;
/// @notice Confirms a pending reservation request
/// @param _reservationKey The unique key identifying the reservation
function confirmReservationRequest(bytes32 _reservationKey) external;
/// @notice Denies a pending reservation request
/// @param _reservationKey The unique key identifying the reservation
function denyReservationRequest(bytes32 _reservationKey) external;
/// @notice Cancels an existing booking
/// @param _reservationKey The unique key identifying the reservation
function cancelBooking(bytes32 _reservationKey) external;
/// @notice Retrieves reservation details by reservation key
/// @param _reservationKey The unique key of the reservation
/// @return Reservation struct containing reservation data
function getReservation(bytes32 _reservationKey) external view returns (
uint256 labId,
address renter,
uint96 price,
uint32 start,
uint32 end,
uint status
);
/// @notice Checks if a reservation is actively booked by a user
/// @param _reservationKey The reservation key to check
/// @param _user The address of the user
/// @return True if the user has an active booking
function hasActiveBooking(bytes32 _reservationKey, address _user) external view returns (bool);
/// @notice Returns the address of the user who owns the reservation
/// @param _reservationKey The reservation key
/// @return Address of the user
function userOfReservation(bytes32 _reservationKey) external view returns (address);
/// @notice Checks whether a token is listed as reservable
/// @param _tokenId The token ID to check
/// @return True if listed, false otherwise
function isTokenListed(uint256 _tokenId) external view returns (bool);
/// @notice Checks if a token is available for reservation in a given time range
/// @param _tokenId The ID of the token
/// @param _start The start time of the requested reservation
/// @param _end The end time of the requested reservation
/// @return True if the time range is available
function checkAvailable(uint256 _tokenId, uint256 _start, uint256 _end) external view returns (bool);
}
🤔 Rationale
🔐 Security Considerations
🛠️ Reference Implementation
⚖️ Copyright
🔄 Extension: ReservableTokenEnumerable
✨ Features Added
📦 Key Functions
🧪 Libraries Used
🧠 Use Cases Enhanced
📣 Events
💎 Compatibility: EIP-2535 Diamond Standard
🏗️ Facet Architecture
📐 Recommended Setup
🔐 Access Control & Security
🧩 Benefits of Diamond Integration
Last updated