20,000 USDC
View results
Submission Details
Severity: low

Arithmetic underflow error

Summary

The "withdraw()" function can lead to an arithmetic underflow error when used before any deposits.

Vulnerability Details

The "withdraw()" function is utilized to withdraw deposited tokens from the staking contract. However, it can potentially cause an arithmetic underflow error if called before depositing any amount or when there are no tokens available for withdrawal.

function withdraw(uint _amount) external {
updateFor(msg.sender);
balances[msg.sender] -= _amount;
TKN.transfer(msg.sender, _amount);
}

Impact

When the function "withdraw()" is invoked without any prior deposits, may result in an arithmetic underflow error.

Tools Used

Manual Review

Recommendations

Use unchecked

unchecked {balances[msg.sender] -= _amount;}

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.