由网友(一腔傲与野)分享简介:我正在尝试导入AggregatorV3,但找不到该文件,以下是我的代码;很抱歉,我还是个初学者。//SPDX-License-Identifier: MITpragma solidity ^0.8.9;import "@chainlink/contracts/src/v0.8/interfaces/Aggrega...我正在尝试导入AggregatorV3,但找不到该文件,以下是我的代码;
很抱歉,我还是个初学者。
![测评│功能丰富,令人惊喜不断 NAD T 758 V3](https://p.xsw88.cn/allimgs/daicuo/20230903/2312.png)
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
contract Lottery {
address payable[] public players; //to keep track of all players, payable array
uint256 public usdEntryFee;
AggregatorV3Intefrace internal ethUsdPriceFeed;
constructor(address _priceFeedAddress) public {
usdEntryFree = 50 * (10**18);
ethUsdPriceFeed = AggregatorV3Interface(_priceFeedAddress); //we need to pass the address of aggv3 in constructor
}
function enter() public payable {
//payable since we want them to pay in eth
//50 $ minimum
players.push(msg.sender);
}
function getEntranceFee() public view returns (uint256) {}
function startLottery() public {}
function endLottery() public {}
}
这是我的YAML文件:
dependencies:
- smartcontractkit/chainlink-brownie-contracts@1.1.1
compiler:
solc:
remappings:
- '@chainlink=smartcontractkit/chainlink-brownie-contracts@1.1.1'
以下是错误:
(base) marc@Marcs-MacBook-Pro smartcontract-lottery % brownie compile
Brownie v1.17.2 - Python development framework for Ethereum
Compiling contracts...
Solc version: 0.8.11
Optimizer: Enabled Runs: 200
EVM Version: Istanbul
CompilerError: solc returned the following errors:
ParserError: Source "/Users/marc/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@1.1.1/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol" not found: File not found.
--> contracts/Lottery.sol:4:1:
|
4 | import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
![测评│功能丰富,令人惊喜不断 NAD T 758 V3](https://p.xsw88.cn/allimgs/daicuo/20230903/2312.png)
我试着更改 编译器: Solc: 重新映射: --‘@chainlink=smartcontractkit/chainlink-brownie-contracts@1.1.1’ 至@0.2.1 我还尝试将Solidity版本更改为较新的版本,但不起作用 提前感谢!
推荐答案
我通过执行以下操作解决了它: NPM安装@chainlink/合同--保存
and in the yaml file doing:
相关推荐
最新文章