DorianDaSilva
DorianDaSilva

Reputation: 7

Lesson 7: Compiler Version Error -> 10:43.16 (Full blockchain solidity course)

$ /home/ionmind/hardhat-fundme-fcc/node_modules/.bin/hardhat deploy --network rinkeby
Error HH606: The project cannot be compiled, see reasons below.

These files import other files that use a different and incompatible version of Solidity:

  * contracts/test/MockV3Aggregator.sol (^0.8.12) imports @chainlink/contracts/src/v0.6/tests/MockV3Aggregator.sol (^0.6.0)

To learn more, run the command again with --verbose

Read about compiler configuration at https://hardhat.org/config

After getting this error I modified the hardhat.config.js file as instructed on the video

module.exports = {
  //solidity: "0.8.12",
  solidity: {
    compilers: [{ version: "0.8.12" }, { version: "0.6.0" }],
  },

But still getting the error, so I also modified the compiler version in solhint.js file

{
  "extends": "solhint:recommended",
  "rules": {
    "compiler-version": ["error", "^0.8.12", "^0.6.0"],
    "func-visibility": ["warn", { "ignoreConstructors": true }],
    "var-name-mixedcase": "off",
    "avoid-low-level-calls": "off"
  }
}

But still getting the error.

I created a separate AggregatorV2V3Interface file in test folder, locally imported into MockV3Aggregator.sol & also declared solidity version ^0.8.12 for each of the files

//SPDX-License-Identifier:MIT
pragma solidity ^0.8.12;

interface AggregatorInterface {
        //Code Here//
}

interface AggregatorV3Interface {
       //Code Here//
}

interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface {}
//SPDX-License-Identifier:MIT
pragma solidity ^0.8.12;

import "./AggregatorV2V3Interface.sol";

There are no errors or warnings in the code but I still get the same error when trying to compile. I don't get why I seem to be the only person having this compiler issue.Any help is appreciated. Thank you!

Upvotes: 1

Views: 379

Answers (1)

Patrick Collins
Patrick Collins

Reputation: 6131

Update your solidity versions:

module.exports = {
  //solidity: "0.8.12",
  solidity: {
    compilers: [{ version: "0.8.12" }, { version: "0.6.6" }],
  },

Upvotes: 1

Related Questions