Working with the IPOR Index
Last updated
Last updated
There are at least three ways to query IPOR Index. Each way to query an index has its intended use and has certain advantages.
From the oracle contract
It's the most gas efficient, as reading the values on-chain does not require complex calculations or calls to external contracts.
It provides additional params such as exponential moving average or exponential moving variance calculated on-chain
It allows for calculating the average IPOR rate between 2 points in time, thanks to the IBT.
IPOR swaps use this method to read the IPOR rate
If you want to read the value of IPOR along with the most recent IBT value then use
It provides the real-time IPOR for a given block.
From the API
Does not require a connection to the blockchain
It provides historical data.
Does not require any authentication, and it's free to query.
Because the calculation of IPOR is done on-chain in the calculation index, it is possible for specific DAO-appointed validators to run an on-chain update of the oracle contract. Albeit not the most gas efficient, it may be beneficial in some cases to force an update of IPOR if you rely on the most recent data in our integration.