pyth-price-feeds — скилл для Claude Code: Pyth на Hedera
Скилл для интеграции Pyth pull-фидов в контракты на Hedera: обновление цены через Hermes, чтение с ограничением по возрасту, проверка confidence.
npx skills add hedera-dev/hedera-skills --skill pyth-price-feeds -a claude-codeЧто делает pyth-price-feeds
Pyth на Hedera работает по pull-схеме: свежее чтение обычно требует сначала отправить payload из Hermes в контракт с оплатой, и только потом вызывать getPriceNoOlderThan. Скилл ведёт агента по этой цепочке и напоминает про getUpdateFee(updateData), чтобы msg.value покрывал комиссию.
Внутри — справочные материалы references/hedera-feeds.md и references/examples.md с набросками обновления, чтения и нормализации expo, а также чек-лист для ревью. Отдельно разобраны проверки после чтения: publishTime != 0, price > 0 и отказ, когда conf шире самой цены.
Главная ловушка — адреса контракта и price ID. Их нужно брать из документации Pyth для Hedera, а не из дефолтов Ethereum: chain ID здесь 296 для тестнета и 295 для мейннета. expo знаковый и не совпадает с decimals ERC-20, поэтому его нормализуют к шкале потребителя.
Какие задачи решает
- обновить цену Pyth на Hedera перед свежим чтением
- посчитать комиссию через
getUpdateFeeи приложить её вmsg.value - прочитать фид с ограничением по возрасту вместо
getPriceUnsafe - отклонить цену, когда confidence шире самой цены
- привести знаковый
expoк 18 decimals
Примеры запросов агенту
- Помоги обновить Pyth-фид на Hedera: получи
updateDataиз Hermes и отправьupdatePriceFeedsс достаточнымmsg.value. - Проверь мой контракт: чтение через
getPriceNoOlderThan, проверкаconfи нормализацияexpoк 18 decimals. - Собери чек-лист ревью для интеграции Pyth на Hedera testnet 296.
Как установить pyth-price-feeds
1Через Skills CLI (Vercel)
npx skills add hedera-dev/hedera-skills --skill pyth-price-feeds -a claude-code2Вручную: положить файлы
~/.claude/skills/pyth-price-feeds/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/pyth-price-feeds/
1Через Skills CLI (Vercel)
npx skills add hedera-dev/hedera-skills --skill pyth-price-feeds -a codex2Вручную: положить файлы
.agents/skills/pyth-price-feeds/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add hedera-dev/hedera-skills --skill pyth-price-feeds -a cursor2Вручную: положить файлы
.cursor/skills/pyth-price-feeds/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install hedera-dev/hedera-skills pyth-price-feeds2Вручную: положить файлы
.github/skills/pyth-price-feeds/SKILL.md1Через Skills CLI (Vercel)
npx skills add hedera-dev/hedera-skills --skill pyth-price-feeds -a gemini-cli2Командой платформы
gemini skills install https://github.com/hedera-dev/hedera-skills --path plugins/oracles/skills/pyth-price-feedsВручную: положить файлы
.devin/skills/pyth-price-feeds/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add hedera-dev/hedera-skills --skill pyth-price-feeds -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о pyth-price-feeds
Как установить pyth-price-feeds в Claude?
Выполните npx skills add hedera-dev/hedera-skills --skill pyth-price-feeds -a claude-code. Скилл появится в ~/.claude/skills/pyth-price-feeds/SKILL.md.
Что делает pyth-price-feeds?
Проводит агента по интеграции Pyth pull-фидов на Hedera: отправка Hermes-payload, оплата updatePriceFeeds, чтение через getPriceNoOlderThan и проверка confidence.
Что нужно учесть при работе с Pyth на Hedera?
Адреса контракта и price ID берутся из документации Pyth для Hedera, а не из Ethereum-дефолтов. msg.value на Hedera — это tinybars, и его должно хватать на комиссию Pyth.
Исходный текст
SKILL.md · Apache-2.0
---
name: pyth-price-feeds
description: >
Pyth pull price feeds on Hedera. Use when integrating Pyth on Hedera (testnet 296 /
mainnet 295), fetching Hermes update payloads, paying updatePriceFeeds, calling
getPriceNoOlderThan, checking confidence, or normalizing signed price + expo to 18 decimals.
---
# 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
| Piece | Role |
| ----- | ---- |
| Pyth contract | Network `IPyth` address |
| Price ID | `bytes32` feed id (not an aggregator address) |
| Update | Payable `updatePriceFeeds` with Hermes `updateData` |
| Fee | `getUpdateFee(updateData)` — `msg.value` must cover it |
| Read | `getPriceNoOlderThan(priceId, maxAge)` |
| Confidence | Reject when `conf > uint64(price)` |
| Scale | Signed `price` + `expo` → consumer decimals (often 18) |
**Hedera chain IDs:** testnet `296`, mainnet `295`.
See [references/hedera-feeds.md](references/hedera-feeds.md) for where to source the Pyth contract and price IDs. See [references/examples.md](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`:
| Check | Why |
| ----- | --- |
| `publishTime != 0` | Incomplete |
| `price > 0` | Invalid / non-positive |
| `conf > uint64(price)` | Confidence wider than the price |
| Normalize `expo` | `expo` 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
- [references/examples.md](references/examples.md) — update, read, and expo sketches
- [references/hedera-feeds.md](references/hedera-feeds.md) — where to source Pyth contract and price IDs
- [Pyth Price Feeds](https://docs.pyth.network/price-feeds)
- [Pyth EVM contract addresses](https://docs.pyth.network/price-feeds/core/contract-addresses/evm)
- [Hermes price feeds](https://hermes.pyth.network/v2/price_feeds)
© hedera-dev · Apache-2.0 · hedera-dev/hedera-skills