Quotes
Price fractions are never directly returned by the interface. Instead, the oracle acts as though it is quoting swap amounts. This avoids certain catastrophic losses of precisions, especially with low-decimal tokens (see an example with SHIB/USDC).
The quoting interface offers several benefits to consumers:
- More intuitive queries: Oracles are commonly used in DeFi to determine the value of assets. getQuote does exactly that.
- More expressive interface: The unit price is a special case of a quote where inAmount is one whole unit of base.
- Safe and flexible integrations: Under IPriceOracle adapters are internally responsible for converting decimals. This allows consumers to decouple themselves from a particular provider as they can remain agnostic to its implementation details.
Bid/Ask Pricing
Euler Price Oracles additionally expose getQuotes which returns two prices: the selling price (bid) and the buying price (ask).
Bid/ask prices are inherently safer to use in lending markets as they can accurately reflect instantaneous price spreads. While few oracles support bid/ask prices currently, we anticipate their wider adoption in DeFi as on-chain liquidity matures.
Importantly getQuotes allows for custom pricing strategies to be built under the IPriceOracle interface:
Querying two oracles and returning the lower and higher prices. Reporting two prices from a single source e.g. a TWAP and a median. Applying a synthetic spread or a volatility-dependent confidence interval around a mid-price.