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

# Oracle design

> How collateral prices and the won-dollar exchange rate determine collateral value.

[한국어로 읽기](https://docs.batt.farm/price-and-oracles.md)

## What does an oracle do?

A smart contract is a program that executes rules on a blockchain. It can read information recorded onchain, but it cannot directly look up an exchange price or FX rate on the internet.

An [oracle](https://docs.batt.farm/en/glossary.md#oracle) supplies external information to smart contracts. Lending protocols use its prices to value collateral and check whether that value is sufficient to back the debt. Each protocol sets its own liquidation thresholds and rules.

## How does batt use oracles?

Loans in batt are denominated in KRW\*, so batt also needs to value collateral in won. For ETH collateral, the protocol needs the amount deposited, ETH's dollar price, and the won-dollar exchange rate.

batt uses those inputs to calculate the collateral's value in won. It then compares that value with the debt to calculate the collateral ratio and determine whether the position can be liquidated.

## Combining the dollar price and exchange rate

For ETH, the relationship is **ETH/USD × USD/KRW = ETH/KRW**, where USD/KRW means the number of won per dollar.

Multiply the resulting price in won by the amount deposited to get the position's collateral value. The formula describes how to calculate that value; it does not specify a data provider or feed configuration.

When valuing wrapped tokens or yield-bearing collateral, account for the conversion rate into the underlying asset and any difference between the token's market price and its underlying value.

## A constant ETH price does not mean a constant won value

Consider the value of one ETH:

| Scenario | ETH/USD | USD/KRW | Won value |
| - | - | - | - |
| Starting point | \$2,000 | ₩1,400 | ₩2.8 million |
| Stronger won | \$2,000 | ₩1,300 | ₩2.6 million |
| Stronger won and lower ETH price | \$1,800 | ₩1,300 | ₩2.34 million |

When the won strengthens, each dollar is worth fewer won, so the collateral is worth less in won. A fall in ETH's dollar price would reduce that value further. The exchange rate does not increase the number of KRW\* tokens you owe.

See [Managing your position](https://docs.batt.farm/en/manage-position.md#collateral-ratio-and-liquidation) for collateral-ratio calculations and ways to respond.

## Check when each price was updated

An up-to-date collateral price combined with an old exchange rate can give a valuation that differs from the current market. When assessing your collateral ratio, check when each price was last updated.

FX data availability and update intervals vary by provider. A paused feed does not mean that won trading has stopped in every market. When a stale input updates, the collateral ratio can change abruptly.

## A valuation is not an execution price

An oracle provides a reference price, but it does not provide a buyer at that price. The price you can sell the collateral for depends on liquidity, price impact, and fees.

The oracle's valuation of your collateral and KRW\*'s market price are separate. The reference values used to calculate your collateral ratio do not determine how much you will pay to buy KRW\* for repayment.

## Implementation details not yet published

We have not yet published feed addresses, limits on how old a price can be, or rules for handling feed failures. This explanation should not be taken as confirmation that fallback feeds, weekend handling, or automatic transaction halts are implemented.

[Manage changes in your collateral ratio](https://docs.batt.farm/en/manage-position.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.