Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

IPyth

Git Source

Title: Pyth Network Interface (minimal)

Minimal interface for reading Pyth price feeds.

Functions

getPriceUnsafe

Returns the price without staleness checks.

function getPriceUnsafe(
    bytes32 id
) external view returns (PythStructs.Price memory price);

Parameters

NameTypeDescription
idbytes32The Pyth price feed ID.

Returns

NameTypeDescription
pricePythStructs.PriceThe price data.

getPriceNoOlderThan

Returns the price if it’s no older than age seconds.

function getPriceNoOlderThan(
    bytes32 id,
    uint256 age
) external view returns (PythStructs.Price memory price);

Parameters

NameTypeDescription
idbytes32The Pyth price feed ID.
ageuint256Maximum acceptable age in seconds.

Returns

NameTypeDescription
pricePythStructs.PriceThe price data.

updatePriceFeeds

Updates price feeds with signed data from Pyth.

function updatePriceFeeds(
    bytes[] calldata updateData
) external payable;

Parameters

NameTypeDescription
updateDatabytes[]Array of price update data.

getUpdateFee

Returns the fee required to update price feeds.

function getUpdateFee(
    bytes[] calldata updateData
) external view returns (uint256 feeAmount);

Parameters

NameTypeDescription
updateDatabytes[]Array of price update data.

Returns

NameTypeDescription
feeAmountuint256The required fee in wei.