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

# Architecture Overview

BrownFi V3 consists of five core smart contracts and a set of supporting facilities:

* Factory: Creates new V3 pair pools (permissioned to pool creator role).
* Router: Handles user-facing swap computations — both forward (amountIN given) and backward (amountOUT given) — and routes amounts to/from pair contracts.
* Oracle Gateway: Aggregates price from multiple sources (Pyth, Chainlink, Redstone, on-chain AMM TWAP), computes skew price and pre-trade spread price, and feeds them to pair contracts.
* Pair Contract (V3 Pool): Holds token reserves, executes add/remove LP, performs inventory verification per swap, mints protocol fee LP tokens. Each pool has distinct base and quote tokens.
* Config Contract: Stores all configurable parameters (Kappa, fee, spread, skewness, gamma) outside the pool contract, enabling dynamic adjustment without redeployment.

<figure><img src="/files/ueAzkUqoNhXP03Oquazd" alt=""><figcaption></figcaption></figure>


---

# 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:

```
GET https://brownfi.gitbook.io/brownfi-docs/brownfi-v3/architecture-overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
