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

Fee on transfer token errors

Summary

As arbitrary ERC20 tokens can be passed, the amount here should be calculated every time to take into consideration a possible fee-on-transfer or deflation.

Vulnerability Details

For instance in borrow() function, the following will lead to accounting errors

// transfer fees
IERC20(loan.loanToken).transfer(feeReceiver, fees);
// transfer the loan tokens from the pool to the borrower
IERC20(loan.loanToken).transfer(msg.sender, debt - fees);
// transfer the collateral tokens from the borrower to the contract
IERC20(loan.collateralToken).transferFrom(
msg.sender,
address(this),
collateral
);

Impact

If a pool is using fee on transfer tokens for loans or collateral, then when using the borrow() function , less tokens will be sent to protocol causing accounting errors.

Tools Used

Manual review

Recommendations

Check the balance before and after the transfer to take into account the Fees-On-Transfer.

Support

FAQs

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