{"eip":7726,"title":"Common Quote Oracle","description":"Interface for data feeds providing the relative value of assets.","authors":["alcueca (@alcueca)","ruvaag (@ruvaag)","totomanov (@totomanov)","r0ohafza (@r0ohafza)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2024-06-20","requires":[7528],"discussionsTo":"https://ethereum-magicians.org/t/erc-7726-common-quote-oracle/20351","repo":"ERCs","label":"ERC-7726","officialUrl":"https://eips.ethereum.org/EIPS/eip-7726","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7726.md","url":"https://eips.huatuo.xyz/eip-7726/","tldr":{"en":"A one-function oracle interface, getQuote(amount, base, quote), that returns how much of one asset another amount is worth, so protocols can swap price feeds without custom adapters or decimal math.","ja":"ある量の資産が別の資産でどれだけの価値になるかを返す、1 関数だけのオラクルインターフェース getQuote(amount, base, quote)。プロトコルは専用アダプターや decimals の計算なしに価格フィードを差し替えられる。","ko":"어떤 자산의 일정량이 다른 자산으로 얼마의 가치인지 알려 주는 함수 하나짜리 오라클 인터페이스 getQuote(amount, base, quote). 프로토콜이 맞춤 어댑터나 decimals 계산 없이 가격 피드를 교체할 수 있게 한다.","zh":"一个只有一个函数的预言机接口 getQuote(amount, base, quote)，返回某数量的一种资产值多少另一种资产，使协议无需自定义适配器或小数位计算即可更换价格源。"},"tags":["oracle","defi","price-feed","interface"],"explainers":{"en":{"lang":"en","tldr":"A one-function oracle interface, getQuote(amount, base, quote), that returns how much of one asset another amount is worth, so protocols can swap price feeds without custom adapters or decimal math.","tags":["oracle","defi","price-feed","interface"],"related":[7528,20,4626],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7726/","markdown":"## What problem does it solve?\n\nValuing assets on-chain means integrating price sources that each have their own API, decimals convention and security model. Over the years many protocols built their own oracle adapter layers to hide this, duplicating a lot of work and repeating the same decimal-scaling bugs.\n\nERC-7726 defines a common, minimal API for \"how much is X of asset A worth in asset B\". It deliberately returns **token amounts**, not decimal price factors, which the authors say leads to safer integrations and faster shipping.\n\n## How it works\n\nThere is a single view function:\n\n```\ngetQuote(uint256 baseAmount, address base, address quote) returns (uint256 quoteAmount)\n```\n\n- `base`: the asset being valued. `quote`: the asset to value it in.\n- The result is an amount of `quote` in its own smallest units. For example, asking for `1000e6` USDC in ETH terms returns an ETH amount in wei. The caller never has to know either token's decimals.\n- It **must round down** toward zero and **must revert** if the result would overflow `uint256`.\n\nAssets without an address get conventional ones:\n\n| Asset | Address |\n| --- | --- |\n| ETH | `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE` ([ERC-7528](/eip-7528/)) |\n| BTC | `0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB` |\n| Fiat with an ISO 4217 code | `address(code)`, e.g. `address(840)` for USD |\n\nThere is no `getPrice`. If you want \"price of one whole unit\", request a quote for `10 ** decimals` of the base token.\n\n## Sample code\n\nInterface and a consumer that values collateral:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC7726 {\n    function getQuote(uint256 baseAmount, address base, address quote)\n        external view returns (uint256 quoteAmount);\n}\n\ncontract CollateralCheck {\n    address constant USD = address(840);\n    IERC7726 public immutable oracle;\n\n    constructor(IERC7726 _oracle) { oracle = _oracle; }\n\n    // Value of `amount` units of `token`, expressed in the oracle's USD units.\n    function valueInUsd(address token, uint256 amount) external view returns (uint256) {\n        return oracle.getQuote(amount, token, USD);\n    }\n}\n```\n\n## Things to know\n\n- **Status: Draft.** Function names and special addresses may still change.\n- The interface intentionally has no way to check freshness, confidence or validity of the data. Each implementation is expected to publish its own guarantees (staleness, when it stops serving data), and consumers must review them before integrating.\n- Because results are rounded down, chained quotes (A to B to C) can lose precision; design for that when composing adapters.\n- Most existing feeds (Chainlink-style, TWAPs, [ERC-4626](/eip-4626/) vault rates) can be wrapped behind this interface with an adapter.\n- The ETH address convention comes from [ERC-7528](/eip-7528/); the BTC and ISO 4217 conventions are defined in this ERC.\n"},"ja":{"lang":"ja","tldr":"ある量の資産が別の資産でどれだけの価値になるかを返す、1 関数だけのオラクルインターフェース getQuote(amount, base, quote)。プロトコルは専用アダプターや decimals の計算なしに価格フィードを差し替えられる。","tags":["oracle","defi","price-feed","interface"],"related":[7528,20,4626],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7726/","markdown":"## 何を解決するのか\n\nオンチェーンで資産を評価するには、それぞれ独自の API、decimals の慣習、セキュリティモデルを持つ価格ソースを統合する必要があります。長年にわたり、多くのプロトコルがこれを隠すために独自のオラクルアダプター層を作り、多くの作業を重複させ、同じ decimals スケーリングのバグを繰り返してきました。\n\nERC-7726 は「資産 A の X は資産 B でいくらの価値か」を表す、共通で最小限の API を定義します。意図的に、10 進の価格係数ではなく**トークン量**を返します。著者らによると、これにより統合が安全になり、リリースも早くなります。\n\n## 仕組み\n\nview 関数は 1 つだけです。\n\n```\ngetQuote(uint256 baseAmount, address base, address quote) returns (uint256 quoteAmount)\n```\n\n- `base`: 評価される資産。`quote`: 評価に使う資産。\n- 結果は、`quote` の最小単位で表した量です。たとえば `1000e6` USDC を ETH 建てで尋ねると、wei 単位の ETH 量が返ります。呼び出し側はどちらのトークンの decimals も知る必要がありません。\n- 0 方向への**切り捨てが必須**で、結果が `uint256` をオーバーフローする場合は **revert が必須**です。\n\nアドレスを持たない資産には、慣習的なアドレスが割り当てられます。\n\n| 資産 | アドレス |\n| --- | --- |\n| ETH | `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`（[ERC-7528](/eip-7528/)） |\n| BTC | `0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB` |\n| ISO 4217 コードを持つ法定通貨 | `address(code)`。例: USD は `address(840)` |\n\n`getPrice` はありません。「1 単位あたりの価格」が欲しい場合は、base トークンの `10 ** decimals` の見積もりを要求してください。\n\n## サンプルコード\n\nインターフェースと、担保を評価するコンシューマー:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC7726 {\n    function getQuote(uint256 baseAmount, address base, address quote)\n        external view returns (uint256 quoteAmount);\n}\n\ncontract CollateralCheck {\n    address constant USD = address(840);\n    IERC7726 public immutable oracle;\n\n    constructor(IERC7726 _oracle) { oracle = _oracle; }\n\n    // Value of `amount` units of `token`, expressed in the oracle's USD units.\n    function valueInUsd(address token, uint256 amount) external view returns (uint256) {\n        return oracle.getQuote(amount, token, USD);\n    }\n}\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** 関数名や特別なアドレスはまだ変更される可能性があります。\n- このインターフェースには、データの鮮度、信頼度、有効性を確認する手段が意図的にありません。各実装は自身の保証（古さの許容範囲、データ提供を止める条件など）を公開することが期待されており、コンシューマーは統合前にそれを確認する必要があります。\n- 結果は切り捨てられるため、連鎖した見積もり（A から B、B から C）では精度が失われることがあります。アダプターを組み合わせるときはそれを考慮して設計してください。\n- 既存のフィード（Chainlink 型、TWAP、[ERC-4626](/eip-4626/) の vault レートなど）の多くは、アダプターを使ってこのインターフェースの背後にラップできます。\n- ETH のアドレスの慣習は [ERC-7528](/eip-7528/) に由来し、BTC と ISO 4217 の慣習はこの ERC で定義されています。\n"},"ko":{"lang":"ko","tldr":"어떤 자산의 일정량이 다른 자산으로 얼마의 가치인지 알려 주는 함수 하나짜리 오라클 인터페이스 getQuote(amount, base, quote). 프로토콜이 맞춤 어댑터나 decimals 계산 없이 가격 피드를 교체할 수 있게 한다.","tags":["oracle","defi","price-feed","interface"],"related":[7528,20,4626],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7726/","markdown":"## 어떤 문제를 해결하나요?\n\n온체인에서 자산을 평가하려면 각자 고유한 API, decimals 관례, 보안 모델을 가진 가격 소스를 통합해야 합니다. 오랫동안 많은 프로토콜이 이를 감추려고 자체 오라클 어댑터 계층을 만들었고, 그 결과 많은 작업이 중복되고 같은 decimals 스케일링 버그가 반복되었습니다.\n\nERC-7726은 \"자산 A의 X만큼은 자산 B로 얼마인가\"에 대한 공통의 최소 API를 정의합니다. 소수점이 있는 가격 계수가 아니라 **토큰 수량**을 반환하도록 일부러 설계했으며, 저자들은 이것이 더 안전한 통합과 더 빠른 출시로 이어진다고 말합니다.\n\n## 어떻게 동작하나요?\n\nview 함수는 하나뿐입니다.\n\n```\ngetQuote(uint256 baseAmount, address base, address quote) returns (uint256 quoteAmount)\n```\n\n- `base`: 평가 대상 자산. `quote`: 평가 기준이 되는 자산.\n- 결과는 `quote`의 가장 작은 단위로 나타낸 수량입니다. 예를 들어 `1000e6` USDC를 ETH로 물으면 wei 단위의 ETH 수량이 반환됩니다. 호출자는 어느 토큰의 decimals도 알 필요가 없습니다.\n- 0 방향으로 **반드시 내림**해야 하며, 결과가 `uint256`을 넘치면 **반드시 revert**해야 합니다.\n\n주소가 없는 자산에는 관례적인 주소를 씁니다.\n\n| 자산 | 주소 |\n| --- | --- |\n| ETH | `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE` ([ERC-7528](/eip-7528/)) |\n| BTC | `0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB` |\n| ISO 4217 코드가 있는 법정화폐 | `address(code)`, 예: USD는 `address(840)` |\n\n`getPrice`는 없습니다. \"1 단위의 가격\"이 필요하면 base 토큰의 `10 ** decimals`만큼에 대한 견적을 요청하세요.\n\n## 샘플 코드\n\n인터페이스와 담보를 평가하는 소비자 컨트랙트:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC7726 {\n    function getQuote(uint256 baseAmount, address base, address quote)\n        external view returns (uint256 quoteAmount);\n}\n\ncontract CollateralCheck {\n    address constant USD = address(840);\n    IERC7726 public immutable oracle;\n\n    constructor(IERC7726 _oracle) { oracle = _oracle; }\n\n    // Value of `amount` units of `token`, expressed in the oracle's USD units.\n    function valueInUsd(address token, uint256 amount) external view returns (uint256) {\n        return oracle.getQuote(amount, token, USD);\n    }\n}\n```\n\n## 알아둘 점\n\n- **상태: Draft.** 함수 이름과 특수 주소는 아직 바뀔 수 있습니다.\n- 이 인터페이스에는 데이터의 최신성, 신뢰도, 유효성을 확인하는 방법이 의도적으로 없습니다. 각 구현이 자체 보장 사항(데이터 지연 정도, 데이터 제공을 멈추는 시점)을 공개해야 하며, 소비자는 통합 전에 이를 검토해야 합니다.\n- 결과가 내림되므로 연쇄 견적(A에서 B, B에서 C)은 정밀도를 잃을 수 있습니다. 어댑터를 조합할 때 이를 고려해 설계하세요.\n- 기존 피드 대부분(Chainlink 방식, TWAP, [ERC-4626](/eip-4626/) 볼트 환율)은 어댑터로 이 인터페이스 뒤에 감쌀 수 있습니다.\n- ETH 주소 관례는 [ERC-7528](/eip-7528/)에서 왔고, BTC와 ISO 4217 관례는 이 ERC에서 정의합니다.\n"},"zh":{"lang":"zh","tldr":"一个只有一个函数的预言机接口 getQuote(amount, base, quote)，返回某数量的一种资产值多少另一种资产，使协议无需自定义适配器或小数位计算即可更换价格源。","tags":["oracle","defi","price-feed","interface"],"related":[7528,20,4626],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7726/","markdown":"## 它解决什么问题？\n\n在链上给资产估值，需要集成各自拥有独立 API、小数位约定和安全模型的价格源。多年来，许多协议构建了自己的预言机适配层来屏蔽这些差异，结果重复了大量工作，也一再犯下同样的小数缩放错误。\n\nERC-7726 定义了一个通用的最小 API，用来回答\"X 数量的资产 A 值多少资产 B\"。它刻意返回**代币数量**，而不是带小数的价格系数，作者认为这样集成更安全，上线也更快。\n\n## 它如何运作\n\n只有一个 view 函数：\n\n```\ngetQuote(uint256 baseAmount, address base, address quote) returns (uint256 quoteAmount)\n```\n\n- `base`：被估值的资产。`quote`：用来计价的资产。\n- 返回结果是以 `quote` 自身最小单位表示的数量。例如，询问 `1000e6` USDC 折合多少 ETH，会返回以 wei 为单位的 ETH 数量。调用方无需知道任何一方代币的小数位数。\n- 它**必须向零取整（向下舍入）**，并且如果结果会溢出 `uint256`，**必须 revert**。\n\n没有地址的资产会使用约定的地址：\n\n| 资产 | 地址 |\n| --- | --- |\n| ETH | `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`（[ERC-7528](/eip-7528/)） |\n| BTC | `0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB` |\n| 有 ISO 4217 代码的法币 | `address(code)`，例如 USD 为 `address(840)` |\n\n没有 `getPrice`。如果想要\"一个完整单位的价格\"，请求 base 代币 `10 ** decimals` 数量的报价即可。\n\n## 示例代码\n\n接口，以及一个给抵押品估值的调用方：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IERC7726 {\n    function getQuote(uint256 baseAmount, address base, address quote)\n        external view returns (uint256 quoteAmount);\n}\n\ncontract CollateralCheck {\n    address constant USD = address(840);\n    IERC7726 public immutable oracle;\n\n    constructor(IERC7726 _oracle) { oracle = _oracle; }\n\n    // Value of `amount` units of `token`, expressed in the oracle's USD units.\n    function valueInUsd(address token, uint256 amount) external view returns (uint256) {\n        return oracle.getQuote(amount, token, USD);\n    }\n}\n```\n\n## 需要注意\n\n- **状态：Draft。** 函数名和特殊地址仍可能变化。\n- 该接口有意不提供检查数据新鲜度、置信度或有效性的方法。每个实现都应公布自己的保证（数据过期情况、何时停止提供数据），调用方在集成前必须仔细审阅。\n- 由于结果向下取整，链式报价（A 到 B 再到 C）可能损失精度；组合适配器时要针对这一点做好设计。\n- 大多数现有的价格源（Chainlink 风格、TWAP、[ERC-4626](/eip-4626/) 金库汇率）都可以通过适配器包装到这个接口之后。\n- ETH 的地址约定来自 [ERC-7528](/eip-7528/)；BTC 和 ISO 4217 的约定在本 ERC 中定义。\n"}},"requiredBy":[8377]}
