Expand description
Pyth price-feed helpers (PriceUpdateV2 accounts — push or pull).
§Preferred flow (push feed accounts)
The Pyth Data Association maintains continuously-updated price feed accounts at fixed PDAs
(heartbeat ~400 ms). Pass crate::consts::PYTH_BTC_USD_PRICE_FEED_ACCOUNT directly to
oracle-gated instructions — no Hermes fetch or post_update_atomic required.
§Fallback flow (pull / Hermes)
- Caller fetches a signed price-update VAA from the Hermes REST API.
- Caller posts it via
PYTH_RECEIVER_PROGRAM::post_update_atomic→ ephemeralPriceUpdateV2. - Caller passes that account as
pyth_price_feed_info.
Both flows use the same PriceUpdateV2 borsh layout. The only difference is the account
owner (PYTH_PUSH_ORACLE_PROGRAM for push feeds, PYTH_RECEIVER_PROGRAM for pull). This
module accepts either.
Structs§
Functions§
- anchor_
open_ snapshot - Writes
open_*fields from a HermesPriceUpdateV2account. - assert_
pyth_ receiver_ owner - Assert that
infois owned by either the Pyth Receiver program (pull feeds /post_update_atomic) or the Pyth Push Oracle program (continuously-maintained push feed accounts). - load_
fresh_ price_ hermes - Parse a
PriceUpdateV2account into our internalPricetype. - outcome_
from_ open_ close - UP/DOWN from open vs close prices at a common exponent (tie → DOWN).