Oracles

This documentation is a work in progress!

Price Feeds

The protocol needs the live USD denominated price for all Kresko Assets and Collateral Assets. This task is performed by an oracle network. These oracle networks are the off-chain information source for price data to the protocol.

Kresko protocol uses a combination of push and on-demand oracles to consume price data.

Asset Valuations

The protocol denominates all values in USD. The prices are obtained from one or more oracle providers which determine the price from multiple sources.

Each asset has a primary and a reference price source which correspond to different oracle networks. Deviation is measured before using the primary price.

If the deviation is higher than the configurable percentage threshold, any action is rejected, which is also the case for a stale or missing price and when a L2 sequencer is down.

Supported Oracle Networks

Currently the protocol supports the following oracle networks: Chainlink, Redstone and API3.

Push Oracles

Traditional price feeds provided by eg. Chainlink (except their new Data Streams) work by having their network validate and transmit the aggregated price information from multiple reputable data sources to an on-chain contract where it can be consumed by the protocol.

On-Demand Oracles

Oracles like Redstone, Pyth and Chainlink Data Streams use a different mechanic to allow consuming of validated data. Instead of on-chain contract having its storage continously updated with transactions containing the fresh data, the data (eg. price) is signed by the oracle networks validator set and appended into each user transaction that needs it. The appended data and its signers are validated on-chain.

Kresko expects a valid price from atleast one push and one on-demand oracle provider.

Price Deviation

  • The protocol contains a deviation percentage which serves as a comparison point between the oracle providers.

  • If the two prices differ from each other more than this percentage, the transaction taking place will be reverted.

Unexpected scenarios

  • In the case of a sequencer being down on Optimistic Rollups like Arbitrum or Optimism, the protocol will accept on-demand oracle prices exclusively.

  • In the case of either oracle posting a 0 price, the other oracle price is used.

Market Status

The protocol also needs a boolean value indicating whether the underlying assets market is open for a Kresko Asset. When the market of the underlying asset for a Kresko Asset is closed, borrowing will be disabled. When the market re-opens, borrowing is automatically enabled.

Traditional Finance Assets

Assets such as stocks, commodities, and ETFs typically trade on exchanges whose markets trade only during normal market hours. For instance, TSLA listed on NASDAQ trades between 9:30 am and 4 pm (Eastern Time) on weekdays only. It doesn’t trade on weekends or on market holidays.

Crypto assets

For crypto assets, price feeds are generally available 24/7 throughout the year.

Last updated