hedera-dev/hedera-skills

pyth-price-feeds

Pyth pull price feeds on Hedera.

Voir la source
Document Skill original

Rendu depuis le dépôt source en conservant titres, exemples, code, tableaux, liens et images.

Pyth Price Feeds (Hedera)

Pull pattern: Pyth is not a fire-and-forget push feed. Fresh reads usually need a Hermes payload submitted on-chain (payable) before getPriceNoOlderThan.

text
Hermes → updatePriceFeeds{value: fee}(updateData) → getPriceNoOlderThan(priceId, maxAge)

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

Quick Reference

PieceRole
Pyth contractNetwork IPyth address
Price IDbytes32 feed id (not an aggregator address)
UpdatePayable updatePriceFeeds with Hermes updateData
FeegetUpdateFee(updateData) — msg.value must cover it
ReadgetPriceNoOlderThan(priceId, maxAge)
ConfidenceReject when conf > uint64(price)
ScaleSigned price + expo → consumer decimals (often 18)

Hedera chain IDs: testnet 296, mainnet 295.

See references/hedera-feeds.md for where to source the Pyth contract and price IDs. See references/examples.md for update / read / expo sketches.

Critical: Update Before Fresh Reads

If the on-chain price is older than your staleness bound, fetch Hermes update data and submit it:

solidity
function updatePrice(bytes[] calldata updateData) external payable {
    uint256 fee = PYTH.getUpdateFee(updateData);
    if (msg.value < fee) revert UpdateFeeTooLow(msg.value, fee);
    PYTH.updatePriceFeeds{ value: msg.value }(updateData);
}

Hedera msg.value is tinybars via JSON-RPC — attach enough native value for the Pyth fee. Do not treat a stale getPriceUnsafe as a valid trading price.

Critical: Confidence And Signed Expo

After getPriceNoOlderThan:

CheckWhy
publishTime != 0Incomplete
price > 0Invalid / non-positive
conf > uint64(price)Confidence wider than the price
Normalize expoexpo is signed; not the same as ERC-20 decimals
solidity
PythStructs.Price memory price = PYTH.getPriceNoOlderThan(priceId, maxStaleness);
if (price.publishTime == 0) revert IncompleteRound();
if (price.price <= 0) revert InvalidPrice();
if (price.conf > uint64(price.price)) revert InvalidConfidence();

Checklist

When implementing or reviewing Pyth on Hedera:

  • [ ] Pyth contract + price IDs taken from Pyth Hedera / Hermes docs (not Ethereum defaults)
  • [ ] Hermes payloads submitted with sufficient msg.value before relying on a fresh price
  • [ ] Reads use getPriceNoOlderThan (or equivalent max-age API), not unbounded unsafe prices for trading
  • [ ] Confidence wider than price reverts
  • [ ] Signed expo normalized to the consumer scale
  • [ ] Chain ID is 295 or 296 (or the project’s documented Hedera network)

References

du même dépôt

Autres Skills

Tous les Skills
hedera-dev
Communauté

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.

installations
2
GitHub Stars
28
Mis à jour
3 sept.
hedera-dev
Communauté

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).

installations
2
GitHub Stars
28
Mis à jour
3 sept.
hedera-dev
Communauté

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.

installations
2
GitHub Stars
28
Mis à jour
3 sept.
hedera-dev
Communauté

chainlink-data-feeds

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).

installations
2
GitHub Stars
28
Mis à jour
3 sept.