PriceProviderAggregatorPyth
Overview
License: MIT
The PriceProviderAggregatorPyth contract is the contract that provides the functionality of getting the latest price from PythNetwork.
Contract that provides the functionality of getting the latest price from PythNetwork. Inherit from PriceProviderAggregator.
Events info
SetPythPriceProvider
Emitted when a new Pyth price provider is set.
State variables info
pythPriceProvider (0x5ea2a7a9)
Functions info
setPythPriceProvider (0x2ebccb0f)
Sets PythPriceProvider contract.
Requirements:
The caller must be the moderator.
newPythPriceProvider
must not be the zero address.
Parameters:
Name | Type | Description |
---|---|---|
newPythPriceProvider | address | The address of PythPriceProvider contract. |
updateMultiFinalPricesWithUpdatePrice (0x2a92f7f1)
Calculates and update multiple the final TWAP prices of a token after update price.
Parameters:
Name | Type | Description |
---|---|---|
token | address[] | The token array needs to update the price. |
priceIds | bytes32[] | The priceIds need to update. |
updateData | bytes[] | The updateData provided by PythNetwork. |
updatePrices (0x0aa9adbc)
Performs a price update if the price is no longer valid.
Parameters:
Name | Type | Description |
---|---|---|
priceIds | bytes32[] | The priceIds need to update. |
updateData | bytes[] | The updateData provided by PythNetwork. |
getUpdatedPrice (0xb876879d)
Returns the latest price of a given token in USD after update price if price provider is pythPriceProvider.
Parameters:
Name | Type | Description |
---|---|---|
token | address | The address of the token to get the price of. |
priceIds | bytes32[] | The priceIds need to update price. |
updateData | bytes[] | The updateData provided by PythNetwork. |
Return values:
Name | Type | Description |
---|---|---|
priceDecimals | uint8 | The number of decimal places in the price of the token. |
timestamp | uint64 | The timestamp of the price. |
collateralPrice | uint256 | The price of the token in USD, represented as a mantissa. |
capitalPrice | uint256 | The price of the token in USD, represented as a mantissa. |
getExpiredPriceFeeds (0xe1f67b13)
Returns the priceId array to update the price before expiration and the update fee.
Parameters:
Name | Type | Description |
---|---|---|
token | address[] | The address array of tokens needs to check if the price is about to expire. |
timeBeforeExpiration | uint256 | Time before expiration. |
Return values:
Name | Type | Description |
---|---|---|
priceIds | bytes32[] | The priceId array needs to update the price. |
updateFee | uint256 | The update fee. |
Last updated