Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

ERC-7726 proposes a safer, less error-prone way to integrate oracles by expressing the relative value of an asset as an amount of another asset rather than as a price.

This article translates, summarizes, and expands on the following proposal as covered in the original article.

I also cover other EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.

Overview

ERC-7726 defines a common API for data feeds that provide the relative value of assets (often called price feeds). Its distinguishing feature is that it requires explicit token amounts rather than price factors.

A data feed supplies a smart contract with information about the value of one asset relative to another. Typical examples include how many US dollars one ETH is worth, or how much ETH one token is worth. This information is usually obtained through an external data provider known as an oracle.

Traditional designs often calculate values by multiplying a price factor by an amount. However, this approach is prone to several problems.

  • Incorrect handling of decimal places
  • Bugs caused by differences in token decimal precision
  • Risks when implementers misunderstand the assumptions behind a quoted price

To avoid these problems, ERC-7726 returns an explicit amount of another token representing the value of a given token amount, rather than returning a price itself.

The intended benefits are:

  • Fewer implementation errors in consuming contracts
  • Improved security
  • Shorter time to market

ERC-7726 aims to prevent common mistakes in price calculations through API design.

Motivation

The information needed to value assets accurately is not available from a single source. In practice, developers encounter:

  • Major oracle providers
  • Smaller or specialized data sources
  • Proprietary APIs and data formats
  • Different security models and trust assumptions

Data sources are fragmented and lack a common interface.

Consequently, many DeFi protocols and smart contracts have implemented their own oracle adapter layers.

An oracle adapter layer is an intermediary that converts external pricing information into the protocol's internal format so that it can be consumed safely.

This approach has clear drawbacks.

  • Similar implementations are repeated across projects.
  • Implementation quality and security vary.
  • Development effort that could otherwise be avoided is incurred repeatedly.

In effect, each project encounters the same integration difficulties.

ERC-7726 is designed to improve this situation. By providing a standard API that covers a broad range of use cases, it aims to:

  • Reduce the complexity of oracle integrations.
  • Keep the protocol's core logic simple.
  • Enable safer implementations even when teams have limited oracle expertise or development resources.

A particularly important design priority is usability for product teams without specialized knowledge or substantial engineering resources. Ease of adoption and resistance to mistakes take precedence over maximum flexibility.

ERC-7726 directly addresses the following issues.

Problem ERC-7726 approach
Fragmented oracle interfaces Provide a standard API
Vulnerabilities caused by implementation mistakes Use explicit token amounts
Rising development costs Reduce duplication through a common interface
Differences in quality due to uneven expertise Mitigate them through simple design

ERC-7726 seeks to improve not only the handling of accurate price data but also the developer experience of working with it.

Specification

Terminology

Instead of using terms such as price or rate, ERC-7726 explicitly identifies the asset being valued and the asset in which its value is expressed. It defines three terms for this purpose.

Base asset

The base asset is the asset whose value is being determined.

For example, if you want to know how much ETH one million USDC is worth, USDC is the base asset.

The important point is that the asset whose specified amount is being valued is the base asset.

Quote asset

The quote asset is the asset used to express the value of the base asset.

In the previous example, ETH is the quote asset because the value of USDC is being expressed in ETH.

The relationship is therefore:

  • base asset The asset being valued.
  • quote asset The asset used to express the value.

Value

The value is the amount of the base asset expressed as an amount of the quote asset.

Importantly, this is not a fractional multiplier. Under ERC-7726, value is always expressed as an actual asset amount.

Input Output
1000e6 USDC → ETH 283,969,794,427,307,000 ETH
1000e18 ETH → USDC 3,521,501,299,000 USDC

These examples express how much of another asset corresponds to a given asset amount, rather than a price. The numbers are reproduced from the Japanese article; the integer amounts should be interpreted in the assets' smallest units, not as whole ETH or USDC.

This design helps avoid problems involving:

  • Decimal-point handling
  • Differences in decimal precision
  • Misinterpretation of price multipliers

Method definition

The required method in ERC-7726 is getQuote. It converts an amount of the base asset into an amount of the quote asset and returns that amount.

Purpose of getQuote

getQuote directly answers the question: how much is this amount of the base asset worth in the quote asset?

Behavioral requirements

The function is subject to explicit constraints.

  • The result must be rounded toward 0 (rather than rounded to the nearest integer).
  • If the result exceeds the maximum value of uint256, the function must revert.

These rules prevent dangerous behavior such as:

  • Unexpected overflow
  • Implicit rounding

Function signature

The signature of getQuote defined by ERC-7726 is as follows.

js
function getQuote(
    uint256 baseAmount,
    address base,
    address quote
) external view returns (uint256 quoteAmount);

The parameters and return value have the following meanings.

Name Description
baseAmount Amount of the base asset
base Address of the base asset
quote Address of the quote asset
Return value Amount of the quote asset

