How Can a DeFi Protocol Detect and Prevent a Flash Loan-Induced Price Manipulation Attempt?
Protocols can implement checks that reject transactions where the price change between the current block and the previous block exceeds a certain threshold. They can also use "pre-flight checks" within the transaction to ensure the loan is repaid and the price is not drastically different at the end.
Utilizing TWAP oracles is the most robust preventative measure against single-block price spikes.
Glossar
TWAP Oracles
Oracles ⎊ TWAP Oracles provide a mechanism for delivering a time-weighted average price to smart contracts, serving as a crucial input for valuing options and determining settlement prices in a manner that smooths out short-term volatility.
Price Deviation Threshold
Threshold ⎊ Price Deviation Threshold is a predefined limit on the amount that an asset price can move before triggering a specific action or alarm.