20,000 USDC
View results
Submission Details
Severity: medium

Certain ERC20 token does not return bool from transfer and transferFrom and transaction revert

Summary

Certain ERC20 token does not return bool from transfer and transferFrom and transaction revert

Vulnerability Details

According to: https://github.com/d-xo/weird-erc20#missing-return-values

Some tokens do not return a bool on ERC20 methods and use IERC20 token interface will revert transaction

IERC20(p.loanToken).transferFrom(
p.lender,
address(this),
p.poolBalance - currentBalance
);
IERC20(p.loanToken).transfer(
p.lender,
currentBalance - p.poolBalance
);
}
IERC20(loan.collateralToken).transferFrom(
msg.sender,
address(this),
collateral
);

There are other functions besides these, but they never get executed, since initially the loanTokens tokens will be reverted when creating the pool with setPool
The same happens with the collateralToken but in the borrow function

Impact

Some tokens do not return a bool on ERC20 methods and use IERC20 token interface will revert transaction

Tools Used

Manual Review

Recommendations

Use Openzeppelin safeTransfer / safeTransferFrom

Support

FAQs

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