AggregatorInterface v0.2.1 API Reference
AggregatorInterface
AggregatorInterface
defines the standard interface for Chainlink Data Feed aggregators. This interface provides methods to access price feed data and timestamps, as well as historical values.
Events
AnswerUpdated
event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt)
Emitted when a new answer is available for a price feed.
Parameter | Type | Description |
---|---|---|
current | int256 | The new price value (indexed) |
roundId | uint256 | The round ID for this update (indexed) |
updatedAt | uint256 | Timestamp when this answer was updated |
NewRound
event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt)
Emitted when a new round of price updates begins.
Parameter | Type | Description |
---|---|---|
roundId | uint256 | The round ID that started (indexed) |
startedBy | address | Address that initiated the round (indexed) |
startedAt | uint256 | Timestamp when the round started |
Functions
getAnswer
function getAnswer(uint256 roundId) external view returns (int256)
Retrieves the answer for a specific round.
Parameters:
Parameter | Type | Description |
---|---|---|
roundId | uint256 | The round ID to query |
Returns:
Type | Description |
---|---|
int256 | The price answer for the specified round |
getTimestamp
function getTimestamp(uint256 roundId) external view returns (uint256)
Retrieves the timestamp for a specific round.
Parameters:
Parameter | Type | Description |
---|---|---|
roundId | uint256 | The round ID to query |
Returns:
Type | Description |
---|---|
uint256 | The timestamp when the round was updated |
latestAnswer
function latestAnswer() external view returns (int256)
Retrieves the most recent answer.
Returns:
Type | Description |
---|---|
int256 | The latest price feed answer |
latestRound
function latestRound() external view returns (uint256)
Retrieves the most recent round ID.
Returns:
Type | Description |
---|---|
uint256 | The latest round ID |
latestTimestamp
function latestTimestamp() external view returns (uint256)
Retrieves the timestamp of the latest answer.
Returns:
Type | Description |
---|---|
uint256 | The timestamp when the latest answer was updated |