Search code examples
blockchainethereumsoliditychainlinkether

Solidiy FundMe Smart Contract - Remix - Chainlink `call to FundMe.getVersion errored: execution reverted`


I am learning to use Chain Link to get price conversions and also to implement other functions provided by Chainlink. I have 2.9992 ETH on Rinkeby Test Net and I am successfully able to compile and deploy the code using Remix IDE using Injected Web3 Environment.

Whenever I call the function getVersion or any other function defined in ChainLink. I get an error like this

"call to FundMe.getVersion errored: execution reverted"

    pragma solidity >=0.6.6 <0.9.0;
    
    import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
    
    contract FundMe {
        
        mapping(address => uint256) public addressToAmountFunded;
        function fund() public payable {
            addressToAmountFunded[msg.sender] += msg.value;
        }
        
        function getVersion() public view returns(uint256) {
            AggregatorV3Interface priceFeed = AggregatorV3Interface(0x01BE23585060835E02B77ef475b0Cc51aA1e0709);
            return priceFeed.version();
        }
    }

Solution

  • So I found an answer to my question. I was using the wrong Ethereum Data Feed Address. I updated address to 0x8A753747A1Fa494EC906cE90E9f37563A8AF630e which is for ETH/USD on Rinkeby Test Net and it compiles and deploys perfectly with no errors