> ## Documentation Index
> Fetch the complete documentation index at: https://docs.berachain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Oracle

> Price feeds for Bend markets; oracle-agnostic design, compatible types, and how to query price data.

Oracles supply price data to the chain. In Bend, a market's oracle answers: "How many USD is 1 unit of this collateral worth?" so the protocol can value collateral, set borrowing capacity, and trigger liquidations.

## Oracles in Bend markets

Oracles are used to:

* Value collateral
* Compute borrowing capacity
* Trigger liquidations when positions are undercollateralized
* Support interest rate logic

## Bend implementation

Bend is **oracle-agnostic**: each market specifies its oracle in its parameters. Market creators choose the feed that fits the asset (e.g. Chainlink, Redstone, API3, Pyth, Chronicle, or a custom implementation).

## Compatible oracle types

* **Price feed oracles**: External feeds for exchange rates (Chainlink, Redstone, API3, Pyth, Chronicle).
* **Exchange rate oracles**: For wrapped or rebasing tokens with deterministic rates (e.g. wstETH/stETH).
* **Fixed-price oracles**: For assets with a known peg (e.g. stablecoins).

## Getting price data

Steps to get the current price of a collateral (e.g. \$WBERA).

### 1. Get market ID

Find the Market ID on [Berachain Bend](https://bend.berachain.com/borrow).

<Frame>
  <img src="https://mintcdn.com/berachain-422fce37/spFyXF2YSQlNtmpH/images/bend/oracle-market-id.png?fit=max&auto=format&n=spFyXF2YSQlNtmpH&q=85&s=e40a1815226b3e3bb46f5ec9be8aa6ed" alt="Bend - Find Market Id" width="4384" height="2654" data-path="images/bend/oracle-market-id.png" />
</Frame>

### 2. Find oracle address

In [BeraScan](https://berascan.com/) look up the Morpho (Vault) address and open it:

```
# Morpho (Vault)
0x24147243f9c08d835C218Cda1e135f8dFD0517D0
```

<Frame>
  <img src="https://mintcdn.com/berachain-422fce37/spFyXF2YSQlNtmpH/images/bend/oracle-morpho.png?fit=max&auto=format&n=spFyXF2YSQlNtmpH&q=85&s=8ce1dd10dceb5b03be6493573045ecde" alt="Berascan - Find Oracle Address" width="4384" height="2654" data-path="images/bend/oracle-morpho.png" />
</Frame>

### 3. Get base feed address

In the oracle contract, read **BASE\_FEED\_1** and open the linked address.

<Frame>
  <img src="https://mintcdn.com/berachain-422fce37/spFyXF2YSQlNtmpH/images/bend/oracle-feed.png?fit=max&auto=format&n=spFyXF2YSQlNtmpH&q=85&s=4939f2a18bb0808c1eff6f6331487477" alt="Berascan - Find Base Feed Address" width="4384" height="2654" data-path="images/bend/oracle-feed.png" />
</Frame>

### 4. Get latest answer

In the base feed contract (or its proxy), call `latestAnswer`.

<Frame>
  <img src="https://mintcdn.com/berachain-422fce37/spFyXF2YSQlNtmpH/images/bend/oracle-latest-answer.png?fit=max&auto=format&n=spFyXF2YSQlNtmpH&q=85&s=2940dce282355cb317d736173dfdaaa0" alt="Berascan - Latest Price Answer" width="4384" height="2654" data-path="images/bend/oracle-latest-answer.png" />
</Frame>

The value uses **8 decimals**. For example, `202675951` means **2.02675951 USD** (divide by `100000000`).

```
# $BERA/$WBERA price
2.02675951 USD
```

## Oracle security

Oracle choice is critical and **immutable** for a Bend market. Before using a market:

* Verify the oracle implementation
* Understand the price sources
* Consider manipulation or failure modes
