# 6. Smart Contract Architecture

#### 6.1 MoorRouter

Central routing hub that executes trades across integrated DEX protocols.\
Handles:

* Dynamic route computation
* Fee collection (positive slippage model)
* Treasury transfers
* Slippage validation
* Emergency owner controls (pause/resume)

#### 6.2 Adapters

Each DEX type is wrapped via protocol adapters (e.g. `UniswapV2Adapter.sol`, `BalancerV2Adapter.sol`, `CurveAdapter.sol`) for modular integration and future extensibility.

#### 6.3 Security

* ReentrancyGuard across all swap functions
* SafeMath on all arithmetic
* Gas limiters + fail-safes
* No custody of user funds (atomic swap only)


---

# Agent Instructions: 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://moor-finance.gitbook.io/moor-finance-docs/6.-smart-contract-architecture.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.
