Skip to main content

How Does a Time-Weighted Average Price (TWAP) Oracle Mitigate Flash Loan Attacks on a Derivatives Contract?

A flash loan attack can temporarily manipulate the spot price on a DEX. A TWAP oracle mitigates this by calculating the average price over a period of time, rather than using the instantaneous spot price.

This averaging smooths out short-term, artificial price spikes caused by manipulation, making it much harder for an attacker to use a flash loan to trigger an unfair liquidation or settlement.

How Is a ‘Time-Weighted Average Price’ (TWAP) Used in Settlement?
What Is a Volume-Weighted Average Price (VWAP) and Why Is It Used?
How Are “Time-Weighted Average Prices” (TWAPs) Used to Improve Oracle Security?
How Does a TWAP Oracle Differ from a Volume-Weighted Average Price (VWAP) Oracle?