20,000 USDC
View results
Submission Details
Severity: low
Valid

Staking.sol should use more input validation to improve user experience

Summary

There are a lot of functions that could use more input validation in order to improve the user experience. Though funds aren't directly at risk, these functions will revert upon overflow but in reality, they are reverting for another reason.

Vulnerability Details

Functions like withdraw and deposit can be improved by adding more input validation.

function withdraw(uint _amount) external {
//@audit - fee on transfer tokens are not supported
//@audit - rebasing tokens
updateFor(msg.sender);
balances[msg.sender] -= _amount;
TKN.transfer(msg.sender, _amount);
}

This function will revert with overflow if _amount is greater than balances[msg.sender] however adding a check for this would be better for the user as it would add a useful revert message.

Impact

User experience.

Tools Used

Manual review.

Recommendations

if(balances[msg.sender] < _amount) revert NotEnoughDeposited();

It would be useful to analyze the gas trade offs for adding this.

Support

FAQs

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