Skip to content

Commit

Permalink
docs(readmes): add examples and setup and tables
Browse files Browse the repository at this point in the history
  • Loading branch information
nikola-bozin-txfusion committed Dec 21, 2023
1 parent 20d3d65 commit 8a1fbfe
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 19 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# zkSync 2.0: Welcome to zkSync Hardhat plugins repository
# zkSync Era: Welcome to zkSync Hardhat plugins repository

![Era Logo](https://github.com/matter-labs/era-contracts/raw/main/eraLogo.svg)

zkSync 2.0 is a layer 2 rollup that uses zero-knowledge proofs to scale Ethereum without compromising on security or
zkSync Era is a layer 2 rollup that uses zero-knowledge proofs to scale Ethereum without compromising on security or
decentralization. Since it's EVM compatible (Solidity/Vyper), 99% of Ethereum projects can redeploy without refactoring
or re-auditing a single line of code. zkSync 2.0 also uses an LLVM-based compiler that will eventually let developers
or re-auditing a single line of code. zkSync Era also uses an LLVM-based compiler that will eventually let developers
write smart contracts in C++, Rust and other popular languages.

This repository contains a collection of plugins to aid in the development and deployment of smart contracts on the zkSync network. These plugins are designed to integrate seamlessly with the [Hardhat](https://hardhat.org/) development environment, providing developers with an easy-to-use and powerful toolset.
Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Examples for zkSync 2.0 contracts environment
# Examples for zkSync Era contracts environment

This folder has the following examples:

Expand Down
4 changes: 2 additions & 2 deletions examples/basic-example/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# zkSync 2.0 deploy environment example
# zkSync Era deploy environment example

This project demonstrates how to compile and deploy your contracts in zkSync 2.0 using the Hardhat plugins.
This project demonstrates how to compile and deploy your contracts in zkSync Era using the Hardhat plugins.

## Prerequisites

Expand Down
2 changes: 1 addition & 1 deletion examples/node-example/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# zkSync 2.0 node environment example
# zkSync Era node environment example

This project demonstrates how to run [era-test-node](https://era.zksync.io/docs/tools/testing/era-test-node.html) locally using the zksync's `hardhat-zksync-node` Hardhat plugin for testing purposes.

Expand Down
4 changes: 2 additions & 2 deletions examples/noninline-libraries-example/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# zkSync 2.0 non-inline libraries environment example
# zkSync Era non-inline libraries environment example

This project demonstrates how to compile and deploy your contracts in zkSync 2.0 when there are missing libraries.
This project demonstrates how to compile and deploy your contracts in zkSync Era when there are missing libraries.

## Prerequisites

Expand Down
4 changes: 2 additions & 2 deletions examples/upgradable-example/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# zkSync 2.0 upgradable example
# zkSync Era upgradable example

This project demonstrates how to compile and deploy upgadable smart contracts in zkSync 2.0 using the Hardhat plugins.
This project demonstrates how to compile and deploy upgadable smart contracts in zkSync Era using the Hardhat plugins.

## Prerequisites

Expand Down
4 changes: 2 additions & 2 deletions examples/verify-example/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# zkSync 2.0 verify environment example
# zkSync Era verify environment example

This project demonstrates how to compile and verify your contracts in zkSync 2.0 using the Hardhat plugins.
This project demonstrates how to compile and verify your contracts in zkSync Era using the Hardhat plugins.

## Prerequisites

Expand Down
4 changes: 2 additions & 2 deletions examples/verify-vyper-example/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# zkSync 2.0 verify vyper environment example
# zkSync Era verify vyper environment example

This project demonstrates how to compile and deploy your contracts in zkSync 2.0 using the Hardhat plugins.
This project demonstrates how to compile and deploy your contracts in zkSync Era using the Hardhat plugins.

## Prerequisites

Expand Down
4 changes: 2 additions & 2 deletions examples/vyper-example/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# zkSync 2.0 vyper environment example
# zkSync Era vyper environment example

This project demonstrates how to compile and deploy your contracts in zkSync 2.0 using the Hardhat plugins.
This project demonstrates how to compile and deploy your contracts in zkSync Era using the Hardhat plugins.

## Prerequisites

Expand Down
4 changes: 2 additions & 2 deletions examples/zksync-ethers-example/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# zkSync 2.0 zksync-ethers environment example
# zkSync Era zksync-ethers environment example

This project demonstrates how to compile and deploy your contracts in zkSync 2.0 using the Hardhat plugins.
This project demonstrates how to compile and deploy your contracts in zkSync Era using the Hardhat plugins.

## Prerequisites

Expand Down
55 changes: 55 additions & 0 deletions packages/hardhat-zksync-solc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,61 @@ or

`yarn add -D @matterlabs/hardhat-zksync-solc`

## 🔩 Configuration

Import the package in the hardhat.config.ts file:

`import "@matterlabs/hardhat-zksync-solc";`

Any configuration parameters should be added inside a zksolc property in the hardhat.config.ts file:

```
zksolc: {
version: "latest", // optional.
settings: {
compilerPath: "zksolc", // optional. Ignored for compilerSource "docker". Can be used if compiler is located in a specific folder
libraries:{}, // optional. References to non-inlinable libraries
missingLibrariesPath: "./.zksolc-libraries-cache/missingLibraryDependencies.json" // optional. This path serves as a cache that stores all the libraries that are missing or have dependencies on other libraries. A `hardhat-zksync-deploy` plugin uses this cache later to compile and deploy the libraries, especially when the `deploy-zksync:libraries` task is executed
isSystem: false, // optional. Enables Yul instructions available only for zkSync system contracts and libraries
forceEvmla: false, // optional. Falls back to EVM legacy assembly if there is a bug with Yul
optimizer: {
enabled: true, // optional. True by default
mode: '3' // optional. 3 by default, z to optimize bytecode size
},
experimental: {
dockerImage: '', // deprecated
tag: '' // deprecated
},
}
},
```
| 🔧 Properties | 📄 Description |
|-----------------------------|----------------------------------------------------------------------------------------------------------------------|
| version | Is the zksolc compiler version. |
| compilerSource | Indicates the compiler source and can be either binary (default) or docker (deprecated). |
| compilerPath | (optional) is a field with the path to the zksolc binary. By default, the binary in $PATH is used |
| libraries | If your contract uses non-inlinable libraries as dependencies, they have to be defined here. |
| missingLibrariesPath | (optional) serves as a cache that stores all the libraries that are missing or have dependencies on other libraries. |
| isSystem | Required if contracts use enables Yul instructions available only for zkSync system contracts and libraries |
| forceEvmla | Falls back to EVM legacy assembly if there is an issue with the Yul IR compilation pipeline. |
| optimizer | Compiler optimizations (enabled: true (default) or false), mode: 3 (default) recommended for most projects. |
| metadata | Metadata settings. If the option is omitted, the metadata hash appends by default: bytecodeHash. Can only be none. |
| dockerImage | and tag are deprecated options used to identify the name of the compiler docker image. |

Learn more about [compiling libraries here](https://era.zksync.io/docs/tools/hardhat/compiling-libraries.html)

Setting the forceEvmla field to true can have the following negative impacts:

- No support for recursion.
- No support for internal function pointers.
- Possible contract size and performance impact.

## 🕹 Commands

`yarn hardhat compile`

Compiles all the smart contracts in the contracts directory and creates the artifacts-zk folder with all the compilation artifacts, including factory dependencies for the contracts, which could be used for contract deployment.

## 📝 Documentation

In addition to the [hardhat-zksync-solc](https://era.zksync.io/docs/tools/hardhat/hardhat-zksync-solc.html), zkSync's Era [website](https://era.zksync.io/docs/) offers a variety of resources including:
Expand Down
20 changes: 20 additions & 0 deletions packages/hardhat-zksync-vyper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ Update the hardhat.config.ts file with:

`import "@matterlabs/hardhat-zksync-vyper";`

```
const config: HardhatUserConfig = {
zkvyper: {
version: "latest", // Uses latest available in https://github.com/matter-labs/zkvyper-bin/
settings: {
// compilerPath: "zkvyper", // optional field with the path to the `zkvyper` binary.
libraries: {}, // optional. References to non-inlinable libraries
},
},
...
```

| 🔧 properties | 📄 Description |
|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------|
| version | The zkvyper compiler version. Default value is latest |
| compilerSource | TIndicates the compiler source and can be either binary. (A docker option is no longer recommended). |
| compilerPath | Optional field with the path to the zkvyper binary. By default, the binary in $PATH is used. |
| libraries | Define any non-inlinable libraries your contracts use as dependencies here |

Learn more about [compiling libraries](https://era.zksync.io/docs/tools/hardhat/compiling-libraries.html).

**Create a simple vyper contract**

Expand Down

0 comments on commit 8a1fbfe

Please sign in to comment.