[Ethereum] Switch solc compiler versions

compilerinstallationsolcsolidity

I have solc v0.5.2 on my system, but I have several contracts, that require solc < v0.5, so that I get errors:

Error: Source file requires different compiler version

What is the best way to run and choose between multiple versions of solc?

Just download solc v0.4.25, rename it into e.g. solc04 and move it into /usr/bin/? Or is there something like virtual environments for solidity?

Best Answer

You may be interested in the new truffle feature, the ability to specify your solidity compiler, https://github.com/trufflesuite/truffle/releases/tag/v5.0.0#user-content-what-s-new-in-truffle-v5-truffle-compile-solidity-specify-your-compiler-version.

As for manually switching between the 2, I think docker would be your best bet.

Related Topic