Christmas Dinner

First Flight #31
Beginner FriendlyFoundrySolidity
100 EXP
View results
Submission Details
Severity: medium
Invalid

The _refundERC20 function does not follow the Checks-Effects-Interactions (CEI) pattern.

Summary

The primary goal of the _refundERC20 function is to refund ERC20 tokens to a specified address.

Vulnerability Details

Function not follow the CEI pattern.

Impact

Incorrect balance for ERC20 tokens. It is noted that this function is used in the refund function, but the refund function has an incorrect implementation for reentrancy. Alternatively, it could be used in a different function without this modifier and it is field for futher attacks.

Tools Used

manual review

Recommendations

Please consider change _refundERC20function.

function _refundERC20(address _to) internal {
uint256 wethBalance = balances[_to][address(i_WETH)];
uint256 wbtcBalance = balances[_to][address(i_WBTC)];
uint256 usdcBalance = balances[_to][address(i_USDC)];
balances[_to][address(i_WETH)] = 0;
balances[_to][address(i_WBTC)] = 0;
balances[_to][address(i_USDC)] = 0;
i_WETH.safeTransfer(_to, wethBalance);
i_WBTC.safeTransfer(_to, wbtcBalance);
i_USDC.safeTransfer(_to, usdcBalance);
}
Updates

Lead Judging Commences

0xtimefliez Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
0xtimefliez Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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