Hunter0doom
Hunter0doom

Reputation: 31

brownie-config remappings error when trying to import from chainlink

I am trying to import this code

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

but "Source "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol" not found: File import callback not supported" error messages appear when i try to compile.

My brownie-config.yaml file has

dependencies:
  # - <organization/repo>@<version>
  - smartcontractkit/[email protected]
compiler:
  solc:
    remappings:
      - '@chainlink=smartcontractkit/[email protected]'

but the code still results in the same error. Are there any fixes to this?

Upvotes: 3

Views: 861

Answers (2)

Daniel_Cawley
Daniel_Cawley

Reputation: 110

I solved it by doing: npm install @chainlink/contracts --save

and in the yaml file doing:enter image description here

Upvotes: 0

Dani Ihza Farrosi
Dani Ihza Farrosi

Reputation: 78

It appears that running brownie compile failed to install the dependencies specified in brownie-yaml.config. You can check brownie installed package with:

$ brownie pm list

If the package is missing, you need to install the package first:

$ brownie pm install smartcontractkit/[email protected]  

Then, compile the project again: (the -a flag is optional, it is to force recompile all contracts)

$ brownie compile -a

The error should be gone, since now we correctly install the dependency first before compiling the contracts

Upvotes: 1

Related Questions