HardhatDeFi
15,000 USDC
View results
Submission Details
Severity: low
Invalid

Improve User Input Validation for Position Token Redemption to avoid revert

Summary

The current implementation of user Token input of the AaveDivaWrapperCore contract in some of the functions sets _positionTokenAmountToRemove, _positionTokenAmountToRedeem and _wTokenAmountToRedeem to the user's balance only when the user inputs the maximum value of type(uint256).max. This approach limits the protocol's ability to gracefully handle cases where users mistakenly input a value greater than their actual balance.

Recommendations

Instead of restricting the balance check to only the type(uint256).max value, the contract should set _positionTokenAmountToRedeem to the user's balance when the input value exceeds the user's available balance. This change would enhance the user experience by preventing unnecessary reverts and improving interaction with the protocol. see example code below.

- if (_wTokenAmount == type(uint256).max) {
+ if (_wTokenAmount > _userBalance) {
_wTokenAmountToRedeem = _userBalance;
}

this above code should be applied to all affected seneros accordingly.
\

Implementing this improvement will make the protocol more user-friendly and provide a more resilient interaction experience for users.

Updates

Lead Judging Commences

bube Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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