The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: low
Invalid

`LiquidationPool` Assumes Every Address Can Accept Ether, Leading to Loss of Stakers' Rewards

Description:

When users call LiquidationPool::claimRewards() to claim their rewards from the pool, the contract attempts to send them their ERC20 and native token rewards at once. However, not all addresses can receive native tokens like ETH, for example, contracts without a receive() or fallback() function. As a result, this function fails every time such a user calls it.

Impact:

Users' rewards are permanently locked in the contract, as no one can withdraw them on their behalf.

Tools Used:

  • Manual review

Recommended Mitigation Steps:

Whenever a transfer of native tokens like ETH fails, wrap it and send it as ERC20 to the same address.

+ function _handleOutgoingNativeTransfer(address _to, uint256 _amount) private {
+ // Validate the contract has enough ETH to transfer
+ if (address(this).balance < _amount) revert INSUFFICIENT_BALANCE();
+
+ bool success;
+ (bool _sent,) = payable(msg.sender).call{value: _rewardAmount}("");
+
+ if (!_sent){
+ IWETH(WETH).deposit{value: _amount}();
+ bool success = IWETH(WETH).transfer(_to, _amount);
+
+ // Ensure successful tranfer
+ if (!success){
+ revert FAILING_WETH_TRANSFER();
+ }
+ }
+ }
function claimRewards() external {
ITokenManager.Token[] memory _tokens = ITokenManager(tokenManager).getAcceptedTokens();
for (uint256 i = 0; i < _tokens.length; i++) {
ITokenManager.Token memory _token = _tokens[i];
uint256 _rewardAmount = rewards[abi.encodePacked(msg.sender, _token.symbol)];
if (_rewardAmount > 0) {
delete rewards[abi.encodePacked(msg.sender, _token.symbol)];
if (_token.addr == address(0)) {
- (bool _sent,) = payable(msg.sender).call{value: _rewardAmount}("");
- require(_sent);
+ _handleOutgoingNativeTransfer(payable(msg.sender), _rewardAmount)
} else {
IERC20(_token.addr).transfer(msg.sender, _rewardAmount);
}
}
}
}
Updates

Lead Judging Commences

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

informational/invalid

Support

FAQs

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