The function calls safeTransferFrom
without verifying whether _collateralAmount
is greater than zero. This could lead to unnecessary external calls, inefficiencies, or potential unexpected behavior depending on the ERC-20 token implementation.
The _handleTokenOperations
function contains the following code snippet:
However, _collateralAmount
is not checked before execution. Some ERC-20 implementations may revert on zero-value transfers, while others may process them without effect, leading to unnecessary gas consumption.
Gas inefficiency: Calling safeTransferFrom
with a zero amount results in an unnecessary external call, increasing transaction costs.
Potential unexpected behavior: Certain ERC-20 tokens might handle zero-value transfers differently, potentially causing failures or unintended effects.
Manual code review
To mitigate this issue, introduce a check before calling safeTransferFrom
:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.