0

I am following a YouTube tutorial and I have the following contract (in Remix):

 // SPDX-License-Identifier: MIT
 pragma solidity >= 0.6.0 < 0.9.0;
 import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
        
 contract FundMe {
            mapping(address => uint256) public addressToAmountFunded; 
        }

The import part is in red and has the following error:

"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol:2:1: ParserError: Source file requires different compiler version (current compiler is 0.6.0+commit.26b70077.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.8.0;
^---------------------^
.deps/npm/@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol
@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol
SourceUnit
@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol 1:0"

1 Answer 1

1

Try this:

replace

pragma solidity >= 0.6.0 < 0.9.0;

with

pragma solidity ^0.8.0;

NOTE: You can change the compiler version in remix (So you use 0.8.0)

Here is the screenshot of where to change compiler versionswitch compiler version

6
  • Hello, I replaced with pragma solidity ^0.8.0; and I go the error contracts/FundMe.sol:2:1: ParserError: Source file requires different compiler version (current compiler is 0.6.0+commit.26b70077.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version pragma solidity = 0.8.0; ^----------------------^ PragmaDirective contracts/FundMe.sol 1:0
    – DJ Quimoso
    Nov 17, 2022 at 9:35
  • How do you change the compiler version?
    – DJ Quimoso
    Nov 17, 2022 at 10:35
  • @DJQuimoso I added a screenshot that shows how to change the compiler versions in Remix
    – Sky
    Nov 17, 2022 at 10:57
  • @DJQuimoso could you please accept and upvote the answer then? Much appreciated.
    – Sky
    Nov 17, 2022 at 18:49
  • 1
    When I try to upvote I get the error "Thanks for the feedback! You need at least 15 reputation to cast a vote, but your feedback has been recorded."
    – DJ Quimoso
    Nov 18, 2022 at 15:13

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.