Adding Multiple Versions to the Solidity Compiler using HardHat

mbvissers.eth
Quick Programming
Published in
1 min readSep 16, 2022

--

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.

--

--

mbvissers.eth
Quick Programming

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