Precise Yellow Sealion
medium
Funds can be permanently lost because of no 0 address checks in RewardRouter.sol::sweepTokens
function.
https://github.com/sherlock-audit/2024-04-alchemix/blob/main/v2-foundry/src/utils/RewardRouter.sol#L61-L63
In the sweepTokens
function there are no zero address checks. Because of this funds can be permanently lost and cannot be recovered. Moreover, it sweeps all of the tokens that the contract contains which is detrimental to the protocol.
Complete funds that the contract contains can be lost.
function sweepTokens(address token, address recipient) external onlyOwner {
TokenUtils.safeTransfer(token, recipient, TokenUtils.safeBalanceOf(token, address(this)));
}
Manual Review
Add zero address check in the function
function sweepTokens(address token, address recipient) external onlyOwner {
if(token == address(0)){
revert IllegalArgument();
}
TokenUtils.safeTransfer(token, recipient, TokenUtils.safeBalanceOf(token, address(this)));
}