gpt4 book ai didi

compiler-errors - 无法编译多个 Solidity 版本

转载 作者:行者123 更新时间:2023-12-04 17:17:44 24 4
gpt4 key购买 nike

我正在尝试编译(通过 Hardhat)一个契约(Contract),该契约(Contract)导入具有不同 Solidity 版本的多个接口(interface),但出现以下错误:

Error HH606: The project cannot be compiled, see reasons below.

These files and its dependencies cannot be compiled with your config. This can happen because they have incompatible Solidity pragmas, or don't match any of your configured Solidity compilers.

* contracts/FlashLoaner.sol
Flashloaner.sol:
pragma solidity >=0.5.0 <=0.8.0;

import '@uniswap/v2-periphery/contracts/interfaces/IWETH.sol';
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import '@aave/protocol-v2/contracts/interfaces/ILendingPool.sol'; //---> Issue
import "hardhat/console.sol";


contract FlashLoaner {
struct MyCustomData {
address token;
uint256 repayAmount;
}

address public logicContract;

function execute(address _weth, address _contract) external view {
console.log(_weth);
}
}
问题出在 @aave/protocol-v2/contracts/interfaces/ILendingPool.sol .如果我将其注释掉,则我的契约(Contract)编译良好。
IlendingPool.sol: pragma solidity 0.6.12;IERC20.sol: pragma solidity ^0.5.0;IWETH.sol: pragma solidity >=0.5.0;安全帽.config:
module.exports = {
solidity: {
compilers: [
{
version: "0.5.7"
},
{
version: "0.8.0"
},
{
version: "0.6.12"
}
]
}
...

最佳答案

解决方案:
从每个界面中获取我感兴趣的函数的签名,并使用 pragma solidity ^0.8.0 将它们放在我自己的界面上.

关于compiler-errors - 无法编译多个 Solidity 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68163319/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com