0

I am writing my contracts in solidity version defined as ^0.8.0. I want to use Uniswap router interface, which is using >=0.7.5. Why is the compilation failing even though a compiler version ^0.8.0 should fulfill both requirements?

Thank you

1 Answer 1

1

^ or >= accept all the newer minor changes, but the major update will fail this condition:

^0.8.0 would accept 0.8.1, 0.8.2, ..., 0.8.x, but 0.9.0 will not be accepted.

>=0.7.5 will accept all 0.7.x versions, but 0.8.0 will fail.

Look up Semantic Versioning (Semver).

3
  • I tried putting the >=0.7.5 verison to online semver checker and it says that version 0.8.0 fits the condition It also seems to be the case according to this youtube video.
    – Jan Beneš
    Commented Feb 22, 2022 at 20:52
  • 1
    That is because Solidity is following a different Semver system, where 0.x.0 is a major, and 0.0.x is a minor update (as in, 0.0.x updates bring in new non-breaking features, but 0.x.0 updates bring in some breaking features that cause incompatibility). Solidity docs on that: docs.soliditylang.org/en/v0.8.12/… Commented Feb 22, 2022 at 21:37
  • That clears my confusion. Thanks a ton
    – Jan Beneš
    Commented Feb 23, 2022 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.