# Frax 预言机概览

用于 Frax 资产的预言机，这些预言机使用链上价格并提供与 Chainlink 预言机相同的接口。

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MJQZW1mSg2O5N7HXHo0-1972196547%2Fuploads%2F0kvrEvgYuCMNOxiV5gWW%2FCopy%20of%20L2%20-%20frxEth_ETH%20and%20sfrxEth_Eth%20Frax%20Oracles%20(1).png?alt=media&#x26;token=1931e5e6-58ab-414f-9018-56c702af5363" alt=""><figcaption><p>Frax Oracles on L1</p></figcaption></figure>

## 动机 <a href="#motivation" id="motivation"></a>

为了提高我们资产在借贷协议、自动化做市商（AMMs）和金库产品中的采用速度，我们相信使用链上价格源的预言机是最可靠和可验证的。

### 主要组件

#### 双重预言机/价格源 <a href="#dual-oracle-price-source" id="dual-oracle-price-source"></a>

双重预言机/价格源合约从两个不同的链上源获取两个价格（高价和低价），并同时返回这两个价格。该合约随后将价格写入Frax预言机合约。这些合约在很大程度上受到Frax借贷双重预言机的启发。任何人都可以调用双重预言机上的`addRoundData()`函数，向Frax预言机添加最新的价格，只需支付燃料费。Frax协议每天对每种支持的资产调用一次此函数。

### Frax 预言机 <a href="#frax-oracle" id="frax-oracle"></a>

只有相应资产的双重预言机合约才能将价格写入相应的Frax预言机。Frax预言机存储的价格可以通过Chainlink风格的`AggregatorV3Interface`或Fraxlend的`getPrices()`风格检索。

当通过Chainlink风格与Frax预言机交互时，价格数据将是低价和高价的平均值。而在使用Fraxlend的`getPrices()`风格时，将同时提供低价和高价。&#x20;

如果底层Chainlink预言机发出价格不佳的信号，或者价格过旧，则该价格将被视为不良/陈旧。

### 关键要点 <a href="#key-takeaways" id="key-takeaways"></a>

Frax 预言机的价格可以像Chainlink预言机一样使用。

所有链上价格源都拥有深厚的Frax协议自有流动性，我们不会移除这部分流动性，从而提供了很高的安全性。


---

# 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.frax.finance/zh/frax-yu-yan-ji/frax-yu-yan-ji-gai-lan.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.
