0

We have created a contract by inheriting ERC721Burnable, Ownable contract from openzepplin. The compiler version we are using in our smart contract is 0.6.0. I flattened the smart-contract by using truffle-flattener into one single .sol file, but i am getting an error while i am trying to analyze our smart contract through Mythx

Error: Error compiling source with solc v0.6.0: contracts/flattened.sol:60:1: ParserError: Source file requires different compiler version (current compiler is 0.6.0+commit.26b70077.Linux.g++ - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.6.2;
^---------------------^

        > command: `/home/graphicaldot/.solcx/solc-v0.6.0 --allow-paths /home/graphicaldot/Programs/python_programs/dgm-contracts-security-audit-env/dgm-contracts-security-audit --standard-json`
        > return code: `0`
        > stderr:
        {"errors":[{"component":"general","formattedMessage":"contracts/flattened.sol:60:1: ParserError: Source file requires different compiler version (current compiler is 0.6.0+commit.26b70077.Linux.g++ - note that nightly builds are considered to be strictly less than the released version\npragma solidity ^0.6.2;\n^---------------------^\n","message":"Source file requires different compiler version (current compiler is 0.6.0+commit.26b70077.Linux.g++ - note that nightly builds are considered to be strictly less than the released version","severity":"error","sourceLocation":{"end":1971,"file":"contracts/flattened.sol","start":1948},"type":"ParserError"}],"sources":{}}

When I looked at the Openzepplin code, different smart contracts in the ERC721 folder of openzepplin master branch, have two different -0.6.0 and 0.6.2 - solidity versions.

My question is, how to solve this issue without changing the solidity version in the flattened smart contract ?

1 Answer 1

1

Some contracts from OpenZeppelin were changed to require at least 0.6.2. See this pull request for the details.

If all your pragmas are either pragma solidity ^0.6.0 or pragma solidity ^0.6.2 compiling with solc 0.6.2 should work.

If some are pragma solidity 0.6.0 you will have to edit those to pragma solidity 0.6.2 or pragma solidity ^0.6.0.

Your Answer

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

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