Oracles
Last updated
Last updated
The protocol needs the live USD denominated price for all and . 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.
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.
Currently the protocol uses two oracle networks: Pyth and Chainlink. Additionally it supports Redstone and API3 as alternatives.
Traditional price feeds provided by eg. (except their new ) 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.
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.
For crypto assets, price feeds are generally available 24/7 throughout the year.
Oracles like , 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.
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, will be disabled. When the market re-opens, borrowing is automatically enabled.