deadrxsezzz
medium
Contract states that it supports fee-on-transfer tokens, however, using such as collateral will always revert
When depositing tokens as collateral, they are first sent to the CollateralManager.sol
contract and then to the collateralEscrow
contract. The contract wrongfully assumes that the amount sent is the same as the amount received
if (collateralInfo._collateralType == CollateralType.ERC20) {
IERC20Upgradeable(collateralInfo._collateralAddress).transferFrom(
borrower,
address(this),
collateralInfo._amount
);
IERC20Upgradeable(collateralInfo._collateralAddress).approve(
escrowAddress,
collateralInfo._amount
);
collateralEscrow.depositAsset(
CollateralType.ERC20,
collateralInfo._collateralAddress,
collateralInfo._amount,
0
);
In the case of a fee-on-transfer ERC-20, the amount received will be less than the amount sent. Attempting to send the same amount from the CollateralManager to the CollateralEscrow will therefore always revert.
Fee-on-transfer tokens cannot be used as collateral, although the docs state they are supported.
Manual Review
Check the balance before and after the tokens are received. Based on the amount received, send an according amount to the CollateralEscrow contract