code-423n4 / 2024-01-salty-findings

4 stars 3 forks source link

Checks for Zero Balance #1016

Closed c4-bot-2 closed 5 months ago

c4-bot-2 commented 5 months ago

Lines of code

https://github.com/code-423n4/2024-01-salty/blob/main/src/Salt.sol#L25

Vulnerability details

Impact

Detailed description of the impact of this finding. Checks for Zero Balance: The burnTokensInContract function does not check if the balance is zero before attempting to burn, which would result in unnecessary gas usaAccessge if there are no tokens to burn.

Proof of Concept

Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.

function burnTokensInContract() external { uint256 balance = balanceOf( address(this) ); @> _burn( address(this), balance );

    emit SALTBurned(balance);
    }

Tools Used

Recommended Mitigation Steps

Add a require statement to check balance is greater than 0.

Assessed type

Context

c4-judge commented 5 months ago

Picodes marked the issue as unsatisfactory: Invalid