Search code examples
chainlink

When was the last time a Chainlink data feed was updated? Are Chainlink data feeds running?


I'm looking to know both:

  1. When was the last Chainlink Data Feed update?
  2. Are the Chainlink Data Feeds running right now?

Solution

  • We can do this programmatically or manually:

    Manually

    You can see the last update, and if the feeds are running by:

    1. Going to the specific Chainlink data feed you are curious about

    2. Going to the address of the data feed and checking it out in a block explorer like Etherscan. (The docs will offer a link to Etherscan for you)

    etherscan_chainlink_data_feed

    1. Going to the Contract tab -> Read Contract and clicking the aggregator

    aggregator

    1. In that contract, look at the most recent update.

    recent_update

    Programatically:

    In your solidity code, just return timeStamp from your latestRoundData call. Here are the docs for reference.

    function getLatestTime() public view returns (uint) {
            (
                uint80 roundID, 
                int price,
                uint startedAt,
                uint timeStamp,
                uint80 answeredInRound
            ) = priceFeed.latestRoundData();
            return timeStamp;
        }