Skip to content

Gasless Membership Club (ERC-4337 + ERC-721)

CI Pages Open in Codespaces

Idea: Gasless membership club: each member gets a smart account (account abstraction) and mints a membership NFT without holding ETH; the club sponsors gas with a paymaster and an admin role manages who is allowed.

This repository was composed automatically by Blockchain Lab Forge. Forge parsed the idea into capabilities (account-abstraction, nft, access-control), retrieved matching components from the Blockchains fork index, pinned them to release tags, copied their exact source files (with full import closure) from the Blockchains forks, and added glue code, tests, a deploy script and a web front end.

What it does

  • MembershipNFT (glue, MIT). One membership pass per approved account. An APPROVER_ROLE manages the allowlist. Passes are non-transferable by default, and an admin can enable transfers.
  • ClubPaymaster (glue, GPL-3.0, extends eth-infinitism BasePaymaster v0.9.0). It sponsors gas for exactly one operation: an approved account that is not yet a member calling MembershipNFT.join() through its smart account.
  • Members use eth-infinitism SimpleAccount smart accounts, deployed counterfactually by SimpleAccountFactory in the same UserOperation that mints the pass. They need no ETH at any point.

Run it

git clone --recursive https://github.com/Blockchains/forge-example-gasless-membership && cd forge-example-gasless-membership
forge test -vv            # 5 local tests on the real v0.9.0 EntryPoint + 1 Sepolia fork test on the canonical EntryPoint 0x4337...D009
cd web && npm ci && npm run dev   # front end: live Sepolia reads + one-click wallet deployment
forge script script/Deploy.s.sol --rpc-url $SEPOLIA_RPC_URL --account deployer --broadcast

Live front end: https://blockchains.github.io/forge-example-gasless-membership/

Layout

src/MembershipNFT.sol, src/ClubPaymaster.sol      glue code
test/GaslessMembership.t.sol                      local + Sepolia-fork tests
script/Deploy.s.sol                               deploy factory, club, paymaster (+ deposit)
lib/account-abstraction/... lib/openzeppelin-contracts/...   copied sources (pinned tags v0.9.0, v5.7.0)
lib/forge-std                                     submodule (Blockchains/forge-std)
web/                                              Vite + viem front end (GitHub Pages)
component-map.json, plan.json, NOTICE             provenance

Component map

Capability Component From Licence
account-abstraction (primary) BasePaymaster Blockchains/account-abstraction (upstream eth-infinitism/account-abstraction) MIT
account-abstraction (companion) SimpleAccount Blockchains/account-abstraction (upstream eth-infinitism/account-abstraction) MIT
account-abstraction (companion) SimpleAccountFactory Blockchains/account-abstraction (upstream eth-infinitism/account-abstraction) MIT
account-abstraction (companion) EntryPoint Blockchains/account-abstraction (upstream eth-infinitism/account-abstraction) GPL-3.0
nft (primary) ERC721 Blockchains/openzeppelin-contracts (upstream OpenZeppelin/openzeppelin-contracts) MIT
nft (companion) ERC721URIStorage Blockchains/openzeppelin-contracts (upstream OpenZeppelin/openzeppelin-contracts) MIT
access-control (primary) AccessControl Blockchains/openzeppelin-contracts (upstream OpenZeppelin/openzeppelin-contracts) MIT
access-control (companion) Ownable Blockchains/openzeppelin-contracts (upstream OpenZeppelin/openzeppelin-contracts) MIT

Copied sources (unmodified, under lib/<project>/, listed file by file in NOTICE):

Fork Pinned Files
Blockchains/openzeppelin-contracts v5.7.0 42
Blockchains/account-abstraction v0.9.0 23

Machine-readable: component-map.json · plan: plan.json

Use as a building block

For AI agents and builders: read AGENTS.md (setup, commands, structure, rules), llms.txt (doc map) and the machine-readable blocks.json (schema). How all Blockchains blocks fit together: Build with Blocks · org catalogue: https://blockchains.github.io/blocks.json.

What it exports

Export Type Install / access
MembershipNFT solidity forge install Blockchains/forge-example-gasless-membership
ClubPaymaster solidity forge install Blockchains/forge-example-gasless-membership
script/Deploy.s.sol file forge script script/Deploy.s.sol --rpc-url $SEPOLIA_RPC_URL --account <keystore> --broadcast
component-map.json, plan.json file provenance: capability → component → pinned fork commit
web/ web cd web && npm ci && npm run dev

Minimal example (from the repo README; CI runs the same)

git clone --recursive https://github.com/Blockchains/forge-example-gasless-membership && cd forge-example-gasless-membership
forge test -vv                    # local tests on the real v0.9.0 EntryPoint + Sepolia fork test (canonical EntryPoint 0x4337…D009)
cd web && npm ci && npm run dev   # live Sepolia reads + one-click smart-account deployment

Inputs → outputs

  • In: constructor args (Solidity) MembershipNFT(admin, baseURI); ClubPaymaster(IEntryPoint ep, MembershipNFT club, uint256 maxCost, address owner)
  • Out: deployed contracts (EVM); events/errors (ABI) see src/

Composes with

Versioning & stability: reference. Reference output of an automated composer; copied components are pinned to fork release tags (see NOTICE / component-map.json). Not audited. Treat as a starting point and review before deploying with value.

Licence

GPL-3.0-or-later. Includes strong-copyleft files (GPL-3.0); the composed project is distributed under GPL terms. Every copied file keeps its original SPDX header. Attribution is in NOTICE.

Not audited. Review the code yourself before you put real value on mainnet.

Contributing

Issues and pull requests are welcome. Please read the contributing guide, code of conduct and security policy first.


Built by Blockchain Lab — blockchainlab.com

About

Composed by Blockchain Lab Forge: gasless membership NFTs with ERC-4337 smart accounts + sponsoring paymaster (eth-infinitism v0.9.0 + OpenZeppelin v5.7.0 from Blockchains forks)

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages