# Position Module

#### Structs

**`LBPosition`**

```move
struct LBPosition has key, store {
    id: UID,
    pair_id: ID,
    coin_type_a: TypeName,
    coin_type_b: TypeName,
    lock_until: u64,
}
```

* **Purpose**: NFT representing liquidity position

**`LBPositionManager`**

```move
struct LBPositionManager has store {
    positions: Table<ID, LBPositionInfo>,
}
```

* **Purpose**: Manages all position data

**`LBPositionInfo`**

```move
struct LBPositionInfo has store {
    position_id: ID,
    bins: Table<u32, LBBinPosition>,
    fee_reward_info: FeeRewardInfo,
}
```

* **Purpose**: Detailed position data

**`LBBinPosition`**

```move
struct LBBinPosition has copy, drop, store {
    amount: u128,
    fee_growth_inside_last_x: u128,
    fee_growth_inside_last_y: u128,
}
```

* **Purpose**: Position data for specific price bin

**`FeeRewardInfo`**

```move
struct FeeRewardInfo has store {
    total_fees_generated: u128,        
    reward_per_fee_snapshot: vector<u128>,
}
```

* **Purpose**: Fee generation and reward tracking

#### Core Functions

**Position Lifecycle**

* **`open_position`**: Create new position NFT
* **`close_position`**: Destroy empty position
* **`lock_position`**: Apply time lock
* **`is_position_locked`**: Check lock status

**Liquidity Operations**

* **`increase_liquidity`**: Add liquidity to position
* **`decrease_liquidity`**: Remove liquidity (respects locks)

**Fee Management**

* **`collect_fees`**: Harvest accumulated fees
* **`get_pending_fees`**: View unclaimed fees
* **`update_fee_info`**: Update fee tracking (internal)

**Position Queries**

* **`position_token_amount`**: Liquidity in specific bin
* **`get_tokens_in_position`**: All position liquidity
* **`has_tokens_in_bins`**: Check if position has liquidity


---

# 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.ferra.ag/integration/dlmm/smart-contract/position-module.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.
