What it offers
- getPrice: Read price from Pyth oracle by price feed ID
Notes
- Pull-based oracle: users must call updatePriceFeeds before reading prices
- Sub-second latency from institutional market data providers
- Actual price = price * 10^expo (e.g. price=12345, expo=-2 means $123.45)
- Price feed IDs are bytes32 - see Pyth docs for specific feed IDs per asset
- updatePriceFeeds requires sending ETH to pay the update fee (use getUpdateFee to check)
- Get price update data from Pyth Hermes API off-chain, then submit on-chain
Its names in a program
On Ethereum,Pyth is a namespace: its contracts need no import.
Deployments
ABI
PythOracleABI
import PythOracleABI from "./protocols/pyth/PythOracleABI.json"; Speaks for: oracle.
updatePriceFeeds(bytes[] updateData) payablegetPrice(bytes32 id) view returns ((int64 price, uint64 conf, int32 expo, uint256 publishTime) price)getUpdateFee(bytes[] updateData) view returns (uint256 feeAmount)
Next steps
- Protocols: the other protocols, by what they do.
- Protocols and tokens: calling a contract by its namespace, or through its ABI.
- Glossary: the words these pages use, in plain terms.
