This is a simple example of how to use zkSync Era with Hardhat. It will help you to deploy your first zkSync smart contracts, interact with them, and automatically verify its source code on zkSync Era Block Explorer.
- Install dependencies
npm install
- Rename or copy file
.env.example
to.env
and fill in the private key of the account you want to use for deployment.
-
Compile contracts
npm run compile
-
Deploy contracts:
-
Greeter - this is a simple contract that allows you to set a greeting message and read it. It will also log SetGreeting event when you set a new greeting message.
npm run deploy greeter.ts
-
ERC20 Token - this is a multifile contract that will let you deploy your own custom token to zkSync 2.0.
- Fill in the values for your token in
deploy/erc20.ts
- Deploy the contract
npm run deploy erc20.ts
- Fill in the values for your token in