4

enter image description here

The code seems to have successfully compiled, but VSCode keeps showing this error -

"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol" not found. File import callback not supported"

3
  • 1
    Awesome!! Can you please add the text for this so others can find this question? Dec 6, 2021 at 21:14
  • @PatrickCollins I'm sorry I don't understand. Do you want me to rephrase the question where I include the error statement and other details? If yes, its done. Dec 7, 2021 at 13:13
  • Nope, nevermind, you got it! Dec 7, 2021 at 13:36

4 Answers 4

4

So, I figured out a solution.

Step 1 - brownie pm install [ORGANIZATION]/[REPOSITORY]@[VERSION]. Do this in your terminal. In my case, it'll be

brownie pm install smartcontractkit/[email protected]
brownie pm install OpenZeppelin/[email protected]

Step 2 - Add these in your VSCode settings,

  "solidity.remappings": [
    "@chainlink/=/Users/<USERNAME>/.brownie/packages/smartcontractkit/[email protected]",
    "@openzeppelin/=/Users/<USERNAME>/.brownie/packages/OpenZeppelin/[email protected]"
  ]

All the versions are the latest as of 12-Dec-2021

Lastly to check all of your installed packages just type brownie pm list in your terminal. In my case, it looks something like this.

enter image description here

VOILA!

1
  • Thanks to this straightforward solution! If you're on Windows OS, and use this in the remapping. "@chainlink/=C:/Users/<USERNAME>/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@<your_version>"
    – Bi Wu
    Mar 19, 2022 at 1:41
1

I did a brownie pm install for both the packages and also added following in the settings.json for Solidity

    {
"workbench.colorTheme": "Default Dark+",
"editor.formatOnSave": true,
"python.formatting.provider": "black",
"solidity.compileUsingRemoteVersion": "0.6.0",
"editor.minimap.enabled": false,
"editor.bracketPairColorization.enabled": true,
"solidity.remappings": [
    "@chainlink/=/Users/<USERNAME>/.brownie/packages/smartcontractkit/[email protected]",
    "@openzeppelin/=/Users/<USERNAME>/.brownie/packages/OpenZeppelin/[email protected]"
]

}

After doing this the brownie pm list shows the following: Brownie v1.16.4 - Python development framework for Ethereum

    The following packages are currently installed:

     smartcontractkit
      ├─smartcontractkit/[email protected]
      └─smartcontractkit/[email protected]

    OpenZeppelin
     └─OpenZeppelin/[email protected]

And the same problem persists: Source "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol" not found: File import callback not supported

I am using macOS.

1
  • Apologies.Missed replacing the <USERNAME> in settings.json to my username. Working fine now. Jan 23, 2022 at 4:09
0

In my case, what fixed it for me was install another version of solidity. Source: https://www.youtube.com/watch?v=5qTdQNCMwk8

I was operating on v0.0.137 The guy says to install version 0.0.135 and that fixed everything for me.

Best of luck.

0

for Brownie 1.19.3 in vs code, you'll need to do the followings:

considering we have:

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@erc721a/contracts/ERC721A.sol";

add the following section to your project's brownie-config.yaml file

dependencies:
    - OpenZeppelin/[email protected]
    - chiru-labs/[email protected]
compiler:
   solc:
      remappings:
         - '@openzeppelin=OpenZeppelin/openzeppelin-co[email protected]'
         - '@erc721a=chiru-labs/[email protected]'  

the chiru-labs/[email protected] for example, is achieved by combining the repository name + @ + release version : enter image description here
also don't forget to create an access token on GitHub and set it as an environment variable like: GITHUB_TOKEN=ghp_2m7rVBTx9c88GZS...
then you'll need to run this command in terminal brownie compile
brownie will automatically download those two packages and the errors will go away.
you can check to see if the packages are downloaded using brownie pm list command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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