Remix: Import wants >=0.6.0 but the import of the import is ^0.5.0

Hello,

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 …

:computer: Environment
ganache
remix.ethereum.org

:memo:Details
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 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.

:1234: Code to reproduce

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

Thanks :slight_smile:

1 Like

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 Like

Hi @MToken,

:warning: When importing via GitHub, you should specify the release tag, otherwise you will get the latest code in the master branch. For OpenZeppelin Contracts you should only use code published in an official release. (see Importing from GitHub in the Remix documentation).

OpenZeppelin Contracts support different version of Solidity. OpenZeppelin Contracts 2.x uses Solidity 0.5. OpenZeppelin Contracts 3.x uses Solidity 0.6 and also Solidity 0.7.