# The unused tokens from the user’s initialization of UniswapV4‘s pool will be locked in the UniswapImplementation contract.

UniswapImplementation.initializeCollection computes liquidity from both amounts but only pushes the used delta, leaving leftover currency0/currency1 permanently locked in the contract.

- Payout: Audit contest
- Severity: medium
- Program: Flayer
- Found by: 0x37
- Disclosed: 2024-08-06
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-08-flayer-judging/issues/208
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-08-flayer%3AM-6
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:accounting-error

**Target:** UniswapImplementation.sol pool initialization / UniswapV4 unlockCallback
**Root cause:** getLiquidityForAmounts returns min(liquidity0,liquidity1), so one currency is only partially consumed; _unlockCallback pushes only the negative delta amounts and never refunds the unused remainder to the Locker.
**Steps:**
1. Call Locker -> UniswapImplementation.initializeCollection(_collection, _amount0, _amount1, _amount1Slippage, _sqrtPriceX96) with amounts where liquidity0 != liquidity1.
2. initializeCollection calls poolManager.unlock(...) with liquidityDelta = getLiquidityForAmounts(...) = min(liquidity0, liquidity1).
3. In _unlockCallback, modifyLiquidity returns delta; _pushTokens transfers only -delta.amount0 and -delta.amount1 to poolManager.
4. The currency whose amount exceeded the min-derived liquidity remains in UniswapImplementation with no refund path.
5. Observe the leftover balance is permanently stuck (only collectionToken slippage check exists, no nativeToken refund).
**How found:** Read UniswapV4's LiquidityAmounts.getLiquidityForAmounts and noticed it returns min(liquidity0,liquidity1), meaning one side is under-consumed; then traced _unlockCallback and saw only delta-based _pushTokens with no refund of the unused remainder.
**Exploitation:** Any user initializing a pool with imbalanced amount0/amount1 relative to the chosen sqrtPriceX96 loses the excess token; the excess is stranded in UniswapImplementation with no withdrawal function, so it is unrecoverable by the user.
**Insight:** When integrating Uniswap V4 modifyLiquidity, the delta only reflects consumed amounts; any amount passed in beyond what the min-liquidity calc uses must be explicitly refunded, otherwise it strands in the callback contract.

