$ /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文件
module.exports = {
//solidity: "0.8.12",
solidity: {
compilers: [{ version: "0.8.12" }, { version: "0.6.0" }],
},但是仍然会出现错误,所以我也修改了solhint.js文件中的编译器版本。
{
"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
//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";代码中没有错误或警告,但在试图编译时仍然会遇到相同的错误。我不明白为什么我似乎是唯一一个拥有这个编译器issue.Any帮助的人是值得赞赏的。谢谢!
发布于 2022-06-09 16:11:22
更新您的可靠版本:
module.exports = {
//solidity: "0.8.12",
solidity: {
compilers: [{ version: "0.8.12" }, { version: "0.6.6" }],
},https://stackoverflow.com/questions/72560937
复制相似问题