# bfUSD Oracle

## Overview

bfUSD uses price feeds to convert between USDT, USDC, and the dual staking pools. USDT deposits are always treated as 1:1, while USDC conversions consult a Chainlink oracle to keep pricing fair when the stablecoin drifts slightly.

## hbfUSD / pbfUSD Ratio Tracking

* **`currentRatio()`** – exposes the current bfUSD-to-share ratio with 1e8 precision.
* **`epochRatios(uint256 epoch)`** – returns `(startRatio, endRatio, startTime, endTime)` so that front-ends can reconstruct how a share price changed inside an epoch.
* **`convertToShares` / `convertToAssets`** – reuse the ratio logic, so once the oracle provides the bfUSD value, the vault can translate between assets and shares deterministically.

## Notes

* Always call `previewDeposit`, `previewMint`, `previewWithdraw`, or `previewRedeem` to show the expected amounts before sending a transaction.
* For USDC flows, read the Chainlink feed first, then apply the vault ratio to determine the share amount to mint or burn.


---

# 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://bitfi-2.gitbook.io/bitfi/developer/using-contract/bfusd-oracle.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.
