Why Spot Prices from AMM Pools are Unsafe
Querying `token0.balanceOf(pair) / token1.balanceOf(pair)` on Uniswap to determine asset prices is vulnerable to flash loan manipulation. An attacker can borrow 100M USD, dump tokens into the pool to artificially depress the price, liquidate collateralized loans at distorted valuations, and repay the flash loan in a single atomic transaction.
Decentralized Oracles & TWAP Protections
Secure protocols rely on Chainlink decentralized oracle networks with heartbeat/deviation thresholds, or compute geometric Time-Weighted Average Prices (TWAP) over multi-block observation windows that make manipulation cost-prohibitive.