> ## Documentation Index
> Fetch the complete documentation index at: https://knot-38d8bd0e.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Execution flow

> One swap, start to finish.

```mermaid theme={null}
sequenceDiagram
    participant T as Trader
    participant PM as PoolManager
    participant H as KnotHook
    participant F as KnotFederation

    T->>PM: swap()
    PM->>H: beforeSwap
    H->>F: executeSwap(zeroForOne, exactInput, amount)
    F->>F: quote local reserves
    F->>F: quote aggregate reserves
    F->>F: take the worse one
    F->>F: update member + aggregate books atomically
    F-->>H: enforced amount
    H-->>PM: BeforeSwapDelta
    PM-->>T: settle
```

## Where the value goes

The clipped difference is never transferred anywhere. It simply is not paid out, so it remains in
the local pool's reserves and accrues to that pool's LP shares.

## Custody

One equation, asserted by five stateful invariants across 40,960 default calls and a 163,840-call
high-depth campaign:

```text theme={null}
PoolManager claims = active reserves + inactive provider assets
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.