Flow

Sablier
FoundryDeFi
20,000 USDC
View results
Submission Details
Severity: low
Invalid

Clean up ERC20 tokens that were mistakenly transferred to the contract

Summary

Clean up ERC20 tokens that were mistakenly transferred to the contract

Vulnerability Details

It is a good idea to add a sweep function to clean up ERC20 tokens that were mistakenly transferred to the contract. This can help ensure that the asset management of the contract is more efficient and avoid token lockup due to erroneous transfers or withdrawal surplus.

I browsed a lot of contracts on the blockchain and there were a lot of extra erc20 tokens in them, but there was no way to transfer them, and I lost a lot of money, so I thought it would make sense to add this function

Impact

Clean up excess tokens in the contract

Tools Used

Manual review

Recommendations

function sweep(IERC20 otherToken) external onlyOwner {
uint256 amount = otherToken.balanceOf(address(this));
require(amount > 0, "No tokens to sweep");
otherToken.safeTransfer(msg.sender, amount);
emit Sweep(msg.sender, address(otherToken), amount);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge
8 months ago
inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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