L1 contracts interface


L1 contracts interface

To interact with zkSync from L1, you need the interface of its canonical bridge. There are two main ways to import it to your codebase:

  • By importing it from the @matterlabs/zksync-contracts npm package. (preferred)
  • By downloading the contracts from the repoopen in new window.

The guide on interacting with the zkSync canonical bridge with examples in both Solidity and zksync-web3 SDK can be found here.

This page will primarily serve as a quick reference for the interfaces and types you may require, as well as how to import them.

@matterlabs/zksync-contracts reference

  • @matterlabs/zksync-contracts/contracts/interfaces/IZkSync.sol is the file where the zkSync L1 contract interface IZkSync is located. Particular interest is in the IBridge functionality. Its implementation can be found hereopen in new window.
  • @matterlabs/zksync-contracts/libraries/Operations.sol is the file where the Operations library with all the user types in the bridge is stored. Its implementation can be found hereopen in new window.

The code in the repository may contain some of the configuration constants. These are placeholder values taken from the development environment. You should use the library only for the interfaces and types it provides.