pythonsoliditysmartcontractsbrownie

Brownie: CompilerError: File outside of allowed directories


I'm trying to import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol" to my contract but i encountered this error. CompilerError: solc returned the following errors:

contracts/Lottery.sol:4:1: ParserError: Source "C:/Users/Алексей/.brownie/packages/smartcontractkit/chainlink-brownie contracts@1.1.1/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol" not found: File outside of allowed directories. import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; ^--------------------------------------------------------------------------^

This is my contract (Lottery.sol):

    // SPDX-License-Identifier: MIT
    pragma solidity ^0.6.6;

    import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

    contract Lottery {

        address payable[] public players;
        uint256 public usdEnterFee;
        AggregatorV3Interface internal ethUsdPriceFeed;

        constructor(address _priceFeedAddress) public {
            usdEnterFee = 50 * (10 ** 18);
            ethUsdPriceFeed = AggregatorV3Interface(_priceFeedAddress);
        }

        function enter() public payable {
            players.push(msg.sender);
        }

        function getEnterFee() public view returns(uint256) {

        }

        function startLottery() public {

        }

        function endLottery() public {

        }

    }

This is brownie-config.yaml:

    dependencies:
      - smartcontractkit/chainlink-brownie-contracts@1.1.1
    compiler:
      solc:
        remappings:
          - '@chainlink=smartcontractkit/chainlink-brownie contracts@1.1.1'

Error: enter image description here


Solution

  • it doesn't find aggregatorV3interface.sol

    Have you installed it?

    try pip3 install @chainlink/contracts or npm install @chainlink/contracts

    if you already done it, check if it is in the right path