2

I found this verified contract on Etherscan: https://etherscan.io/address/0xd7a27d8d58f0c9e378fb3cb2816bde94c5e34059#code

Etherscan says, it was compiled with solc version v0.4.14+commit.c2215d46, but the first line in the source code says pragma solidity ^0.4.18;. Therefore, the contract doesn't even compile with compiler version 0.4.14. How it still possible that this contract was verified with that compiler version on Etherscan?

1 Answer 1

-1

Pragma is just a guidelining directive.

If there are no features in the source code requiring the newer compiler version, old and new compiler may produce the same binary from the same source.

However, this does not entirely how EtherScan claims it managed to compiled this with older version. I am not sure if you can somehow force solc to ignore the pragma.

1
  • Exactly, that is my question. When I try to compile a program with a lower version, the compiler returns the following error and no binary is produced: SyntaxError: Source file requires different compiler version (current compiler is 0.4.25+commit.59dbf8f1.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
    – hefeleal
    Commented Dec 13, 2018 at 12:59

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.