BlockCatIO / solidity-flattener

A python utility to flatten Solidity code with imports into a single file.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Solidity version is ^0.4.13 (hard coded)

bajayo opened this issue · comments

Though it's a non issue, as it's very easy to replace that single line, still wanted to add this issue so people are aware of it.

commented

Definitely an issue. I hadn't yet figured out how best to derive and insert the solidity version dynamically - if you have any suggestions for that I'd love to add it in as a feature!

IMO it should throw an error if different input files use different pragma versions.

commented

I can see an argument for both sides of that.

On one hand, mismatched versioned files implies that care ought to be taken to ensure code compatibility across different versions.

On the other, it'd be poor usability to have to doctor several files for their pragma line in order to get it to run successfully.

How about a warning by default, with an optional flag to force it to error instead?

Thoughts appreciated!

How about a warning by default, with an optional flag to force it to error instead?

That could make sense too.

I think, what version string needs to be put in the flattened file, that string should be made configurable.
solidity_flattener -v "0.4.18" SmartContract.sol

This is how it should take parameter.

commented

Yes, that's a reasonable middle-ground. I'll take it into consideration. Thank you @jchittoda!

Lol, I was just wondering where this 0.4.13 is coming from...

I first used truffle-flattener but ran into verification issues. They are open about that on their README and referenced this project

But checkout the breaking changes with solc 0.5:
https://solidity.readthedocs.io/en/v0.5.2/050-breaking-changes.html#interoperability-with-older-contracts
-> Does this hardcoded pragma even work nowadays with solc v0.5+?