question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support multiple simultaneous solc versions

See original GitHub issue

tags: compiler, solidity-versioning

  • I’ve asked for help in the Truffle Gitter before filing this issue.

Issue

In contracts folder, I have old contracts in 0.4 version of solidity and new contracts in 0.5 version. I would like to compile them in the same project but in truffle-config.js, I can only specify one version of solc.

Steps to Reproduce

In contracts folder, create a contract A in 0.4 and another one, contract B, in 0.5

Expected Behavior

I would like truffle compile to work

Actual Results

If I compile with solc 0.4.24, contract B in 0.5 fails to compile If I compile with solc 0.5.0, contract A in 0.4 fails to compile

Environment

  • Operating System: ubuntu 18.10
  • Ethereum client: ganache
  • Truffle version (truffle version): 5.0.16
  • node version (node --version): 11.9.0
  • npm version (npm --version): 6.5.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
gnidancommented, Jul 28, 2020

Moving this to our backlog. I want it!

2reactions
amkChacommented, May 15, 2019

Hi @CruzMolina, thank you very much for you help !

I had to change two more things in old contracts in 0.4 for them to work

  • SyntaxError: Functions are not allowed to have the same name as the contract. If you intend this to be a constructor, use “constructor(…) { … }” to define it
  • Event invocations have to be prefixed by “emit”

If you see a better workaround, I’d be happy to hear about it

Else, after adding ‘emit’ and changing the function naming, it’s compiling 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build with multiple solc versions? - Ethereum Stack Exchange
Now I can't compile because it shows me there are different SOLC versions. This situation forced me to split project into tokens (and...
Read more >
Multiple Solidity versions | Ethereum development ... - Hardhat
Multiple Solidity versions. Hardhat supports projects that use different, incompatible versions of solc. For example, if you have a project ...
Read more >
Where are Crowdsale contracts in OpenZeppelin Contracts 3.0?
Hello. Is the situation with the crowdsale related contracts the same (Where is ERC20Mintable.sol in OpenZeppelin Contracts 3.0?)?
Read more >
How do I uniformly select the solidity version I want to use in ...
I think it's picking up the solc version installed in node_modules ( 0.7.3 ) - this must have been installed as part of...
Read more >
Solidity Documentation - Read the Docs
docker run ethereum/solc:stable --help. You can also specify release build versions in the tag, for example, for the 0.5.4 release.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found