/custom-paymaster-tutorial

Full example for the custom paymaster tutorial in the documentation

Primary LanguageTypeScript

Custom Paymaster Tutorial ๐Ÿ“–

Welcome aboard to the custom paymaster journey with zkSync! ๐Ÿš€๐ŸŒŒ

This repository is crafted to guide you through the process of building a custom paymaster on zkSync Era. Coupled with this, you'll find a practical, easy-to-follow guide to implement and understand every step here.

Need Assistance? ๐Ÿ’ก

If you're stumbling upon any issues or uncertainties:

Repository Overview ๐Ÿ“‚

Dive into the key sections of this repository:

  • /contracts: All the essential smart contracts you need are neatly stored here.

  • /deploy: Discover deployment and usage scripts tailored to assist your development process.

  • /test: Unit tests for the provided contracts.

Handy Commands ๐Ÿ› ๏ธ

Here's a lineup of commands to assist you:

  • yarn install: Installs the required dependencies.
  • yarn compile: Compiles the contracts.
  • yarn hardhat deploy-zksync --script deploy-paymaster.ts: Deploys your contracts smoothly.
  • yarn hardhat deploy-zksync --script use-paymaster.ts: Executes the use-paymaster.ts script.
  • yarn test: Runs tests. Make sure to check the test requirements below.

Environment variables ๐ŸŒณ

To prevent the leakage of private keys, we use the dotenv package to load environment variables. This is particularly used to load the wallet private key, which is required to run the deployment script.

To use it, rename .env.example to .env and input your private key.

WALLET_PRIVATE_KEY=123cde574ccff....

Local testing ๐Ÿงช

To run tests, you'll need to start the zkSync local environment. Please refer to this section of the docs for details. It can be run with either the Dockerized setup or the In-memory node.

Without starting the zkSync local environment, the tests will fail with an error: Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.7.2)

Stay Connected ๐ŸŒ