<!-- canonical: https://0xsimao.com/findings/singularity-uniswap-fees-skip-collecting -->

# Uniswap collect fees should skip collecting fees of one of the tokens if the amount is 0

Medium · Three Sigma · Private DeFi access · 26th February, 2024

Finding 3S-SG-L08 of the Singularity security review.

- Protocol: https://www.thesingularity.network/
- Report: /reports/singularity
- Source: https://cdn.sanity.io/files/qoqld077/production/45b8aac56a2b8e3b557df4329ac9bf8220b64012.pdf

---

### Description

Uniswap positions may collect fees in only of the tokens, leading to 0 fees in the other. This
will cause the fee manager to revert in [calculateFee()](https://github.com/portalgateme/darkpool-v1-zk-contracts-fork/blob/master/contracts/core/FeeManager.sol#L105-L108).

### Recomendation

Skip transferring the funds if the amount is 0.

### Status

Addressed in [#8b300f0](https://github.com/portalgateme/darkpool-v1-zk-contracts-fork/commit/8b300f07a28f2c073154c8de3e9e90ba64ef1934).

---

Related findings:

- [Fees or vested position withdrawal in ShadowStrategyGauge::addVestingPosition() when collecting fees will be revested](https://0xsimao.com/findings/yieldoor-i-fees-withdrawal-vesting-revested): Yieldoor Gauges
- [KeyringCoreV2Base::collectFees() should use Address::sendValue() instead of address.transfer()](https://0xsimao.com/findings/keyring-ii-keyring-fees-send-transfer): Keyring Credentials
- [Interest generated by last bond will not go to anyone when liquidating as there is no bond amount to collect it](https://0xsimao.com/findings/autonomint-interest-generated-bond-liquidating): Autonomint
- [Swap amount can be 0 as it divides the balance by 2, DoSing ShadowStrategyGauge::collectGaugeRewards()](https://0xsimao.com/findings/yieldoor-i-divides-sing-shadow-rewards): Yieldoor Gauges
