Skip to main content

How Does a Time-Weighted Average Price (TWAP) Help Defend against Price Feed Attacks?

A Time-Weighted Average Price (TWAP) is a method that calculates the average price of an asset over a specific period, rather than taking the price at a single moment. This mechanism effectively smooths out any sudden, short-lived price spikes or drops caused by manipulation attempts, such as those executed via flash loans.

Since a flash loan attack is instantaneous, the momentary manipulated price has minimal impact on the overall calculated average, thus protecting the smart contract.

What Are the Potential Consequences of Setting a TWAP Time Period That Is Too Short or Too Long?
How Do Flash Loans Enable the Creation of Synthetic Financial Derivatives?
What Is the Role of Time-Weighted Average Price (TWAP) in DeFi Oracles?
What Is the Role of ‘Time-Weighted Average Price’ (TWAP) Oracles in Mitigating MEV in Derivatives?