ERC721S Overview
ERC721S is an Ethereum subscription contract built on ERC721 for subscription-based services. It creates non-transferable subscription tokens tied to user addresses, supporting subscription management on-chain.
Key Features
- Non-Transferable Design - Tokens cannot move between addresses, preventing secondary market trading and ensuring subscriptions stay with the designated subscription owner
- Address-Derived Token IDs - Each wallet's token ID is deterministically calculated from its address
- Flexible Duration Options - The deployer sets purchase-duration bounds and an accumulated-time limit; the owner can update them
- Configurable Pricing - The contract owner can configure a separate price-per-second rate for each enabled payment token
- Subscription Extension - Active subscribers can extend their subscription without creating new tokens
- Reentrancy Protection - Uses OpenZeppelin’s ReentrancyGuard on subscription purchases
- Two-Step Ownership - Uses Ownable2Step so a proposed owner must accept ownership
How It Works
- A payer calls
subscribe()with a subscription owner, duration, and either native ETH or an ERC20 authorization - If the subscription owner has no token, one is minted with an ID derived from that owner’s address
- The subscription expiration timestamp is set or extended
- Users can check their subscription status at any time
- Payments are forwarded to the configured recipient; the owner can update pricing and withdraw any retained balances
Supported ERC20 payment tokens must implement EIP-3009 receiveWithAuthorization. Subscriptions do not auto-renew: each purchase or extension requires a transaction.
Use Cases
- SaaS Access Control - Gate access to software services based on subscription status
- Content Subscriptions - Manage access to premium content
- Membership Programs - On-chain membership verification
- Service Licensing - Time-limited access to on-chain or off-chain services
Source Code
View the source code and contribute on GitHub: vorpalengineering/ERC721S