The Standard

The Standard
DeFiHardhat
20,000 USDC
View results
Submission Details
Severity: medium
Invalid

Lack of support for fee-on-transfer token

Summary

In the codebase, the use of transfer, safeTransfer and safeTransferFrom assumes that the receiver receives the exact transferred amount.

Vulnerability Details

This is an issue because PAXG, one of the protocol's base token charges a fee upon transfer.
For instance -
In the forwardRemainingRewards function, If the balance is small enough, the protocol might not receive any tokens, or the fee charged might be more than the balance causing a reversion.

} else {
uint256 balance = IERC20(_token.addr).balanceOf(address(this));
if (balance > 0) IERC20(_token.addr).transfer(protocol, balance); //@note
}

In the removeCollateral function, the extra fee deducted on transfer(some tokens deduct directly from sender balance, not from transfer amt) during collateral removal can cause the position to actually become undercollaterized, even though, the canRemoveCollateral doesn't show this, putting the user's position at risk of liquidation.

function removeCollateral(bytes32 _symbol, uint256 _amount, address _to) external onlyOwner {
ITokenManager.Token memory token = getTokenManager().getToken(_symbol);
require(canRemoveCollateral(token, _amount), UNDER_COLL); //amt to send is checked
IERC20(token.addr).safeTransfer(_to, _amount);//@note
emit CollateralRemoved(_symbol, _amount, _to);
}

It also affects swaps, rewards claimed and so on.

Impact

The recipient address may not receive the full transfered amount, which can break the protocol's accounting and revert transactions.

Tools Used

Manual code review

Recommendations

Consider introducing a balance calculations before and after transfer to get the actual transfer amount.

Updates

Lead Judging Commences

hrishibhat Lead Judge almost 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

fee-on-transfer

hrishibhat Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Out of scope
Assigned finding tags:

fee-on-transfer

Support

FAQs

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