Author’s information
My name is Nestor Campos, I am a builder and entrepreneur in the Web3 sector.
Email: nescampos_18 [at] hotmail.com
Telegram: nescampos
Twitter/X: nes_campos
Discord: nescampos
Simple Summary
NFT with time limit for subscription models.
Abstract
This proposal (NIP) helps the creation of temporary NFTs, with a time limit attribute for their validity (without the user losing ownership of this asset), and which can be used in applications with subscription models, among others.
Motivation
The advance in the use of NFTs in applications (both Web2 and Web3) has made these systems increasingly use this type of token to validate a user’s membership in a community. But to validate the validity of this membership, it becomes complex, either through the minting date or another series of calculations. This is why adding an attribute of the NFT’s expiration date allows many dApps to verify if the user is still a member of a community to continue using it. In turn, it allows the user to maintain more than one NFT for the same community (with a different validity date), and this helps other dApps to verify the user’s commitment to the community (by having an NFT again when the previous one expires), which can generate more ideas or models for applications for the NFT ecosystem and DAOs.
Rationale
This NIP is based on the growth of apps that are using NFT to validate access for users, but are facing the challenge of maintaining a subscription-based model, as they must verify the time window for this access, and many apps use the minting date plus an internal calculation, which does not help simplify the process.
For example, for a new Netflix-type dApp, a user who pays for the subscription will receive an NFT with a time limit on its validity (30, 60, 90 days, or another value). Subsequently, the user will use that NFT to validate his/her access and use the platform, or gift it to another person so that they can use the NFT to access the dApp.
For a subsequent period, when the NFT approaches its expiration date, the user will have to pay for the subscription again, receiving a new NFT with an expiration date.
This helps a recurring model for dApps, paying only for what users want to use, and the community to see the loyalty of a user towards a dApp (by verifying the number of NFTs acquired, or another way).
Specification
-
Objective: Add a deadline attribute to the NFT, which is independent of its functionality, but helps the dApp validate the validity or expiration of the user’s membership.
-
Implementation: The following implementation is proposed, through the INFExpiration interface
// Interface for NFT validity
interface INFTExpiration {
function isNFTExpired(uint256 tokenId) external view returns (bool);
uint256 public _expirationDate;
}
An example implementing a NFT with INFTExpiration:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract SimpleNFT is ERC721, Ownable, INFTExpiration {
// Counter to assign unique identifiers to NFTs
uint256 private _tokenIdCounter;
constructor(string memory name, string memory symbol, uint256 expirationDate) ERC721(name, symbol) {
_tokenIdCounter = 1;
_expirationDate = expirationDate;
}
// Function to create a new NFT
function mint(address to) external onlyOwner {
uint256 tokenId = _tokenIdCounter;
_safeMint(to, tokenId);
_tokenIdCounter++;
}
// Method to transfer an NFT to another owner
function transferNFT(address to, uint256 tokenId) external onlyOwner {
require(_isApprovedOrOwner(msg.sender, tokenId), "Not approved");
_safeTransfer(ownerOf(tokenId), to, tokenId, "");
}
function isNFTExpired(uint256 tokenId) external view override returns (bool) {
require(_exists(tokenId), "NFT does not exist");
return block.timestamp > _expirationDate;
}
}
- Use Case Scenarios:
-
Subscription models: Where users have a temporary membership.
-
Temporary ownership: Where a user holds an asset for a certain period of time (as a custodian or in another role).
-
Events: NFTs that are only valid for one day and then expire, regardless of their use.
Open-source commitment
I commit to open-sourcing the NIP and grant permission for developers within the Mint blockchain ecosystem to build protocols and applications based on this NIP.