Special addresses

ERC-7726 assumes that not every asset has a smart contract address.

Typical examples are ETH, BTC, and fiat currencies.

ETH

ETH is represented by the following address in accordance with ERC-7528.

For more on ERC-7528, see the following article.

ERC-7528: A Standard for Representing ETH Like an ERC-20 Token

text
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE

This is the conventional pseudo-address used to represent ETH.

BTC

BTC uses the following fixed address.

text
0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB

As with ETH, this allows the API to consistently identify assets by address.

Fiat currencies and other assets without addresses

For assets that do not have a smart contract address but have an ISO 4217 code, the numeric code is used.

For example, ISO 4217 defines USD as 840, so it is represented as follows.

js
address(840)

This allows the same interface to handle:

  • Cryptocurrencies
  • Native tokens
  • Fiat currencies

The ERC-7726 API consistently adopts the idea of converting asset amounts rather than returning prices.

As a result, implementers have less room for misinterpretation, making oracle integrations safer and easier to understand.

Rationale

ERC-7726 is centered on getQuote because values used on-chain should leave as little room for interpretation as possible.

getQuote converts an amount of base into an amount of quote, so the consumer does not need to handle the base and quote token decimals when performing the conversion. In ERC-20 tokens, decimals indicates how many decimal places are used to interpret the internal integer representation. Confusing these scales can cause errors in magnitude and unexpected losses. getQuote reduces the likelihood of such mistakes.

For more on ERC-20, see the following article.

ERC-20 Explained from First Principles

There are two main reasons why the specification does not include a getPrice function.

First, the actual price (price) is rarely needed on-chain. For many operations, all that is needed is the equivalent value of a given amount in another asset. Second, prices are often fractional by nature, making them difficult to represent on-chain. In an integer-based environment, a scale must be chosen to represent the number of decimal places. Differences in these choices across implementations are a source of errors.

Sometimes, however, an application wants a value resembling a price per unit. ERC-7726 does not prohibit this; it can be obtained using getQuote. The original article gives the following example using ERC-20 decimals.

js
oracle.getQuote(base, quote, 10**base.decimals())

The example asks how much is returned when passing an amount of base equal to 1.0(= 10**decimals) in human-readable units, expressed as quote.

The result represents the value of one unit of base as an amount of quote.

Note that the original code example is reproduced unchanged; its argument order differs from the function signature shown earlier. Use the declared signature when implementing the call.

The key point remains that ERC-7726 returns an asset amount rather than a price multiplier. It is more accurate to think of this operation as converting one unit of the base asset than as returning a price.

Compatibility

ERC-7726 allows many existing data feeds that express the relative value of two assets to be represented through its standard interface.

Existing data feeds include oracles or price references that return a rate for a pair such as A/B. Because ERC-7726 returns an amount conversion rather than a rate, the relative value of a pair can be expressed as follows.

  • An amount x of asset A is equivalent to an amount y of asset B.
  • Rather than leaving the consumer to calculate price multiplied by amount, return the result of the amount conversion directly.

In this sense, many existing data feeds can be adapted to the ERC-7726 getQuote interface.

Security

ERC-7726 deliberately does not provide an on-chain mechanism for consumers to determine whether the data is correct. This is a design choice: if the standard API also attempted to establish data correctness, differences in assumptions and evaluation methods between implementations would make a common definition difficult.

Instead, implementations conforming to ERC-7726, acting as data providers, are expected to define and disclose:

  • The quality of the data they provide
  • The conditions under which they stop providing data, such as anomalous values, an unavailable upstream source, or an inability to update

The consumer should review these guarantees before deciding whether to integrate the implementation.

The important point is that compliance with ERC-7726 alone does not guarantee safety. Security depends on what the API does internally: how it produces data, when it stops, and how it is operated.

The division of responsibilities can be summarized as follows.

Role What ERC-7726 provides Responsibilities of implementations and consumers
Data provider A common interface, getQuote Define and disclose data quality and stopping conditions
Data consumer A consistent format for receiving data Review the guarantees and decide whether to integrate

In other words, ERC-7726 focuses on standardizing the exchange format. Assessing the reliability of the data itself remains the responsibility of each project. This makes the standard simpler and easier to adopt, but it can still be dangerous if consumers neglect their due diligence.

Citation

alcueca (@alcueca), ruvaag (@ruvaag), totomanov (@totomanov), r0ohafza (@r0ohafza), "ERC-7726: Common Quote Oracle [DRAFT]," Ethereum Improvement Proposals, no. 7726, June 2024. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7726.

Conclusion

ERC-7726 proposes an approach to safer, less error-prone oracle integration by returning the relative value of an asset as an amount of another asset rather than as a price.

If you have questions, feel free to send me a direct message on Twitter.

Twitter @cardene777

I also publish technical content on the following platforms.