Whenever I try to do an import like the two demonstrated below, they are not recognized. I am using VSCode. Yes I have tried installing and uninstalling many times. If anybody knows why that would be EPIC. Thanks.
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Full.sol";
VSC Solidity extension can't read Brownie's remappings. I'm assuming that you're getting this error:
Source "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol" not found: File import callback not supported
Source "@openzeppelin/contracts/token/ERC721/ERC721Full.sol" not found: File import callback not supported
Make sure you set dependencies and remappings correctly in brownie-config.yaml
:
dependencies:
- smartcontractkit/chainlink-brownie-contracts@0.2.1
- OpenZeppelin/openzeppelin-contracts@3.4.0
compiler:
solc:
remappings:
- '@chainlink=smartcontractkit/chainlink-brownie-contracts@0.2.1'
- '@openzeppelin=OpenZeppelin/openzeppelin-contracts@3.4.0'
Compile your contracts:
brownie compile
If compiled successfully, Brownie should have downloaded packages, you can confirm it by running
brownie pm list
Set remappings for VSCode Solidity extension (for example in ./vscode/settings.json
).
"solidity.remappings": [
"@chainlink/=<PATH_TO_BROWNIE_STUFF>/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@0.2.1",
"@openzeppelin/=<PATH_TO_BROWNIE_STUFF>/.brownie/packages/OpenZeppelin/openzeppelin-contracts@3.4.0",
]
Make sure that you got the versions (@x.x.x
) right across all the config files.
If you're on Linux, <PATH_TO_BROWNIE_STUFF>
would probably be your home directory (/home/jjreedv
)