What Are the Computational Costs of Implementing a TWAP versus a VWAP Oracle on a Blockchain?
The computational costs of implementing a TWAP oracle on a blockchain are generally lower than those of a VWAP oracle. A TWAP oracle only needs to store and update a cumulative price value and a timestamp at regular intervals.
A VWAP oracle, on the other hand, needs to store and update both a cumulative price-volume value and a cumulative volume value. This requires more storage and more complex calculations, resulting in higher gas costs.
The difference in cost can be significant, especially on blockchains with high transaction fees.