Is there a tool to check if all of my smart contract code is compatible pragma version? My contract returns different results in some nodes and I thought maybe they use different versions of Solidity.


This is the job of the compiler. If you're attempting to use a feature that is not available in the version encapsulated by your pragma, you will get an error.

For example:

pragma solidity ^0.7.0;

contract ErrorExample {
    function foo(uint256 a, uint256 b) external view returns (uint256) {
        unchecked {
            return a + b;

Throws with the following error:

ParserError: Expected primary expression.

This is because unchecked arithmetic has been added in version 0.8; it wasn't available in Solidity v0.7 and below.

  • Thanks Paul. Does Remix compiler checks for this errors too? What if there's a overflow in arithmetic? I get different return values from different nodes for a same function. Please check this question too ethereum.stackexchange.com/questions/103527/…
    – M M
    Jul 17 at 19:33
  • Arithmetic underflow and overflow used to not be checked for in Solidity. Only since v0.8 the compiler started reverting when an addition, subtraction, division or multiplications operations goes outside the permitted bounds. Jul 18 at 10:08
  • Thanks Paul. I checked it again and it was a Arithmetic overflow.
    – M M
    Jul 18 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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