How Do Decentralized Exchanges (DEXs) Serve as On-Chain Price Oracles?
Many DEXs, particularly those using Automated Market Makers (AMMs), inherently track the price of assets based on the ratio of tokens in their liquidity pools. Smart contracts can read this on-chain data directly, using the pool ratio as a real-time price feed.
While convenient, this method is vulnerable to manipulation if the pool has low liquidity or if the price is easily skewed by large trades or flash loans.