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.
If you're stumbling upon any issues or uncertainties:
- ๐ Explore the custom paymaster tutorial for a comprehensive walkthrough of the code in this repository.
- ๐ฃ๏ธ Or simply reach out on Discord. We're always here to help!
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.
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 theuse-paymaster.ts
script.yarn test
: Runs tests. Make sure to check the test requirements below.
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....
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)