The refund() function attempts to process token and ETH transfers without first verifying if the user has any balance to refund, leading to unnecessary gas consumption and potential failed transactions.
The current implementation blindly attempts to transfer tokens and ETH regardless of whether the user has any balance:
The internal functions _refundERC20() and _refundETH() will attempt transfers even when balances are zero:
While this isn't a direct security vulnerability, it has several negative implications:
Unnecessary gas consumption for users attempting to refund with zero balances
Potential for failed transactions due to zero-value transfers
Misleading event emissions suggesting successful refunds when no actual value was transferred
Poor user experience and increased transaction costs
Manual review
Add balance checks before processing refunds:
Additional recommendations:
Add a custom error NoBalanceToRefund()
Consider emitting more detailed events that specify which tokens were refunded and their amounts
Consider implementing individual token refund functions to give users more control
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.