编译 AggregatorV2V3Interface 会导致 TypeError:接口无法继承。界面

Was*_*shi 3 python interface mocking blockchain solidity

SOlidity 课程:Brownie Fund Me 第 6 课:https://github.com/PatrickAlphaC/brownie_fund_me

编译 AggregatorV2V3Interface 会导致 TypeError:接口无法继承。接口我在contract->test下添加了一个文件MockV3Aggregator.sol来部署模拟。但是,当我使用“browniecompile”时,出现以下错误:

PS C:\Users\user\Documents\BC\demos\brownie_fund_me> brownie compile
INFO: Could not find files for the given pattern(s).
Brownie v1.18.1 - Python development framework for Ethereum

Compiling contracts...
 Solc version: 0.6.0
 Optimizer: Enabled  Runs: 200
 EVM Version: Istanbul
CompilerError: solc returned the following errors:

C:/Users/user/.brownie/packages/smartcontractkit/chainlink-brownie- 
contracts@1.1.1/contracts/src/v0.6/interfaces/AggregatorV2V3Interface.sol:7:38: 
TypeError: Interfaces 
cannot inherit.
interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface
                                 ^-----------------^

C:/Users/user/.brownie/packages/smartcontractkit/chainlink-brownie- 
contracts@1.1.1/contracts/src/v0.6/interfaces/AggregatorV2V3Interface.sol:7:59: 
TypeError: Interfaces 
cannot inherit.
interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface
                                                      ^-------------------^
Run Code Online (Sandbox Code Playgroud)

小智 7

您可能会在 Brownie 、 Hardhat 或任何其他开发框架中遇到此错误。当您的代码尝试访问 chainlink 合约时,就会发生这种情况。

Ex - 导入“@chainlink/contracts/src/v0.6/tests/MockV3Aggregator.sol”;

MockV3Aggregator也需要访问其他接口。

解决方案

  1. 尝试将 Solidity 编译器版本提高到 0.6.5、0.6.6 等。 如果我使用 0.6.6,它对我来说效果很好。