I know TWAP formula = priceDifference / timeElapsed;

but still not able to get how uniswapv2 is doing that.


enter image description here

1 Answer 1


Here's the math contracts: https://github.com/Uniswap/v2-core/blob/master/contracts/libraries/UQ112x112.sol

And I know this is for v3, but this article explains the twaps in Uniswap a bit more (note it has more to do with ticks than actual time): https://chaoslabs.xyz/posts/chaos-labs-uniswap-v3-twap-deep-dive-pt-1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.