/zkSync-era-Hardhat-example

This is a simple example of how to use zkSync Era with Hardhat. It will help you to deploy your first zkSync smart contracts and interact with them.

Primary LanguageTypeScriptMIT LicenseMIT

zkSync Era Hardhat Example

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.

Setup

  1. Install dependencies
    npm install
  2. Rename or copy file .env.example to .env and fill in the private key of the account you want to use for deployment.

Deploying contracts

  1. Compile contracts

    npm run compile
  2. 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

Useful links