Skip to content

How to deploy a smart-contract to ZERϴ

Deploying a smart contract to ZERϴ is a straightforward process that is similar to deploying contracts on zkSync Era. The only difference lies in the network settings, which can be set differently depending on the tooling.

Below we describe the process for both Hardhat and Foundry.

Hardhat

Hardhat is the most popular tool for development, testing, deploying and verifying contracts.

Set up plugins

To make Hardhat compatible with the ZERϴ Network, add zkSync's plugins to Hardhat's configuration file.

The main plugin you will need is @matterlabs/hardhat-zksync. It incapsulates all the necessary plugins and provides convenient methods to access them.

For compiling smart contracts written in Solidity or Vyper, you'll use @matterlabs/hardhat-zksync-solc or @matterlabs/hardhat-zksync-vyper respectively.

You will also need @matterlabs/hardhat-zksync-deploy for deploying regular smart contracts and @matterlabs/hardhat-zksync-upgradable for upgradable smart contracts.

Click here to learn more about these plugins and their configurations.

Configure networks

The following is an additional network setting required to work with ZERϴ Network.

tsx
networks: {
  zeroTestnet: {
    url: 'https://rpc.zerion.io/v1/zero-sepolia',
    zksync: true,
    ethNetwork: 'sepolia',
    verifyURL: 'https://api-explorer.zero.network/contract/contract_verification'
  }
}

Foundry

Install forked version of Foundry

Instead of the official version of foundry, foundry-zksync should be used. It is a specialized fork of Foundry, tailored for zkSync Stack networks. Note, that foundry-zksync is currently in its alpha stage.

The full instructions for installation and initial setup can be found here.

Network parameters

All foundry commands have additional --rpc-url , --chain , and --zksync parameters.

The following is the example use of these parameters in ZERϴ Network case.

tsx
--rpc-url https://rpc.zerion.io/v1/zero-sepolia --chain 4457845 --zksync