Working with the IPOR Index

There are at least three ways to query IPOR Index. Each way to query an index has its intended use and has certain advantages.

Reading IPOR

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

getIndex(asset address) // pass address of ERC token for which to read IPOR

If you want to read the value of IPOR along with the most recent IBT value then use

getAccruedIndex(asset address, timestamp uint256) 
// pass address of ERC token for which to read IPOR,
// and current timestamp  

From the index calculation contract

  • It provides the real-time IPOR for a given block.

calculateIpor(asset address) // pass address of ERC token for which to calculate IPOR

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.

Publishing IPOR

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.

updateIndex(asset address)

Last updated