Common Hardhat and Solidity Errors
Summary
Common Hardhat and hardhat-deploy issues encountered during development.
Common hardhat Issues
This is a growing list of common Hardhat and Solidity errors I have run into.
hardhat-deploy: cannot find artifact “xxxx”
There are usually two possible causes:
- The contract really does not exist.
- There are duplicate contract definitions.
The first case is usually easy to spot. The second is harder to notice because the error message is misleading. If you see this error, make sure there are no duplicate contract definitions in the project.
Error: Cannot find module 'typechain/dist/TypeChain'
Cause: this happens when you are using the old hardhat-typechain package, which is no longer maintained.
Fix:
- Remove the
hardhat-typechaindependency. - Add
typechain,@typechain/hardhat, and@typechain/ethers-v5.
| |
- Update
hardhat.config.ts: