Blog

A few notes about @PythNetwork Oracle implementations

There are a few things to keep in mind when working with the Pyth Oracle:

- Everyone can update the oracle price, pulling the most recent price data and update it. This can be done by calling the updatePriceFeeds function on this contract for example:

https://arbiscan.io/address/0xff1a0f4744e8582df1ae09d5611b887b6a12925c#readProxyContract

This makes the Pyth oracle a so-called "pull-oracle" because you need to pull the price yourself, ensuring it is always up to date. Contrary to that, @chainlink oracles are push oracles which are always up to date

- The price update costs ETH, you need to provide it with the updatePriceFeeds call

- You can fetch the updated/unupdated price via the getPrice function, providing the corresponding feedId

- The getPrice function will return the following:

a) price: (with decimals)

b) confidence: internal: +- deviation

c) expo: (decimals used)

d) lastPublish: last time the price was updated




Now you can use these information to scale the price to its desired decimals for example 18 and use the upper or lower bound depending on your usage:

scaledPrice18 = price * 10 ^ (18 + (expo))

*correct int conversion needed here*