BlockCatIO / solidity-flattener

A python utility to flatten Solidity code with imports into a single file.
MIT License
266 stars 98 forks source link

Solidity version is ^0.4.13 (hard coded) #4

Open bajayo opened 6 years ago

bajayo commented 6 years ago

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.

Stickerpants commented 6 years ago

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!

Sjors commented 6 years ago

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

Stickerpants commented 6 years ago

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!

Sjors commented 6 years ago

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

That could make sense too.

jchittoda commented 6 years ago

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.

Stickerpants commented 6 years ago

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

JohannesMayerConda commented 5 years ago

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+?