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

# InfiRouter

This smart contract serves as the primary entry point and central coordinator for the entire protocol. Its responsibilities include:

* **State Management**: Maintaining the canonical, up-to-date registry of crucial addresses:\
  \
  – ADAPTERS: An array (address\[]) containing the deployed contract addresses of all vetted and active DEX Adapter contracts integrated with the protocol. The index of an adapter within this array serves as its unique identifier for routing and execution instructions\
  \
  – TRUSTED\_TOKENS: An array (address\[]) storing the addresses of liquid and recognized tokens. These tokens act as potential intermediate pivot points for constructing multi-hop swap routes, enabling efficient trades between less liquid token pairs.\
  \
  – WNATIVE: The immutable address of the Wrapped Native Asset contract for the chain. Used for seamless wrapping/unwrapping of the chain’s native currency when interacting with DEXs that primarily operate with the wrapped version. \
  \
  – FEE\_CLAIMER & MIN\_FEE: Parameters governing the optional protocol fee mechanism<br>
* **Interface Exposure**: Providing the public and external functions defined in the IInfiRouter interface, which include:\
  \
  – Pathfinding Functions: findBestPath(...) and findBestPathWithGas(...) allow users and applications to query the router to discover the optimal swap route based on different optimization criteria (gross output vs. net output).\
  \
  – Swap Execution Functions: swapNoSplit(...) and swapNoSplitWithPermit(...) are used to execute the actual swap along a pre-determined path.<br>
* **Internal Logic**: Containing the implementation of the pathfinding algorithms, the swap execution orchestration, fee calculations, and interactions with WNATIVE<br>
* **Administration (Maintainable):** Incorporating access control mechanisms (e.g., an onlyMaintainer modifier) that allow authorized addresses to perform essential administrative tasks like adding/removing adapters, updating the trusted tokens list, and adjusting fee parameters.


---

# 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://infi-1.gitbook.io/infi-litepaper/architechture/readme-1.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.
