Skip to main content

Module pyth

Module pyth 

Source
Expand description

Pyth Hermes pull-feed helpers (PriceUpdateV2 accounts).

Replaces the legacy pyth-sdk-solana push-oracle dependency. Price update accounts are posted on-chain by the executor crank just before each oracle-gated instruction by calling the Pyth Receiver program (PYTH_RECEIVER_PROGRAM). This module reads them directly via borsh deserialization (no anchor-lang dependency required).

§Flow

  1. Executor fetches signed price update VAA from Hermes REST API.
  2. Executor posts it via PYTH_RECEIVER_PROGRAM::post_updatePriceUpdateV2 account.
  3. Executor calls our instruction with that account as pyth_price_feed_info.
  4. Program validates owner, feed ID, staleness, then reads price.

Structs§

Price

Functions§

anchor_open_snapshot
Writes open_* fields from a Hermes PriceUpdateV2 account.
assert_pyth_receiver_owner
load_fresh_price_hermes
Parse a PriceUpdateV2 account into our internal Price type.
outcome_from_open_close
UP/DOWN from open vs close prices at a common exponent (tie → DOWN).