Skip to main content

IPyth

Git Source

Title: IPyth

Minimal interface for Pyth Network price feeds

Based on Pyth Network's IPyth interface

Functions

getPriceNoOlderThan

Get the price object with a published timestamp from before than age seconds in the past

Returns the latest price object for the requested price feed ID, if it has been updated sufficiently recently

function getPriceNoOlderThan(bytes32 priceId, uint256 age) external view returns (Price memory price);

Parameters

NameTypeDescription
priceIdbytes32The ID of the price feed
ageuint256Maximum age of the on-chain price in seconds

Returns

NameTypeDescription
pricePricePrice struct containing price, confidence interval, exponent, and publishTime

Structs

Price

Price struct returned by Pyth Network

struct Price {
int64 price;
uint64 conf;
int32 expo;
uint256 publishTime;
}

Properties

NameTypeDescription
priceint64Price value (multiply by 10^expo to get the decimal value)
confuint64Confidence interval, indicating that the actual asset price is ± conf (multiply by 10^expo to get the decimal value)
expoint32Exponent
publishTimeuint256Timestamp when price was published