Dapp Use Cases
TWAP Deviation
Make sure that the TWAP price doesn’t deviate more than X% from the TWAP price.
Use Case
Make sure that the TWAP price reported by an oracle doesn’t deviate more than X% from the pre-state TWAP price. A lot of DeFi protocols use TWAP to price their assets. This assertions makes sure that the TWAP price stays within a reasonable range defined by the protocol.
Explanation
In this example we check that the TWAP price doesn’t deviate more than 5% from the pre-state TWAP price.