code-423n4 / 2021-09-wildcredit-findings

0 stars 0 forks source link

UniswapV3Helper: Misleading param names for getSqrtPriceX96() #62

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

hickuphh3

Vulnerability details

Impact

The params uint _amount0, uint _amount1 are misleading because calculating the sqrt price from the amounts is the inverse, where you will do the price is derived from _amount1 / _amount0, as illustrated by Uniswap's encodePriceSqrt() test helper function.

Recommended Mitigation Steps

uint _amount0 and uint _amount1 should be renamed to uint _price0 and uint _price1.

talegift commented 2 years ago

Suggestions to improve the readability of variable namings should IMO have severity set to 0.

ghoul-sol commented 2 years ago

best practice, non-critical