首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >第7课:编译器版本错误-> 10:43.16 (完整区块链坚固性课程)

第7课:编译器版本错误-> 10:43.16 (完整区块链坚固性课程)
EN

Stack Overflow用户
提问于 2022-06-09 13:14:15
回答 1查看 134关注 0票数 1
代码语言:javascript
复制
$ /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

收到此错误后,我按照视频上的指示修改了hardhat.config.js文件

代码语言:javascript
复制
module.exports = {
  //solidity: "0.8.12",
  solidity: {
    compilers: [{ version: "0.8.12" }, { version: "0.6.0" }],
  },

但是仍然会出现错误,所以我也修改了solhint.js文件中的编译器版本。

代码语言:javascript
复制
{
  "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"
  }
}

但还是会犯错误。

我在测试文件夹中创建了一个单独的AggregatorV2V3Interface文件,在本地导入到MockV3Aggregator.sol &还为每个文件声明了solidity ^0.8.12

代码语言:javascript
复制
//SPDX-License-Identifier:MIT
pragma solidity ^0.8.12;

interface AggregatorInterface {
        //Code Here//
}

interface AggregatorV3Interface {
       //Code Here//
}

interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface {}
代码语言:javascript
复制
//SPDX-License-Identifier:MIT
pragma solidity ^0.8.12;

import "./AggregatorV2V3Interface.sol";

代码中没有错误或警告,但在试图编译时仍然会遇到相同的错误。我不明白为什么我似乎是唯一一个拥有这个编译器issue.Any帮助的人是值得赞赏的。谢谢!

EN

回答 1

Stack Overflow用户

发布于 2022-06-09 16:11:22

更新您的可靠版本:

代码语言:javascript
复制
module.exports = {
  //solidity: "0.8.12",
  solidity: {
    compilers: [{ version: "0.8.12" }, { version: "0.6.6" }],
  },
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72560937

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档