0

that solidity compiling is a mess :frowning:

I’m trying hours to find out why my contracts sometime compile and sometimes not … Now I got it …

I'm using a local ganache server and the online IDE remix.ethereum.org

Want to compile that file:

pragma solidity >=0.6.12;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";

And get this error:

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/GSN/Context.sol:1:1: ParserError: Source file requires different compiler version (current compiler is 0.6.12+commit.27d51765.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version pragma solidity ^0.5.0; ^---------------------^

When I look into the Context.sol (clicking in remix on the error popup):

pragma solidity ^0.5.0;

At github (following the inport link) is it the version:

pragma solidity >=0.6.0 <0.8.0;

Shouldn’t my import import the .sol from its own path? What is going on? Is it possible to “refresh” the compiled files in remix after deploying? - I guess thats the point, because I have another contract that use the older version.

Thanks hope for help :D

EDIT Okay I found out that it doesn't happened when I use the remix with firefox instead of using it with chrome. There is also a libary "github" where openzeppelin is inside, with all the contracts that I import (only that one) but not at the local directory...

1 Answer 1

0

The current openzeppelin contracts are using:

pragma solidity >=0.6.0 <0.8.0;

... so I'm not too sure where

pragma solidity ^0.5.0;

actually comes from. You can see here: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/GSN/Context.sol

... that is not part of the same release as the rest of files you are using. This could be a case of the pragma doing it's job and alerting you that something is wrong.

Hope it helps.

1
  • Is there a good tutorial you can recoment to learn? I just use diffrent tutorials to learn and I guess openzeppelin is just not that compatible with older version to do that. Thank you sir. I will start again from the scratch xD
    – MaTok
    Dec 19, 2020 at 8:46

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.