Adding Multiple Versions to the Solidity Compiler using HardHat
Getting rid of errors by adding compiler versions for your EVM smart contracts.
I’ve often gotten errors when compiling smart contracts that the version isn’t in the config. These errors are easy to fix, thankfully.
When compiling smart contracts from different versions, you should update your
hardhat.config.js to include all versions. This might mean that you have to search through all your subcontracts such as those from OpenZeppelin.
Once you have found the versions you need, you can add the following lines to your config file.
Once you’ve added all versions that you need, the errors should stop showing and your smart contract should compile when you run
npx hardhat compile .
Thank you so much for reading and have an excellent day.
Consider supporting me by getting a Medium membership. It helps me out a lot, it won’t cost you anything extra, and you can read as many Medium articles as you like!
Check out Pixel Pizzas on the Polygon Blockchain.