NEW

CCIP is now live for all developers. See what's new.

AggregatorInterface API reference

AggregatorInterface

Interface for accessing data from an aggregator contract.

Provides methods to get the latest data and historical data for specific rounds.

latestAnswer

function latestAnswer() external view returns (int256)

Gets the latest answer from the aggregator.

Return Values

NameTypeDescription
[0]int256int256 - The latest answer.

latestTimestamp

function latestTimestamp() external view returns (uint256)

Gets the timestamp of the latest answer from the aggregator.

Return Values

NameTypeDescription
[0]uint256uint256 - The timestamp of the latest answer.

latestRound

function latestRound() external view returns (uint256)

Gets the latest round ID from the aggregator.

Return Values

NameTypeDescription
[0]uint256uint256 - The latest round ID.

getAnswer

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

Gets the answer for a specific round ID.

Parameters

NameTypeDescription
roundIduint256The round ID to get the answer for.

Return Values

NameTypeDescription
[0]int256int256 - The answer for the given round ID.

getTimestamp

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

Gets the timestamp for a specific round ID.

Parameters

NameTypeDescription
roundIduint256The round ID to get the timestamp for.

Return Values

NameTypeDescription
[0]uint256uint256 - The timestamp for the given round ID.

AnswerUpdated

event AnswerUpdated(int256 current, uint256 roundId, uint256 updatedAt)

Emitted when the answer is updated.

Parameters

NameTypeDescription
currentint256The updated answer.
roundIduint256The round ID for which the answer was updated.
updatedAtuint256The timestamp when the answer was updated.

NewRound

event NewRound(uint256 roundId, address startedBy, uint256 startedAt)

Emitted when a new round is started.

Parameters

NameTypeDescription
roundIduint256The round ID of the new round.
startedByaddressThe address of the account that started the round.
startedAtuint256The timestamp when the round was started.

Stay updated on the latest Chainlink news