0

I'm trying to deploy an interface from Chainlink and I have in my solidity contract the import for the AggregatorV3Interface:

pragma solidity 0.6.6;

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

and the following remappings in the brownie-config.yaml:


dependencies:
   - smartcontractkit/chainlink-brownie-contracts@1.1.1

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

But while compiling the contract brownie compile, I run into the error:

contracts/Lottery.sol:5:1: ParserError: Source "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol" not found: File outside of allowed directories.
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

It looks like Solidity cannot find the interface. Can anybody explain to me where exactly these chainlink contracts are taken from? Do I need to clone the chainlink repository locally?

Thanks a lot

1 Answer 1

1

I found kind of a solution, maybe helpful for somebody else.

  1. use yarn to install @chainlink/contracts
yarn add @chainlink/contracts

this creates a subdirectory node_modules/ including @chainlink/contracts.

  1. change the import to
import "node_modules/@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";

Like this I can compile the contract in brownie without errors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.