hardhat-zksync-solc
Guide on using the hardhat-zksync-solc plugin.
Prerequisite
Installation
npm i -D @matterlabs/hardhat-zksync-solcConfiguration
import "@matterlabs/hardhat-zksync-solc";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
enableEraVMExtensions: 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
fallback_to_optimizing_for_size: false, // optional. Try to recompile with optimizer mode "z" if the bytecode is too large
},
suppressedWarnings: ['txorigin', 'sendtransfer'], // Suppress specified warnings. Currently supported: txorigin, sendtransfer
suppressedErrors: ['txorigin', 'sendtransfer'], // Suppress specified errors. Currently supported: txorigin, sendtransfer
experimental: {
dockerImage: '', // deprecated
tag: '' // deprecated
},
contractsToCompile: [] //optional. Compile only specific contracts
}
},Compiler informations
ZKsync Era Solidity compiler
Network configuration
Commands
Troubleshooting
Last updated