Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: high

If `COMMISSION_FEE` is set to 0, revert-on-zero-transfer tokens such as USDT will be stuck

Vulnerability Details

In Distributor, each distribution charges a commission fee:

uint256 private constant COMMISSION_FEE = 500; // this can be changed in the future

Note that the comments suggests that COMMISSION_FEE may be changed in the future (in the code, as this is a constant). The function for transferring out the commission is as follow

function _commissionTransfer(IERC20 token) internal {
token.safeTransfer(STADIUM_ADDRESS, token.balanceOf(address(this)));
}

There are tokens (such as USDT) that will revert on zero-value transfers. As such, if the protocol decides to remove the commission fee for any reason, the transfer will always revert, and it will not be possible to recover the tokens.

Impact

Revert-on-zero-transfer tokens can get stuck if commission fee is zero.

Tools Used

Manual review

Recommendations

Transfer out if and only if commission is non-zero. Change to as follow:

function _commissionTransfer(IERC20 token) internal {
if (token.balanceOf(address(this)) > 0) {token.safeTransfer(STADIUM_ADDRESS, token.balanceOf(address(this)));}
}

Support

FAQs

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