# Twa

### Functions <a href="#functions" id="functions"></a>

#### updateValue <a href="#updatevalue" id="updatevalue"></a>

Update the TWA (Time-Weighted Average) value in the State memory.

```solidity
function updateValue(IMaverickV2Pool.State memory self, int256 value, uint256 lookback) internal view;
```

**Parameters**

| Name       | Type                    | Description                                         |
| ---------- | ----------------------- | --------------------------------------------------- |
| `self`     | `IMaverickV2Pool.State` | The State memory to update.                         |
| `value`    | `int256`                | The new value to set.                               |
| `lookback` | `uint256`               | The lookback period to use for calculating the TWA. |

#### floor <a href="#floor" id="floor"></a>

Get the floored TWA value from the State memory.

```solidity
function floor(IMaverickV2Pool.State memory self) internal pure returns (int32);
```

**Parameters**

| Name   | Type                    | Description                    |
| ------ | ----------------------- | ------------------------------ |
| `self` | `IMaverickV2Pool.State` | The State memory to read from. |

**Returns**

| Name     | Type    | Description                        |
| -------- | ------- | ---------------------------------- |
| `<none>` | `int32` | The floored TWA value as an int32. |

#### getTwa <a href="#gettwa" id="gettwa"></a>

Get the TWA value from the State memory, considering a lookback period.

```solidity
function getTwa(IMaverickV2Pool.State memory self, uint256 lookback) internal view returns (int256);
```

**Parameters**

| Name       | Type                    | Description                                         |
| ---------- | ----------------------- | --------------------------------------------------- |
| `self`     | `IMaverickV2Pool.State` | The State memory to read from.                      |
| `lookback` | `uint256`               | The lookback period to use for calculating the TWA. |

**Returns**

| Name     | Type     | Description                 |
| -------- | -------- | --------------------------- |
| `<none>` | `int256` | The TWA value as an int256. |

#### getTwaFloor <a href="#gettwafloor" id="gettwafloor"></a>

Get the floored TWA value from the State memory, based on the lookback period.

```solidity
function getTwaFloor(IMaverickV2Pool.State memory self, uint256 lookback) internal view returns (int32);
```

**Parameters**

| Name       | Type                    | Description                                         |
| ---------- | ----------------------- | --------------------------------------------------- |
| `self`     | `IMaverickV2Pool.State` | The State memory to read from.                      |
| `lookback` | `uint256`               | The lookback period to use for calculating the TWA. |

**Returns**

| Name     | Type    | Description                        |
| -------- | ------- | ---------------------------------- |
| `<none>` | `int32` | The floored TWA value as an int32. |
