Open codehawks-bot opened 1 year ago
Escalate
This issue is being identified as a duplicate of Some ERC20 tokens will revert when passing a value of 0. (https://github.com/Cyfrin/2023-08-sparkn/issues/155) .
But it is exactly a duplicate of the issue Potential Distribution Failure Due to Zero Rounded Transfer Amount (https://github.com/Cyfrin/2023-08-sparkn/issues/839) .
Zero token transfer can cause a potential DoS in Distributor.sol
Severity
Medium Risk
Relevant GitHub Links
https://github.com/code-423n4/2023-04-caviar-findings/issues/278
Summary
The
Distributor.sol
contract doesn't check for zero amount while transferring rewards, which can end up blocking the operation.Vulnerability Details
Distributor.sol
contract, the functiondistribute()
is used to distribute token to winners according to the percentages: here_distribute()
is called: hereamount
after calculated will be transferred towinners[i]
but doesn't check for zero amount before transferring.amount
will returns0
iftotalAmount * percentages[i] < BASIS_POINTS
.Impact
The function
Distributor.sol#distribute()
doesn't check for zero amount while transferring rewards, which can end up blocking the operation.Tools Used
Manual review
Recommendations
Check for zero amount before executing the transfer. Eg: