> ## Documentation Index
> Fetch the complete documentation index at: https://tech.ramses.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Position

Positions represent an owner address' liquidity between a lower and upper tick boundary

Positions store additional state for tracking fees owed to the position

## Functions

### get

```solidity theme={null}
  function get(
    mapping(bytes32 => PositionInfo) storage self,
    address owner,
    uint256 index,
    int24 tickLower,
    int24 tickUpper
  ) internal view returns (PositionInfo storage position)
```

Returns the Info struct of a position, given an owner and position boundaries

#### Parameters:

| Name        | Type                                     | Description                               |
| :---------- | :--------------------------------------- | :---------------------------------------- |
| `self`      | mapping(bytes32 => PositionInfo) storage | The mapping containing all user positions |
| `owner`     | address                                  | The address of the position owner         |
| `index`     | uint256                                  | The index of the position                 |
| `tickLower` | int24                                    | The lower tick boundary of the position   |
| `tickUpper` | int24                                    | The upper tick boundary of the position   |

#### Return Values:

| Name       | Type                 | Description                                            |
| :--------- | :------------------- | :----------------------------------------------------- |
| `position` | PositionInfo storage | The position info struct of the given owners' position |

### update

```solidity theme={null}
  function update(
    PositionInfo storage self,
    int128 liquidityDelta,
    uint256 feeGrowthInside0X128,
    uint256 feeGrowthInside1X128,
    bytes32 _positionHash,
    uint256 period,
    uint160 secondsPerLiquidityPeriodX128
  ) internal
```

Credits accumulated fees to a user's position and updates period-based reward accounting

#### Parameters:

| Name                            | Type                 | Description                                                                                     |
| :------------------------------ | :------------------- | :---------------------------------------------------------------------------------------------- |
| `self`                          | PositionInfo storage | The individual position to update                                                               |
| `liquidityDelta`                | int128               | The change in pool liquidity as a result of the position update                                 |
| `feeGrowthInside0X128`          | uint256              | The all-time fee growth in token0, per unit of liquidity, inside the position's tick boundaries |
| `feeGrowthInside1X128`          | uint256              | The all-time fee growth in token1, per unit of liquidity, inside the position's tick boundaries |
| `_positionHash`                 | bytes32              | The hash of the position key (owner, index, tickLower, tickUpper)                               |
| `period`                        | uint256              | The current period (weekly epoch)                                                               |
| `secondsPerLiquidityPeriodX128` | uint160              | The seconds per liquidity for the current period inside the position's tick boundaries          |

### positionHash

```solidity theme={null}
  function positionHash(
    address owner,
    uint256 index,
    int24 tickLower,
    int24 tickUpper
  ) internal pure returns (bytes32)
```

Returns the hash used to store positions in a mapping: `keccak256(abi.encodePacked(owner, index, tickLower, tickUpper))`

#### Parameters:

| Name        | Type    | Description                             |
| :---------- | :------ | :-------------------------------------- |
| `owner`     | address | The address of the position owner       |
| `index`     | uint256 | The index of the position               |
| `tickLower` | int24   | The lower tick boundary of the position |
| `tickUpper` | int24   | The upper tick boundary of the position |
