<!-- canonical: https://0xsimao.com/findings/clip-finance-ii-rebalancing-original-upper-deposit -->

# Rebalancing back to original lower and upper ticks will not deposit nft to farm

Low/Info · Three Sigma · DeFi infrastructure · 15th March 2024

Finding 3S-Clip-L03 of the Clip Finance Strategy Upgrade security review.

- Protocol: https://www.clip.finance/
- Report: /reports/clip-finance-strategy-upgrade
- Source: https://github.com/0xsimao/audits/blob/main/Three%20Sigma/2024-03-15-clip-finance-ii.pdf

---

### Description

Rebalance changes the lower and upper ticks in PHyperLPoolSwapInside and withdraw
from the farming contract if it is allocated. If the rebalance is performed to a previously used
lower and upper ticks, the nftId will not be 0 and it will [add](https://github.com/ClipFinance/StrategyRouter-private/pull/107/files#diff-023946f07f510e865612a28a9a222e00f0f6b90a253fd981e9bf4f7656f5497fR364) liquidity instead of minting. As
can be seen, the add liquidity branch does not deposit to the farming contract if it is not
allocated yet.

### Recommendation

The impact is reduced as it can be deposited later by calling
[PHyperLPoolSwapInside::depositNftToFarm()](https://github.com/ClipFinance/StrategyRouter-private/pull/107/files#diff-023946f07f510e865612a28a9a222e00f0f6b90a253fd981e9bf4f7656f5497fR122). Consider try allocating after the _mint() call
if it is not allocated yet (and setting the allocatedToFarming bool to true)

### Status

Addressed in [#0c8de23](https://github.com/ClipFinance/StrategyRouter-private/commit/0c8de23862d9fed65f3c1a3fc4eac9a0356ef76e#diff-023946f07f510e865612a28a9a222e00f0f6b90a253fd981e9bf4f7656f5497fR388-R392).

Disclosed by 0xSimao (https://0xsimao.com/).

---

Related findings:

- [Strategy main ticks are not symmetric when the tick spacing is one due to incorrect isLowerSided inequality](https://0xsimao.com/findings/yieldoor-symmetric-spacing-sided-inequality): Yieldoor
