v2-periphery icon indicating copy to clipboard operation
v2-periphery copied to clipboard

Why overflows are desired in the `UniswapV2OracleLibrary` contract?

Open RoseRompkxm opened this issue 2 years ago • 1 comments

I've noticed there are comments for the following code saying addition overflow is desired & subtraction overflow is desired, what's the purpose behind? Can anyone enlighten me this? Thanks a lot!

https://github.com/Uniswap/v2-periphery/blob/master/contracts/libraries/UniswapV2OracleLibrary.sol#L28

RoseRompkxm avatar Sep 13 '22 06:09 RoseRompkxm

This answer from stackoverflow gives a good explanation. I guess overflow do not change the final result, but I have't play this math game.

jukanntenn avatar Mar 02 '23 13:03 jukanntenn