我在同一个问题上看到了很多问题并尝试了所有这些,但它仍然没有解决我的回调问题。
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
contract FundMe {
using SafeMathChainlink for uint256;
这是我的 Brownie-config.yaml 文件
dependencies:
# -<organization/repo>@<version>
- smartcontractkit/[email protected]
compiler:
solc:
remappings:
- "@chainlink=smartcontractkit/[email protected]"
对此的任何帮助都将是史诗般的。 先谢谢你了
编译器不知道文件在哪里,所以只需创建一个新文件夹在名为tests的contracts文件夹中,然后创建一个新文件命名:AggregatorV3Interface.sol,然后将此代码粘贴到其中:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// getRoundData and latestRoundData should both raise "No data present"
// if they do not have data to report, instead of returning unset values
// which could be misinterpreted as actual reported values.
function getRoundData(uint80 _roundId)
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
之后重新编译项目然后运行,它将运行没有任何错误,你将得到结果。 欲了解更多信息,请访问:: 这个问题
我也有同样的问题。这就是解决我系统上的问题的方法:
希望这有帮助,一直在寻找一段时间。
我确实通过要求我正在使用的 IDE(Visual Studio Code)使用接口 v0.7 的版本来修复此问题,因为我想导入 v0.7 接口:
@chainlink/contracts/src/v0.7/interfaces/AggregatorV3Interface.sol
仅供参考:我正在关注 YouTube 教程,该教程告诉您将
@chainlink
重新映射到版本 1.1.1 中的 git 路径,但接口文件现在已压缩,因此我选择 v0.7,其中文件仍然可用。
我遇到了同样的问题,只需尝试将 Solidity 版本更改为 0.8.7,将 chainlink 版本更改为 0.8
pragma solidity ^0.8.7;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
//导入“@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol”; 导入“@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol”;
这样做可以轻松工作