# Oracles

defi.money has developed a custom Oracle solution that is designed for use in L2 and sidechain environments where gas costs are negligible. In short, it calculates an exponential moving average from a Chainlink feed.&#x20;

The reason an EMA is calculated despite the high gas costs associated with that is that the price data from raw Chainlink feeds can be jittery, especially for less-liquid assets:

<figure><img src="/files/ojkatQgk6OK6u65y1RQN" alt=""><figcaption><p>Example of a raw Chainlink feed for the $OP token (red)</p></figcaption></figure>

For loans in Collateral conversion, that kind of jittery-ness could lead to unnecessary losses as the Automated Loan Protection system would trigger more than necessary, trading the collateral back and forth to keep the loan backed while maintaining as much collateral as possible for the user.\
\
defi.money's custom EMA implementation ensures this is not a problem, by being smooth enough to prevent unnecessary trading while in Collateral conversion, while tracking the price reliably, to ensure no bad debt in the protocol.

The implementation can be found here:&#x20;

{% embed url="<https://github.com/defidotmoney/dfm-contracts/blob/main/contracts/cdp/oracles/ChainlinkEMA.sol>" %}

The audit of the implementation can be found here:

{% embed url="<https://github.com/defidotmoney/audits/blob/main/audits/ChainlinkEMA%20-%20BailSec%20-%20June%202024.pdf>" %}

### For non-Chainlink supported chain

For non-Chainlink supported chain defi.money uses RedStone Oracles as the source of price data. [RedStone](https://redstone.finance/) is a Modular Oracle that delivers frequently updated, reliable, and diverse data feeds in a few models. Defi.money utilizes the [Push](https://docs.redstone.finance/docs/get-started/models/redstone-push) model which ensures that data is pushed into on-chain storage via a relayer with set conditions (with a heartbeat and deviation threshold).


---

# 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://docs.defi.money/welcome/protocol-components/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.
