Skip to main content

Feed Adapter API Reference

This guide outlines the functions which can be used with the Feed Adapter. You can find the interface contract here.

Functions

NameDescription
decimalsThe number of decimals in the response
descriptionThe description of the feed adapter
versionThe version of the feed adapter
latestRoundDataGet the data of the latest round
latestRoundGet the latest round Id (V2 interface)
latestAnswerGet the latest answer (V2 interface)
latestTimestampReturns the last timestamp when the pair was updated on-chain (V2 interface)
getRoundDataGet the round data details on a given round
getAnswerGet the answer for a specific round (V2 interface)
getTimestampGet the updated timestamp on-chain on a specific round (V2 interface)

decimals

Get the number of decimals of the response

function decimals() external view returns (uint8);

Return values

  • RETURN: The number of decimals

description

Get the description of the feed adapter

function description() external view returns (string memory);

Return values

  • RETURN: The description of the feed adapter

version

Get the version of the feed adapter

function version() external view returns (uint256);

Return values

  • RETURN: The version of the feed adapter

latestRoundData

Get the latest round data details

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

Return values

  • roundId: The round ID
  • answer: The answer on the round
  • startedAt: The timestamp at which the price was submitted
  • updatedAt: The timestamp at which the price was updated on the chain
  • answeredInRound: The round at which this data was computed

latestRound

Get the latest round id using AggregatorV2 interface

function latestRound() external view returns (uint256);

Return values

  • roundId: The latest round ID

latestAnswer

Get the latest answer

function latestAnswer() external view returns (int256);

Return values

  • RETURN: The latest answer from the underlying aggregator

latestTimestamp

Get the timestamp at which the pair has been last updated on the chain

function latestTimestamp() external view returns (uint256);

Return values

  • RETURN: The latest timestamp

getRoundData

Get the round data details for a given round ID

function getRoundData(uint80 roundId)
external
view
returns (
uint80 roundId_,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);

Parameters

  • roundId: The round ID for which the data is required

Return values

  • roundId_: The round ID
  • answer: The answer on the round
  • startedAt: The timestamp at which the price was submitted
  • updatedAt: The timestamp at which the price was updated on the chain
  • answeredInRound: The round at which this data was computed

getAnswer

Get the answer on a given round ID over AggregatorV2 Interface

function getAnswer(uint256 roundId) external view returns (int256);

Parameters

  • roundId: The round ID for which the data is required

Return values

  • answer: The answer on the round

getTimestamp

Get the timestamp at which the pair was updated on-chain for a given round ID over AggregatorV2 Interface

function getTimestamp(uint256 roundId) external view returns (uint256);

Parameters

  • roundId: The round ID for which the timestamp is required

Return values

  • timestamp: The timestamp at which this round was updated