sol-merger icon indicating copy to clipboard operation
sol-merger copied to clipboard

feat: auto add appropriate Solidity version pragma if root file doesn't have

Open yxliang01 opened this issue 3 years ago • 2 comments

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.

yxliang01 avatar Aug 27 '20 07:08 yxliang01

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

RyuuGan avatar Sep 17 '20 21:09 RyuuGan

Under such case, I think it makes sense to throw an error since the merged contract shouldn't be successfully compiled by design.

yxliang01 avatar Sep 18 '20 14:09 yxliang01