sherlock-audit / 2024-05-pooltogether-judging

9 stars 5 forks source link

newt - Avoiding Contradictions in Conditional Logic #66

Closed sherlock-admin3 closed 3 months ago

sherlock-admin3 commented 3 months ago

newt

medium

Avoiding Contradictions in Conditional Logic

Summary

An if statement that is true won't stop the execution of subsequent else if statements, which can lead to contradictory outcomes if not carefully managed.

Vulnerability Detail

For the function transferTokensOut if (_tokenOut == address(_asset)) is the same address as else if (_tokenOut == address(this)) they will both execute.

Impact

Both statements will be true. The second statement will overwrite the second statement.

Code Snippet

https://github.com/sherlock-audit/2024-05-pooltogether/blob/main/pt-v5-vault/src/PrizeVault.sol#L744-L753

Tool used

Manual Review

Recommendation

Use if statements prior to the else condition

nevillehuang commented 3 months ago

Invalid, logic is correct, this issue is describing a completely wrong scenario