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

# Q128.128 fee growth

> Wide fee-growth storage and position settlement in the current contract.

Global, outside, and position checkpoint fee growth use `u256::U256` in Q128.128 form.

```text theme={"languages":{"custom":["/languages/leo.tmLanguage.json"]}}
U256 { hi: u128, lo: u128 }
packed = hi * 2^128 + lo
```

## Growth per unit of liquidity

```text theme={"languages":{"custom":["/languages/leo.tmLanguage.json"]}}
growth_delta = floor(lp_fee * 2^128 / active_liquidity)
```

The input-token global accumulator increases by this value.

## Growth inside a range

The contract derives growth below and above the position from global growth, each boundary's outside growth, and the current tick. It subtracts both from global growth to get inside growth.

Crossing an initialized tick flips its outside accumulator relative to current global growth. This makes the same boundary work in either crossing direction.

## Owed amount

```text theme={"languages":{"custom":["/languages/leo.tmLanguage.json"]}}
owed = floor((inside_now - inside_last) * liquidity / 2^128)
```

The subtraction wraps modulo `2^256`. The wide product is shifted by 128 bits. The result must fit `u128`.

The contract stores `u256::U256` directly. It does not declare a separate `FeeGrowth` struct. Client code can use a semantic wrapper type, but its wire parser must match `{ hi, lo }`.
