# 🔐 CabalV4LiquidityLocker

The **CabalV4LiquidityLocker** brings secure time-locking and fee collection mechanics to **Uniswap V4** positions, adapting to V4's new architecture.

It supports V4-specific `Currency` types, integrates with the V4 hook mechanism, and manages all V4 LP NFTs locked through the platform.

***

### ⚙️ Responsibilities

* Locks Uniswap V4 **position NFTs** on launch
* Tracks custom `Currency` types for both tokens in the pool
* Enforces **strict unlock times** (default: 1 year)
* Enables **secure fee extraction** using the V4 `modifyLiquidities()` pattern
* Distributes earnings to users and the protocol

***

### 💸 Fee Collection

* Uses the V4 `DECREASE_LIQUIDITY` + `TAKE_PAIR` actions to collect
* All collected fees are split:
  * 50% to the **position owner**
  * 50% to the **protocol** (configurable)
* Supports ETH and ERC-20 based `Currency` values
* Users can call `collectFees(tokenId)` or `collectAllUserFees()`

***

### 🔐 Security & Admin

* Only **authorized V4 helper contracts** can initialize positions
* Locker verifies NFT ownership before accepting or unlocking
* Owner can recover stuck ETH or ERC-20 tokens using `emergencyRecover*()` functions

***

### 🧠 Design Philosophy

* LP tokens remain **non-withdrawable until `unlockTime` passes**
* Supports **complex V4 flows** while keeping usage simple
* Emits detailed logs: `FeesCollected`, `PositionLocked`, `PositionUnlocked`

***

Both lockers are essential to The Cabal's decentralized token launch flow — bringing **security**, **transparency**, and **trust** to every deployment on Base.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.thecabal.app/cabal-protocol-contract-overview/cabalv4liquiditylocker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
