> For the complete documentation index, see [llms.txt](https://hoodstrategy.gitbook.io/hoodstrategy/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hoodstrategy.gitbook.io/hoodstrategy/readme/architecture.md).

# Architecture

HoodStrategy runs on **two smart contracts** that work together, leveraging Uniswap v4 and Chainlink.

## The two contracts

### The $HOODSTR token

A standard ERC-20 with **fixed supply** and no mint function after deployment. It holds the reward accounting (balances, reward debt, claimable amounts) and coordinates with the hook. On every balance change, buy, sell, transfer, it settles the pending rewards of the parties involved.

### The HoodStrategy hook (Uniswap v4)

A **v4 hook** is a contract attached to a Uniswap pool that runs code at precise points of the pool's lifecycle (before/after a swap). The HoodStrategy hook implements:

* **`beforeSwap`** — applies the 5/5 tax (and the anti-MEV spike) on $HOODSTR swaps.
* **`afterSwap`** — triggers the *harvest* (buy HOODX + update rewards) when the threshold and cooldown are met.

The hook is what makes the whole thing **atomic**: tax, HOOD purchase, and distribution happen in a single transaction — the one triggered by the trade itself.

{% hint style="info" %}
**Why Uniswap v4 and not v2/v3?** v4's hooks let us run tax + purchase + distribution inside a single pool-native transaction, at minimal gas cost thanks to *flash accounting* (all pools live in one contract, the `PoolManager`).
{% endhint %}

## External dependencies

| Dependency                         | Role                                     |
| ---------------------------------- | ---------------------------------------- |
| Uniswap v4 (`PoolManager`, hooks)  | AMM, tax, atomic swaps                   |
| HOODX (Backed / xStocks)           | Asset accumulated and distributed        |
| Chainlink price feed               | Slippage bound / HOOD reference price    |
| Chainlink Automation *(optional)*  | Backup trigger for harvesting            |
| Bridge (canonical / partner route) | Bringing HOODX in (outside the hot loop) |


---

# 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://hoodstrategy.gitbook.io/hoodstrategy/readme/architecture.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.
