Paymaster-examples is a series of ERC-4337 Paymaster contracts by 0xSilas which are able to sponsor gas fees for authorized senders.
- Give free transactions based on owning a NFT of a certain collection.
- Give free transactions based on a token-bound account(ERC6551) of a certain collection.
The contract inherits from BasePaymaster.
- constructor: Initializes the Paymaster contract with the given parameters.
- validatePaymasterUserOp: Validates a paymaster user operation for the transaction.
Deploy the Paymaster contract, providing the required parameters such as EntryPoint contract, ERC6551 registry address and NFT token contract addresses. For more information, please refer to the comments within the contract source code.
This repository uses foundry for development, and assumes you have already installed foundry.
Foundry is used for unit tests
- install dependencies
npm install
forge install
- run tests
forge test