sherlock-audit / 2024-02-leverage-contracts-judging

1 stars 0 forks source link

kgothatso - UniswapV3 doesn't provide slippage protection and will result in partial swaps #29

Closed sherlock-admin closed 6 months ago

sherlock-admin commented 6 months ago

kgothatso

high

UniswapV3 doesn't provide slippage protection and will result in partial swaps

Summary

for UniV3 doesn't cause the swap to revert upon reaching that value. Instead it just cause the swap to partially fill. This is a known issue with using sqrtRatioLimit as can be seen here where the swap ends prematurely when it has been reached. This is problematic as this is meant to provide the user with slippage protection but doesn't.

Vulnerability Detail

Impact

Incorrect slippage application can result in partial swaps and loss of funds

Code Snippet

https://github.com/sherlock-audit/2024-02-leverage-contracts/blob/main/wagmi-leverage/contracts/abstract/ApproveSwapAndPay.sol#L185

Tool used

Manual Review

Recommendation

Check the amount received from the swap and compare it against some user supplied minimum

Duplicate of #8