You would use the Hardhat as usual. Client classes will be generated for the compiled contracts automatically

npx hardhat compile

Additional CLI parameters


Override the default sources folder (/contracts)

npx hardhat compile --sources /other/folder/in/projects/root


Override the default output folder

npx hardhat compile --artifacts /foo/bar

--watch true

Compile the contracts, watch *.sol files for changes and automatically recompile

npx hardhat compile --watch true


Enables the mono-repo structure for the project. The contracts can now be organized into separate package folders within the repository

β”œβ”€ packages/
β”‚  β”œβ”€ Foo/
β”‚  β”‚  β”œβ”€ contracts/
β”‚  β”‚  β”‚  β”œβ”€ Foo.sol
β”‚  β”œβ”€ Bar/
β”‚  β”‚  β”œβ”€ contracts/
β”‚  β”‚  β”‚  β”œβ”€ Bar.sol

Every package can be implemented separately, but still reference the contracts and interfaces of each other. To compile the package:

npx hardhat compile --package packages/Bar

Last updated