Description

This extension enables associating an expiry date per token id. It then allows both smart contracts and off-chain entities to query whether tokens with a specific id are expired or not.

The expiry date is stored on chain as a unix timestamp in seconds.

Interface

Expiry Date Query

/**
 * @dev Returns the expiry date for tokens with a given `id`.
 */
function expiryDate(uint256 id) external view returns (uint256);

Verifying if tokens are expired

/**
 * @dev Returns whether tokens are expired by comparing their expiry date with `block.timestamp`.
 */
function isExpired(uint256 id) external view returns (bool);

Implementation

Setting an expiry date

/**
 * @dev Sets the expiry date for the tokens with id `id`.
 */
function _setExpiryDate(uint256 id, uint256 date)

Setting expiry dates for a batch

/**
 * @dev [Batched] version of {_setExpiryDate}.
 */
function _setBatchExpiryDates(uint256[] memory ids, uint256[] memory dates)