Skip to content

About

Time-boxed transferable membership NFT: buy/renew a pass priced per period, isValid() access gate, expiry stacks on early renew, bounded issuer fee, accounting invariant

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

access-pass

A time-boxed, transferable membership NFT. An issuer sells passes priced per fixed period; buyers mint a pass valid for one period and renew to extend it; isValid(id) is the on-chain access gate. Passes are ordinary ERC-721s, so a membership can be sold or transferred. Unlock-Protocol-style, minimal. MIT.

Flow

  • mint(to) — pay pricePerPeriod, receive a pass valid until now + period.
  • renew(id) — pay to extend by one period, measured from max(now, currentExpiry): a lapsed pass restarts from now, an early renewal stacks on the remaining time. Anyone can renew any pass (gift a membership); ownership doesn't change.
  • isValid(id) — true while the pass exists and expiry >= now. This is what your app gates on.
  • withdrawProceeds(to, amount) — issuer withdraws collected payments (net of an optional bounded fee).

An optional protocol fee (≤ 10%) is routed to a fee recipient on each payment; the rest is the issuer's.

Invariants & tests

  • Accounting (fuzzed, fail_on_revert=true, non-hollow, 12,800 calls) — the contract's pay-token balance always equals the issuer's withdrawable proceeds (the fee is pushed out on collect; nothing else accrues).
  • Expiry monotonic — renew never decreases a pass's expiry (asserted in the fuzz handler and unit tests). Mutation-checked (renewing from now instead of max(now, expiry) fails the early-stack test).
  • Transferable-and-validity-travels, lapse/restart, gift-renew, issuer-only withdraw, zero-price free passes, constructor bounds.

Trust model (honest)

  • The issuer sets the price/period and collects proceeds; buyers get exactly what they pay for (a period of validity) and can trade the pass. No admin path to a holder's pass or to proceeds beyond the issuer's own withdrawal.
  • Standard ERC-20 pay token assumed. Unaudited reference implementation.
forge test   # 11 tests: mint/renew/lapse/gift, transferable gate, fee routing, accounting invariant

About

Time-boxed transferable membership NFT: buy/renew a pass priced per period, isValid() access gate, expiry stacks on early renew, bounded issuer fee, accounting invariant

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages