NEW

Developer Passes are now available for Chainlink SmartCon. Get yours today.

AggregatorV3Interface API reference

AggregatorV3Interface

Interface for accessing detailed data from an aggregator contract, including round data and metadata.

Provides methods to get the latest data, historical data for specific rounds, and metadata such as decimals and description.

decimals

function decimals() external view returns (uint8)

Gets the number of decimals used by the aggregator.

Return Values

NameTypeDescription
[0]uint8uint8 - The number of decimals.

description

function description() external view returns (string)

Gets the description of the aggregator.

Return Values

NameTypeDescription
[0]stringstring memory - The description of the aggregator.

version

function version() external view returns (uint256)

Gets the version of the aggregator.

Return Values

NameTypeDescription
[0]uint256uint256 - The version of the aggregator.

getRoundData

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

Gets the round data for a specific round ID.

This function should raise "No data present" if no data is available for the given round ID.

Parameters

NameTypeDescription
_roundIduint80The round ID to get the data for.

Return Values

NameTypeDescription
roundIduint80The round ID.
answerint256The answer for the round.
startedAtuint256The timestamp when the round started.
updatedAtuint256The timestamp when the round was updated.
answeredInRounduint80The round ID in which the answer was computed.

latestRoundData

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

Gets the latest round data.

This function should raise "No data present" if no data is available.

Return Values

NameTypeDescription
roundIduint80The latest round ID.
answerint256The latest answer.
startedAtuint256The timestamp when the latest round started.
updatedAtuint256The timestamp when the latest round was updated.
answeredInRounduint80The round ID in which the latest answer was computed.

Stay updated on the latest Chainlink news