-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Lesson 4: can't find AggregatorV3Interface.sol #6444
-
In docs.chain.link i find the example data feed contract, but in chainlink github i can't find the ABI contract. i find its path written in contract didnt change but in that path i cant find it(@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol)
so what can i import?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 10 comments 4 replies
-
i find it in v0.7 and change my solidity version, then i successfully run the contract, but i still want to find AggregatorV3Interface.sol
where is it?
Beta Was this translation helpful? Give feedback.
All reactions
-
try import with this @chainlink/blob/develop/contracts/src/v0.7/interfaces/AggregatorV3Interface.sol
the contract is here. Hope this helps.
https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.7/interfaces/AggregatorV3Interface.sol
Beta Was this translation helpful? Give feedback.
All reactions
-
404 - page not found
Beta Was this translation helpful? Give feedback.
All reactions
-
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
worked for me with 0.8.8
version;
I followed Patrick's example in here: https://github.com/PatrickAlphaC/fund-me-fcc/blob/main/PriceConverter.sol
If you want to check the inner code in AggregatorV3Interface.sol, you can go directly to the Chainlink repo:
https://github.com/smartcontractkit/chainlink/blob/master/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol
Hope this helps! 🦾
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 3
-
As mentioned by @jujuvideogirlai i have manually created a file at node_modules/@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol.
and it worked
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
Hey guys the updated link now is the following:
import "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol";
as mentioned by @jujuvideogirlai import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
is not working for me, neither for version 0.8.8
nor 0.8.7
This works with solidity version 0.8.7
for me.
Link to the contract: https://github.com/smartcontractkit/chainlink/tree/develop/contracts/src/v0.8/shared/interfaces
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
-
The whole problem is with your chainlink package version, just use same as it is in course repo (check yarn.lock
file). Then you can use same path as it is in course. Otherwise just check your node_modules
folder and find where exactly Aggregator is located, if there is not Aggregator found at all just go back to downgrading @chainlink/contracts version :)
Beta Was this translation helpful? Give feedback.
All reactions
-
I run "yarn add @chainlink/contracts@v0.8" and AggregatorV3Interface.sol came up.
yes just add the @v0.8 tag, so what's the difference?
I checked the log, you know what, it's @chainlink/contracts@v1.1.0 when I run "yarn add @chainlink/contracts"! but why there are same directory named src/v0.8? that's the reason I didn't think to specific the version until now. is the directory name just for solidity v0.8?
Beta Was this translation helpful? Give feedback.
All reactions
-
@Bellatlich Its here https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol
Beta Was this translation helpful? Give feedback.
All reactions
-
The correct import path for AggregatorV3Interface.sol in Chainlink v0.8+ is:
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
If you can't find it in GitHub, ensure you have installed the correct Chainlink dependency:
npm install @chainlink/contracts
You can also check older versions on GitHub: https://github.com/smartcontractkit/chainlink.
Beta Was this translation helpful? Give feedback.
All reactions
-
If you're facing same issue right now, it's probably because foundry cannot locate the chainlink contract interface (AggregatorV3Interface.sol) at the path specified in your solidity import statement and foundry.toml remappings.
The easy solution is: go to your foundry.toml
. your remapping should be:
remappings = [
"@chainlink-brownie-contracts/=lib/chainlink-brownie-contracts/contracts/",
"forge-std/=lib/forge-std/src/",
]
Ensure your Solidity contract files (FundMe.sol, PriceConverter.sol, etc.) use the standard import path for Chainlink contracts:
import {AggregatorV3Interface} from "@chainlink-brownie-contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol";
Open your terminal, run forge build
, and your code should compile.
Beta Was this translation helpful? Give feedback.
All reactions
-
I had the same error where the AggregatorV3Interface.sol file was not being recognized. What I did was the following:
First, I ran this command to install the Chainlink contracts repository:
forge install smartcontractkit/chainlink-evm@.
This installed the contracts inside the lib/chainlink-evm
folder in my project.
After that, I created a file called remappings.txt
in the root of my project and added this line:
@chainlink/contracts/=lib/chainlink-evm/contracts/
This tells Foundry how to find the Chainlink contract files when I use imports in my code.
Finally, in my Solidity contract, I imported the interface using:
import "@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol";
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 2
-
Worked for me, thanks boss!
Beta Was this translation helpful? Give feedback.
All reactions
-
god bless you
Beta Was this translation helpful? Give feedback.