> For the complete documentation index, see [llms.txt](https://docs.mav.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mav.xyz/technical-reference/maverick-v2/v2-contracts/maverick-v2-amm-contracts/poollib/delta.md).

# Delta

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

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

Combines two Delta instances by adding their delta values if skipCombine is false.

```solidity
function combine(Instance memory self, Instance memory delta) internal pure;
```

**Parameters**

| Name    | Type       | Description                                          |
| ------- | ---------- | ---------------------------------------------------- |
| `self`  | `Instance` | The first Delta instance.                            |
| `delta` | `Instance` | The second Delta instance to combine with the first. |

#### pastMaxTick <a href="#pastmaxtick" id="pastmaxtick"></a>

Checks if the activeTick is past the tickLimit for swapping to the maximum price.

```solidity
function pastMaxTick(Instance memory self, int32 activeTick) internal pure returns (bool);
```

**Parameters**

| Name         | Type       | Description              |
| ------------ | ---------- | ------------------------ |
| `self`       | `Instance` | The Delta instance.      |
| `activeTick` | `int32`    | The current active tick. |

**Returns**

| Name     | Type   | Description                                                    |
| -------- | ------ | -------------------------------------------------------------- |
| `<none>` | `bool` | true if the activeTick is past the tickLimit, false otherwise. |

### Structs <a href="#structs" id="structs"></a>

#### Instance <a href="#instance" id="instance"></a>

```solidity
struct Instance {
    uint256 deltaInBinInternal;
    uint256 deltaInErc;
    uint256 deltaOutErc;
    uint256 excess;
    bool tokenAIn;
    bool exactOutput;
    bool swappedToMaxPrice;
    bool skipCombine;
    int32 tickLimit;
    uint256 sqrtLowerTickPrice;
    uint256 sqrtUpperTickPrice;
    uint256 sqrtPrice;
    int64 fractionalPart;
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.mav.xyz/technical-reference/maverick-v2/v2-contracts/maverick-v2-amm-contracts/poollib/delta.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
