# Pool Manager

The pool manager serves as a proxy between pools and vaults.\
Users do not interact directly with it.

***

## Interface

### `get_pool_manager_data`

Returns pool manager data.

**Arguments**

*None*

**Returns**

| Data Type | Description              |
| --------- | ------------------------ |
| `int`     | Is initialized           |
| `int`     | Lowest pool shard index  |
| `int`     | Highest pool shard index |
| `int`     | Tick size                |
| `int`     | Token0 vault address     |
| `int`     | Token1 vault address     |
| `slice`   | Protocol fee address     |
| `int`     | LP fee                   |
| `int`     | Protocol fee             |
| `int`     | Referral fee             |

***

### `get_account_address`

Returns LP account address for user.

**Arguments**

| Data Type | Description |
| --------- | ----------- |
| `slice`   | User wallet |

**Returns**

| Data Type | Description             |
| --------- | ----------------------- |
| `slice`   | User LP account address |

***

### `get_pool_address`

Returns pool address for given index.

**Arguments**

| Data Type | Description           |
| --------- | --------------------- |
| `int`     | Min tick (pool index) |

**Returns**

| Data Type | Description  |
| --------- | ------------ |
| `slice`   | Pool address |

***

## Messages

### Add Liquidity

```plaintext
Opcode: 0xb9251ce7
```

**Body Format**

| Data Type      | Description  |
| -------------- | ------------ |
| `Uint32`       | Opcode       |
| `Uint64`       | Query ID     |
| `Int32`        | Low tick     |
| `Int32`        | High tick    |
| `Coins`        | Amount0      |
| `Coins`        | Amount1      |
| `Address`      | User address |
| `Uint128`      | Liquidity    |
| `^Cell`        | Farm cell    |
| `Uint1`        | Should stake |
| `Maybe Uint32` | Farm index   |
| `Int32`        | Pool index   |

***

### Refund User

```plaintext
Opcode: 0xdc37aa85
```

**Body Format**

| Data Type | Description |
| --------- | ----------- |
| `Uint32`  | Opcode      |
| `Uint64`  | Query ID    |
| `Coins`   | Amount0     |
| `Coins`   | Amount1     |
| `Address` | Address     |

***

### Stage LP

```plaintext
Opcode: 0x4535f1ab
```

**Body Format**

| Data Type      | Description     |
| -------------- | --------------- |
| `Uint32`       | Opcode          |
| `Uint64`       | Query ID        |
| `Address`      | User address    |
| `Coins`        | Amount0         |
| `Coins`        | Amount1         |
| `Coins`        | Provide amount0 |
| `Coins`        | Provide amount1 |
| `Int32`        | Low tick        |
| `Int32`        | High tick       |
| `Int32`        | Pool index      |
| `^Cell`        | Liquidity data  |
| `Uint128`      | Liquidity       |
| `^Cell`        | Farm data       |
| `Uint1`        | Should stake    |
| `Maybe Uint32` | Farm index      |

***

### Stake LP

```plaintext
Opcode: 0xe55cf6af
```

**Body Format**

| Data Type | Description    |
| --------- | -------------- |
| `Uint32`  | Opcode         |
| `Uint64`  | Query ID       |
| `Int32`   | Pool index     |
| `Int32`   | Low tick       |
| `Int32`   | High tick      |
| `Uint128` | Liquidity      |
| `Uint256` | Tx count       |
| `^Cell`   | Farm data cell |
| `Address` | User address   |
| `Uint64`  | Position index |
| `Uint32`  | Farm index     |

***

### Stake Liquidity

```plaintext
Opcode: 0x71a6fd4b
```

**Body Format**

| Data Type | Description     |
| --------- | --------------- |
| `Uint32`  | Opcode          |
| `Uint64`  | Query ID        |
| `Int32`   | Pool index      |
| `Int32`   | Low tick        |
| `Int32`   | High tick       |
| `Uint128` | Liquidity       |
| `Uint256` | Tx count        |
| `Uint32`  | Farm index      |
| `Cell`    | Farm data cell  |
| `Uint64`  | Start timestamp |
| `Uint64`  | End timestamp   |
| `Address` | User address    |
| `Uint64`  | Position index  |

***

### Unstake LP

```plaintext
Opcode: 0x71af2880
```

**Body Format**

| Data Type | Description         |
| --------- | ------------------- |
| `Uint32`  | Opcode              |
| `Uint64`  | Query ID            |
| `Int32`   | Pool index          |
| `Uint256` | Seconds inside X128 |
| `Uint64`  | Seconds             |
| `Address` | User address        |
| `Uint32`  | Farm index          |
| `Uint1`   | Should restake      |

***

### Stake Notification Manager

```plaintext
Opcode: 0x26b4cbbf
```

**Body Format**

| Data Type | Description      |
| --------- | ---------------- |
| `Uint32`  | Opcode           |
| `Uint64`  | Query ID         |
| `Int32`   | Pool index       |
| `Uint32`  | Farm index       |
| `Address` | Response address |


---

# 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.titan.tg/colossus-concentrated-liquidity-amm/smart-contracts/pool-manager.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.
