Loading...
Loading...
Chainlink Data Feeds on Hedera. Use when reading AggregatorV3 price feeds on Hedera (testnet 296 / mainnet 295), calling latestRoundData, checking round completeness and staleness, or normalizing feed decimals. Not for Chainlink CCIP (cross-chain tokens).
npx skill4agent add hedera-dev/hedera-skills chainlink-data-feedslatestRoundData()Chainlink DON → AggregatorV3Interface feed → consumer latestRoundData()| Piece | Role |
|---|---|
| |
| Round completeness | |
| Price | |
| Freshness | Compare |
| Scale | Normalize feed decimals to the consumer’s scale (often 18) |
| Pair identity | Prefer canonical uppercase symbols ( |
296295| Condition | Why |
|---|---|
| Aggregator has not finished this round |
| No successful update |
| Invalid / non-positive price |
| Stale for this consumer |
(uint80 roundId, int256 answer,, uint256 updatedAt, uint80 answeredInRound) =
feed.latestRoundData();
if (answeredInRound < roundId || updatedAt == 0) revert IncompleteRound();
if (answer <= 0) revert InvalidPrice();
if (block.timestamp - updatedAt > maxStaleness) revert StalePrice(updatedAt, maxStaleness);295296feed.decimals()uint256 price = normalizeToScale(uint256(answer), feed.decimals(), /* target */ 18);latestRoundDataanswer295296latestRoundData