The function only helps pay for amount0delta(token0) swaps. It does not help a user pay or rather find the change in token1 balance resulting from the swap.
Vulnerability Detail
The function reverts if the amount entered is smaller or equals to 0 for amount0Delta and amount1Delta L247. The probelm is when in order to make payments(swap) for amount1Delta(token1) the amount for amount0Delta must be smaller than 0 in the below code snippet
newt
medium
Users cannot swap token1 for token0
Summary
The function only helps pay for amount0delta(token0) swaps. It does not help a user pay or rather find the change in token1 balance resulting from the swap.
Vulnerability Detail
The function reverts if the amount entered is smaller or equals to 0 for amount0Delta and amount1Delta L247. The probelm is when in order to make payments(swap) for amount1Delta(token1) the amount for amount0Delta must be smaller than 0 in the below code snippet
Impact
A user can only swap for token0 and not token1
Code Snippet
https://github.com/sherlock-audit/2023-10-real-wagmi/blob/main/wagmi-leverage/contracts/abstract/ApproveSwapAndPay.sol#L242C1-L258C6
Tool used
Manual Review
Recommendation
Include && in the if statement for amount1delta