> For the complete documentation index, see [llms.txt](https://docs.kyte.sh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kyte.sh/protocol/uniswap-v4.md).

# Uniswap v4 and KyteHook

The KyteHook TWAP oracle, swap fee and buyback route on Uniswap v4.

{% hint style="success" %}
**In short.** Kyte uses Uniswap v4 for three things: the **buyback swap**, the **KyteHook** on the `$KYTE`/WETH pool (a 10-minute TWAP oracle and a 0.1% protocol fee), and the **price feed** behind the charts.
{% endhint %}

Kyte does not run its own exchange. Three parts of the protocol sit on Uniswap v4 on Robinhood Chain:

1. **Buyback and burn.** `UniswapV4Adapter` swaps the buyback WETH for `$KYTE` on the v4 PoolManager, and the BuybackBurner burns the output in the same transaction.
2. **KyteHook on the `$KYTE`/WETH pool** (pool key: fee 3000, tickSpacing 60, hooks = KyteHook):
   * **TWAP oracle.** After `afterInitialize` and every `afterSwap`, it writes a tick observation into a 128-slot ring buffer. `consult(poolId, secondsAgo)` returns the mean tick and `twapSqrtPriceX96` the TWAP price. The adapter uses a **10-minute** window.
   * **Protocol fee.** Through `afterSwapReturnDelta`, it takes `feeBps` (currently **10 = 0.1%**, max 100 = 1%) of the WETH side of each swap and sends it to the FeeVault, where it joins the 30/20/50 split.
   * Owner = the timelock (`setFee`, `setFeeVault`).
   * A v4 hook's permissions are encoded in its address, so KyteHook is deployed at a **mined CREATE2 address** (`contracts/script/HookDeployer.sol`) with the `afterInitialize`, `afterSwap` and `afterSwapReturnDelta` bits set.
3. **Price feed.** The indexer decodes v4 `Swap` events for the configured pools into prices and candles for the website's charts.

Without the hook on the pool there is no TWAP, and `buyAndBurn` refuses to run.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.kyte.sh/protocol/uniswap-v4.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
