<!-- canonical: https://0xsimao.com/findings/fuji-finance-transferring-amount-transfer-skipped -->

# When transferring tokens, if the amount is 0, the transfer should be skipped

Low/Info · Three Sigma · Lending aggregator · 6th May, 2023

Finding 3S-FUJI-N09 of the Fuji Finance security review.

- Report: /reports/fuji-finance
- Source: https://cdn.sanity.io/files/qoqld077/staging/32181a28eac3175d15fb8924d249bb0d91ca350c.pdf

---

### Description

Before each transfer call, if the amount is 0, it should be skipped. This is also true for
SafeERC20.safeTransfer(...) and SafeERC20.safeTransferFrom(...).

### Recommendation

An example would be

```solidity
function _safeTransferETH(address receiver, uint256 amount) internal {
    if (amount == 0) return;
    (bool success,) = receiver.call{value: amount}(new bytes(0));
    if (!success) revert BaseRouter__safeTransferETH_transferFailed();
}
```

### Status

Addressed here: [Fujicracy/fuji-v2#652](https://github.com/Fujicracy/fuji-v2/pull/652)

---

Related findings:

- [Halted withdrawals in BatchOut:withdrawFulfill() due to tokens transfer() reverting on 0 transfer amount](https://0xsimao.com/findings/clip-finance-i-halted-withdrawals-withdraw-transfer): Clip Finance Strategies
- [Use of `address.transfer` instead of the recommended `address.call{value: amount}("")`](https://0xsimao.com/findings/blast-ido-pools-transfer-recommended-call-value): Blast IDO Pools
- [Fee on transfer tokens transfer less tokens than what is stored in the receipt on deposits](https://0xsimao.com/findings/clip-finance-i-fee-transfer-receipt-deposits): Clip Finance Strategies
- [Erc20Utils::safeTransferFrom() assumes the tokens are transferred to this, which may not be the case](https://0xsimao.com/findings/districtone-erc20-utils-transfer-transferred): DistrictOne
