# Oracles

{% hint style="info" %}
**This documentation is a work in progress!**
{% endhint %}

## **Price Feeds**

The protocol needs the live USD denominated price for all [Kopio Assets](/kopio-docs/fundamentals/kresko-assets.md#overview) and [Collateral Assets](/kopio-docs/fundamentals/collateral-assets.md). This task is performed by an oracle network. These oracle networks are the off-chain information source for price data to the protocol.

Kopio 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 uses two oracle networks: **Pyth** and **Chainlink.** Additionally it supports **Redstone** and **API3** as alternatives.

## Push Oracles

Traditional price feeds provided by eg. [Chainlink](https://chain.link) (except their new [Data Streams](https://docs.chain.link/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](https://redstone.finance/), [Pyth](https://pyth.network/) 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.

{% hint style="info" %}
Kopio protocol 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.
  {% endhint %}

## Market Status

The protocol also needs a boolean value indicating whether the underlying assets market is open for a Kopio Asset. When the market of the underlying asset for a Kopio Asset is closed, [borrowing](/kopio-docs/fundamentals/cdps/icdp/minting-borrowing.md) 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kopio.gitbook.io/kopio-docs/fundamentals/oracles.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
