sol-merger
sol-merger copied to clipboard
feat: auto add appropriate Solidity version pragma if root file doesn't have
There might be case that the root file has no pragma
for specifying Solidity version while its imports have. It might not make sense to not putting any pragma
in this case. What can be done is to use semver
library to parse all imports' Solidity requirement, then find the expression that is the minimum among all specifications. i.e. find the intersection between all specifications.
Hello @yxliang01,
Sorry for late response. I didn't have internet for a while.
I can see that they might be not resolvable, because some of the libraries can have dependencies with strict pragma version, for example, this 2 pragmas might not be compatible:
pragma solidity >=0.4.0 <0.5.0
pragma solidity ^0.6.0
In that case the issue will still preserve.
Best regards, Valerii Aligorskii
Under such case, I think it makes sense to throw an error since the merged contract shouldn't be successfully compiled by design.