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

If protocol fee is 0, refinance might revert

Summary

There are certain ERC20 tokens which revert on zero value transfers. If fee price is 0, borrower will be able to do refinance as the transaction will always revert.

Vulnerability Details

In refinance(Refinance[] calldata refinances), fee can becomes 0 if debt - debtToPay is too small:

uint256 fee = (borrowerFee * (debt - debtToPay)) / 10000;
IERC20(loan.loanToken).transfer(feeReceiver, fee);

Assuming Alice tries to refinance a loan, the loanToken has small decimals so let's say debt is 1000 and debtToPay is 900, then fee would be 0 due to precision loss. However theloanToken is going reverts on 0 value transfers. The refinance transaction reverts and Alice is unable to refinance.

Impact

Borrower can't refinance the loan.

Tools Used

Manual Review

Recommendations

To address this issue, it is recommended to not to transfer to the fee receiver is fee is 0.

Support

FAQs

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

Give us feedback!