> For the complete documentation index, see [llms.txt](https://docs.titan.tg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.titan.tg/colossus-concentrated-liquidity-amm/smart-contracts/position.md).

# Position

A position NFT represents a single range of liquidity provided in a pool.\
It follows the [TON NFT standard](https://github.com/ton-blockchain/TEPs/blob/master/text/0062-nft-standard.md).

***

## Interface

### `get_position_data`

Returns position data.

**Arguments**

*None*

**Returns**

| Data Type | Description                                  |
| --------- | -------------------------------------------- |
| `slice`   | User address                                 |
| `slice`   | Pool address                                 |
| `int`     | Position index                               |
| `int`     | Lower tick of the position's liquidity range |
| `int`     | Upper tick of the position's liquidity range |
| `int`     | Liquidity amount of the position             |
| `int`     | Pool's transaction count at last interaction |
| `int`     | Fee growth for token0 inside range X128      |
| `int`     | Fee growth for token1 inside range X128      |
| `int`     | Whether position is staked in a farm         |

***

### `get_nft_data`

Returns position NFT metadata.

**Arguments**

*None*

**Returns**

| Data Type | Description    |
| --------- | -------------- |
| `int`     | Is initialized |
| `int`     | Position index |
| `slice`   | Pool address   |
| `slice`   | User address   |
| `cell`    | NFT content    |

***

### `get_position_farm_data`

Returns all staking data for the position.

**Arguments**

*None*

**Returns**

| Data Type | Description       |
| --------- | ----------------- |
| `dict`    | All position data |

**Staking Data Format**

| Key      | Value      |
| -------- | ---------- |
| `Uint32` | Farm index |
| `Cell`   | Tick data  |

**Tick Data Contents**

| Data Type | Description                              |
| --------- | ---------------------------------------- |
| `Uint256` | Seconds per liquidity growth inside X128 |

***

## Messages

### Mint Position

```plaintext
Opcode: 0x80b587dc
```

| Data Type         | Description             |
| ----------------- | ----------------------- |
| `Uint32`          | Opcode                  |
| `Uint64`          | Query ID                |
| `Address`         | Owner address           |
| `^Cell`           | NFT content             |
| `^Cell`           | Position data           |
| → `Int32`         | Low tick                |
| → `Int32`         | High tick               |
| → `^Cell`         | Position fee data       |
| →→ `Uint256`      | Fee0 growth inside last |
| →→ `Uint256`      | Fee1 growth inside last |
| → `Uint128`       | Liquidity               |
| → `Uint256`       | Tx count                |
| → `^Cell`         | Farm data               |
| →→ `Uint1`        | Should stake            |
| →→ `Maybe Uint32` | Farm index              |

***

### Burn Liquidity

```plaintext
Opcode: 0x55521d04
```

| Data Type   | Description        |
| ----------- | ------------------ |
| `Uint32`    | Opcode             |
| `Uint64`    | Query ID           |
| `Int32`     | Low tick           |
| `Int32`     | Upper tick         |
| `Uint128`   | Liquidity          |
| `Uint256`   | Tx count           |
| `^Cell`     | Fee data           |
| → `Uint256` | Fee0 growth inside |
| → `Uint256` | Fee1 growth inside |
| `Address`   | User address       |

***

### Stake Liquidity

```plaintext
Opcode: 0x1514f51d
```

| Data Type   | Description                       |
| ----------- | --------------------------------- |
| `Uint32`    | Opcode                            |
| `Uint64`    | Query ID                          |
| `Int32`     | Low tick                          |
| `Int32`     | High tick                         |
| `Uint128`   | Liquidity                         |
| `Uint256`   | Tx count                          |
| `Uint256`   | Seconds per liquidity growth X128 |
| `Uint32`    | Farm index                        |
| `^Cell`     | Farm data                         |
| → `Uint64`  | Farm rewards start timestamp      |
| → `Uint64`  | Farm rewards end timestamp        |
| → `Address` | User address                      |

***

### Unstake Liquidity

```plaintext
Opcode: 0x260476e7
```

| Data Type | Description    |
| --------- | -------------- |
| `Uint32`  | Opcode         |
| `Uint64`  | Query ID       |
| `Uint32`  | Farm index     |
| `Uint1`   | Should restake |

***

### Transfer NFT

```plaintext
Opcode: 0x5fcc3d14
```

| Data Type           | Description       |
| ------------------- | ----------------- |
| `Uint32`            | Opcode            |
| `Uint64`            | Query ID          |
| `Address`           | New owner address |
| `Address`           | Response address  |
| `Maybe ^Cell`       | Custom payload    |
| `Coins`             | Forward amount    |
| `Either Cell ^Cell` | Forward payload   |
