1

In a chainlink price feed, we can get data by calling:

function latestRoundData() external view
    returns (
        uint80 roundId,
        int256 answer,
        uint256 startedAt,
        uint256 updatedAt,
        uint80 answeredInRound
    )

With the following return values:

  • roundId: The round ID
  • answer: The answer for this round
  • startedAt: Timestamp of when the round started
  • updatedAt: Timestamp of when the round was updated
  • answeredInRound: The round ID in which the answer was computed

Would roundId ever be different from answeredInRound? What is the difference between the two?

1 Answer 1

1

roundId is the "round" the answer was created in. Every time a Chainlink network updates a price feed, they add 1 to the round.

answeredInRound is a legacy variable from when the Chainlink price feeds was on the Flux Aggregator model instead of OCR (Off-Chain Reporting) and it was possible for a price to be updated slowly and leek into the next "round". This is now no longer the case.

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.