Importing AggregatorV3Interface issues #121
-
I'm running into trouble importing the AggregatorV3Interface. Attempting the original method suggested - using the @chainlink remapping I get: `CompilerError: solc returned the following errors: contracts/Lottery.sol:5:1: ParserError: Source "C:/Users/leopa/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@1.1.1/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol" not found: File not found.` when trying to compile. which got me: `CompilerError: solc returned the following errors: contracts/Lottery.sol:7:1: ParserError: Source "smartcontractkit/chainlink-brownie-contracts@1.1.1/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol" not found: File outside of allowed directories. I got the same with the full github link. I then tried copying and pasting the AggragtorV3Interface.sol code into a new AggregatorV3Interface.sol file in my local directory and importing with:
But I get: `CompilerError: solc returned the following errors: contracts/AggregatorV3Interface.sol:3:1: ParserError: Source file requires different compiler version (current compiler is 0.6.12+commit.27d51765.Windows.msvc) - note that nightly builds are considered to be strictly less than the released version From https://ethereum.stackexchange.com/questions/102470/brownie-compile-using-different-compiler-version-than-specified-in-configurati I guess this is because the solidity versions are different and I'm trying to import one into the other but isn't this also the case in the original method? Deleting the Any help would be greatly appreciated. Also I'm on windows if that makes any difference. Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Might need more info but maybe try changing the v0.8 in the import string to v0.6 as I think most of the projects Patrick done are in Solidity major version 0.6.6 |
Beta Was this translation helpful? Give feedback.
-
You might have installed the wrong version of the solidity compiler, check #5 |
Beta Was this translation helpful? Give feedback.
-
Looks like you’re trying to import v0.8 instead of v0.6. Version
remember, you’ll need to update your dependencies and remapping in your config with this! I know it looks like you’re using an “earlier” version of the contracts, but after Let me know if this helps |
Beta Was this translation helpful? Give feedback.
Looks like you’re trying to import v0.8 instead of v0.6. Version
1.1.1
of the brownie contracts packages doesn’t have v0.8,0.2.2
does tho. So you have two option:0.6
editionsimport "smartcontractkit/chainlink-brownie-contracts@0.2.2/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
remember, you’ll need to update your dependencies and remapping in your config with this!
I know it looks like you’re using an “earlier” version of the contracts, but after
1.2.0
the versioning was changed to match those in npm, so0.2.2
is actually currently the most up to date.Let me know if this helps