Quick Programming
Published in

Quick Programming

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 .

Conclusion

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!

Follow me on Twitter and gm.xyz to keep up with me and my projects.

Check out Pixel Pizzas on the Polygon Blockchain.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
mbvissers.eth

I occasionally write about programming and smart contracts. Follow me on Twitter @0xmbvissers