hedera-dev/hedera-skills

chainlink-data-feeds

Chainlink Data Feeds on Hedera.

View source
Original skill document

Rendered from the source repository. Headings, examples, code, tables, links, and referenced images are preserved.

Chainlink Data Feeds (Hedera)

Push feed pattern: a Chainlink aggregator is updated off-chain; on-chain readers call latestRoundData() and must reject incomplete, non-positive, or stale rounds.

text
Chainlink DON → AggregatorV3Interface feed → consumer latestRoundData()

Consumers may wrap the feed behind a local interface; that is optional. Do not assume a project-specific adapter name.

Quick Reference

PieceRole
AggregatorV3InterfacelatestRoundData() + decimals()
Round completenessansweredInRound >= roundId and updatedAt != 0
Priceanswer > 0 (feeds are typically signed int256)
FreshnessCompare block.timestamp - updatedAt to a max staleness
ScaleNormalize feed decimals to the consumer’s scale (often 18)
Pair identityPrefer canonical uppercase symbols (HBAR, USD) if you hash pair keys

Hedera chain IDs: testnet 296, mainnet 295.

See references/hedera-feeds.md for where to source Hedera feed addresses. See references/examples.md for read and normalize sketches.

Critical: Completeness Then Staleness

Never return a price from a missing or unfinished round. Revert when:

ConditionWhy
answeredInRound < roundIdAggregator has not finished this round
updatedAt == 0No successful update
answer <= 0Invalid / non-positive price
block.timestamp - updatedAt > maxStalenessStale for this consumer
solidity
(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);

Critical: Hedera Feeds, Not Ethereum Addresses

Do not copy Ethereum mainnet aggregator addresses onto Hedera. Look up Hedera-specific Data Feed addresses for chain 295 / 296 and re-check docs before mainnet.

Pair maps (if you use them) should be constructor-only unless the project explicitly supports post-deploy updates.

Decimal Normalization

feed.decimals() is often 8. Convert to the scale your app uses before arithmetic:

solidity
uint256 price = normalizeToScale(uint256(answer), feed.decimals(), /* target */ 18);

Keep conversion rounding explicit (usually round down). Do not mix raw aggregator units with 18-decimal amounts.

Checklist

When implementing or reviewing Chainlink reads on Hedera:

  • [ ] Feed address taken from Hedera Data Feeds docs (not Ethereum)
  • [ ] latestRoundData completeness checks before using answer
  • [ ] Non-positive prices revert
  • [ ] Staleness bound is enforced
  • [ ] Decimals normalized to the consumer scale
  • [ ] Chain ID is 295 or 296 (or the project’s documented Hedera network)

References

from this repository

More skills

All skills
hedera-dev
Community

agent-kit-plugin

This skill should be used when the user asks to "create a hedera plugin", "build a hedera agent kit plugin", "extend hedera agent kit", "create custom hedera tools", "add hedera functionality", "write a hedera tool", "implement hedera tool", or needs guidance on Hedera Agent Kit plugin architecture, tool definitions, mutation tools, query tools, or parameter schemas using Zod.

installs
2
GitHub stars
28
Updated
Sep 3
hedera-dev
Community

axelar-gmp

Axelar General Message Passing (GMP) on Hedera. Use when sending or receiving cross-chain contract calls via Axelar Gateway (callContract, payNativeGasForContractCall), building AxelarExecutable receivers, wiring Hedera↔EVM destinations, or separating bridge transport from destination handlers (orchestrated / scheduled flows).

installs
2
GitHub stars
28
Updated
Sep 3
hedera-dev
Community

ccip

Chainlink CCIP Cross-Chain Tokens on Hedera. Use when bridging burn-and-mint CCT between Hedera and EVM, registering TokenAdminRegistry / pools, calling ccipSend with chain selectors, or wiring HTS-backed wrappers (HtsBurnMintERC20) vs vanilla BurnMintERC20. Not for Chainlink Data Feeds / price oracles.

installs
2
GitHub stars
28
Updated
Sep 3
hedera-dev
Community

create-harness-spec

Create a hedera-harness recipe — PRD, recipe file, validators, and optional stages — by grilling an idea into a runnable feature spec. Use when the user wants to turn a Hedera feature idea into harness inputs.

installs
2
GitHub stars
28
Updated
Sep 3