0

This is my code. After deploying it to Kovan Test Net. Whenever I try to run the function getPrice() it returns :

call to PriceConsumerV3.getPrice errored: Error: VM execution error. Reverted 0x 
pragma solidity ^0.6.7;

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

contract PriceConsumerV3{
    
    AggregatorV3Interface internal priceFeed;
    /**
     * Aggregator : 1INCH/ETH 
    */
    
    constructor() public{
        priceFeed = AggregatorV3Interface( 0x231e764B44b2C1b7Ca171fa8021A24ed520Cde10);
        
    }
    
    function getPrice() public view returns(int){
        (
            uint80 roundID,
        int price,
        uint startedAt,
        uint timeStamp,
        uint80 answeredInRound
        )= priceFeed.latestRoundData();
        return price;
        
    }
}

2 Answers 2

1

0x231e764B44b2C1b7Ca171fa8021A24ed520Cde10 is the ADX / USD MAINNET price feed address. It looks like you're looking for a kovan price feed address.

Please view the kovan price feeds to get the correct address.

0

If you're watching the "Solidity, Blockchain, and Smart Contract Course - Beginner to Expert Python Tutorial" from freeCodecCamp.org, then I ran into the same issue.

The course content is very dense and quickly paced.

The instructor doesn't clearly explain that the "AggregatorV3Interface.sol" contract is deployed to the Kovan test network and the "FundMe.sol" is deployed to the the Rinkeby test network.

Go to : https://docs.chain.link/docs/get-the-latest-price/ and scroll down until you see the "Deploy this contract using Remix" button. Click it. It will bring you to a Remix IDE screen with all the code loaded.

Deploy the "priceAggregatorV3Interface.sol"contract. Make sure that you deploy this to the Kovan test network. You will need a little bit of the fake ethereum in your wallet to achieve this.

Next, Deploy the FundMe.sol contract to the Rinkeby test network. This should work. If it doesn't, my apologies. I'm extremely new to this as well. Good luck

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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