2

enter image description here

I am facing this issue,What to do now?

My Code

pragma solidity ^0.6.7;
import "https://github.com/smartcontractkit/chainlink/blob/master/evm-contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
contract PriceConsumerV3 {
    AggregatorV3Interface internal priceFeed;
   
    constructor() public {
        priceFeed = AggregatorV3Interface(0x9326BFA02ADD2366b30bacB125260Af641031331);
    }
  
    function getLatestPrice() public view returns (int) {
        (
            uint80 roundID, 
            int price,
            uint startedAt,
            uint timeStamp,
            uint80 answeredInRound
        ) = priceFeed.latestRoundData();
        return price;
    }
}
6
  • 1
    Could you add your code instead of the image to the code? It's not helpful for others to find this unless you paste both the text of the error and your code. Commented May 12, 2021 at 12:13
  • I have added can you have a look at it
    – shiva sai
    Commented May 13, 2021 at 2:16
  • It needs to be pasted as text instead of an image Commented May 13, 2021 at 2:16
  • just now i have edited
    – shiva sai
    Commented May 13, 2021 at 2:19
  • can you look it now
    – shiva sai
    Commented May 13, 2021 at 2:23

2 Answers 2

3

The location of the interface changed in GitHub. The contract is now located here: https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol

You can find the updated code for the price consumer here: https://github.com/smartcontractkit/documentation/blob/main/_includes/samples/PriceFeeds/PriceConsumerV3.sol Currently it uses Solidity ^0.8.7.

2
  • 1
    not helpful, your link is broken.
    – Jim
    Commented Oct 19, 2021 at 17:15
  • Helped me find the latest version to import. Thank you! Commented Sep 26, 2022 at 15:59
1

Your import URL isn't correct. Set it to this:

import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

Also you may need to change your pragma solidity line so the version matches what you're importing (ie v6 versions of the CL contracts). ie:

pragma solidity ^0.6.7;

1
  • this gives me the error "not found" in remix
    – Jim
    Commented Oct 19, 2021 at 15:14

Your Answer

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

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