Skip to main content

How Do Decentralized Exchanges (DEXs) Provide Price Data to Oracles?

DEXs, particularly those using Automated Market Makers (AMMs), determine asset prices based on the ratio of tokens in their liquidity pools. Oracles can query these DEX smart contracts directly to retrieve the current pool ratio, which serves as the asset's spot price.

However, this on-chain price is vulnerable to immediate manipulation if the pool is shallow. Some oracles aggregate data from multiple DEXs to create a more robust, time-weighted average price (TWAP).

What Is the Role of Time-Weighted Average Price (TWAP) in DeFi Oracles?
How Can an Oracle Be Manipulated in a Price Feed Attack?
What Is a Volume-Weighted Average Price (VWAP) and How Does It Differ from TWAP?
What Are the Historical Examples of Successful TWAP Oracle Manipulation Attacks?