Skip to content

celo-academy/erc-4337-custom-paymaster

Repository files navigation

Allowlist Paymaster using ThirdWeb SDK

This is the implementation of Allowlist Paymaster, a paymaster that allows a list of UserOperation senders to be sponsored by the paymaster

Table of Contents

Installation

Clone the repo

git clone https://github.com/celo-academy/erc-4337-custom-paymaster.git

Install dependencies

yarn install

Usage

Step 1: Deploy the AllowlistPaymaster

  • Create a .env file and copy the contents of .env.example into it
  • Get the Private Key of the owner of the Paymaster and place it in the .env file
  • Open the file scripts/deploy.js, Entrypoint are frequently upgraded make sure the variable ENTRYPOINT_ADDRESS has the correct value
  • Run the deploy script to deploy the paymaster using the following command
npx hardhat run scripts/deploy.js --network alfajores
  • Copy the paymaster address that you get in the terminal, this is the value for ALLOWLIST_PAYMASTER_ADDRESS
  • Get THIRDWEB_API_KEY from the ThirdWeb Dashboard
  • Place the key in .env file
  • Replace variables PAYMASTER_OWNER (this is the public key corresponding the private key of the paymaster owner), and ALLOWLIST_PAYMASTER_ADDRESS with the values you have

To run the transaction script and perform a UserOperation use the following command

yarn dev

Optional:

You can verify the paymaster by using your Celoscan key in .env file and use the following command

npx hardhat verify [PAYMASTER_ADDRESS] [ENTRYPOINT_ADDRESS] [PAYMASTER_OWNER_ADDRESS] --network alfajores

Features

  • Customize the allowList in index.js to allow sponsorship of smart accounts by the paymaster

Doubts?

Join Office Hours in Celo discord

About

ERC4337 Allowlist Paymaster

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •