20,000 USDC
View results
Submission Details
Severity: medium
Valid

Repay may revert in 0 amount transfer

Summary

Repay may revert in situation 0 amount transfer when transferring specifically loan token to the fee receiver.

Vulnerability Details

In repay(uint256[] calldata loanIds)

function repay(uint256[] calldata loanIds) public {
for (uint256 i = 0; i < loanIds.length; i++) {
// transfer the protocol fee to the fee receiver
IERC20(loan.loanToken).transferFrom(
msg.sender,
feeReceiver,
protocolInterest
);
}
}

There is no check whether protocolInterest is 0, some erc20 will revert on 0 value transfer.
In this situation, repay will revert.

Impact

Repay may not work properly on 0 protocolInterest transfer.

Tools Used

Manual Review

Recommendations

Add zero value check before transfer

Support

FAQs

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

Give us feedback!