Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Lesson 4: can't find AggregatorV3Interface.sol #6444

Unanswered
Bellatlich asked this question in Q&A
Discussion options

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?

You must be logged in to vote

Replies: 10 comments 4 replies

Comment options

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?

You must be logged in to vote
0 replies
Comment options

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

You must be logged in to vote
1 reply
Comment options

404 - page not found

Comment options

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! 🦾

You must be logged in to vote
1 reply
Comment options

As mentioned by @jujuvideogirlai i have manually created a file at node_modules/@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol.
and it worked

Comment options

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

You must be logged in to vote
0 replies
Comment options

@Bellatlich

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 :)

You must be logged in to vote
0 replies
Comment options

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?

You must be logged in to vote
0 replies
Comment options

@Bellatlich Its here https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
0 replies
Comment options

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.


You must be logged in to vote
0 replies
Comment options

New path: https://github.com/smartcontractkit/chainlink-evm/blob/develop/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol

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";
You must be logged in to vote
2 replies
Comment options

Worked for me, thanks boss!

Comment options

god bless you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /