# 4. Smart Contracts

### 4.1 Overview

MOOR • FINANCE is a **fully on-chain DEX aggregator**. Every transaction executes atomically — either all swaps succeed or none do — ensuring **no custody and zero partial fills**.

The architecture consists of:

* **MoorRouter** – core aggregation contract orchestrating multi-DEX routes.
* **Protocol adapters** – specialized connectors for each DEX family (Uniswap V2/V3, Stableswap, PMM, Balancer-like, etc.).
* **MOOR V2 DEX** – native AMM hosting liquidity when it yields superior execution.
* **Zap utility** – one-click LP entry/exit.
* **Earn suite** – auto-compounding vaults and farming contracts managing protocol incentives.

***

### 4.2 Contract Addresses & Explorer Links (Cronos Mainnet)

#### Core Aggregator

**MoorRouter (DEX Aggregator)**

* **Address:** `0x9EC858F9ab92C8B7Bf72935c4Ee07780357978b7`
* **Role:** Aggregates and executes swaps across 33+ Cronos DEX protocols
* **Explorer:** [View on Cronos Explorer](https://explorer.cronos.org/address/0x9EC858F9ab92C8B7Bf72935c4Ee07780357978b7)

***

#### MOOR V2 DEX

**MOORV2 Factory**

* **Address:** `0x97291820913a2a70225f680f8AF92Ba1E1Ca0E50`
* **Role:** Deploys and registers MOOR V2 liquidity pairs
* **Explorer:** [View on Cronos Explorer](https://explorer.cronos.org/address/0x97291820913a2a70225f680f8AF92Ba1E1Ca0E50)

**MOORV2 Router**

* **Address:** `0x80502d3Dc974118CAC221f226100563179D21Af5`
* **Role:** Executes swaps and liquidity operations for MOOR V2
* **Explorer:** [View on Cronos Explorer](https://explorer.cronos.org/address/0x80502d3Dc974118CAC221f226100563179D21Af5)

**MOORV2 Zap**

* **Address:** `0x92857c39a69D6DCD13e650dE1f0fC33a515A79B3`
* **Role:** Enables single-token LP entry/exit
* **Explorer:** [View on Cronos Explorer](https://explorer.cronos.org/address/0x92857c39a69D6DCD13e650dE1f0fC33a515A79B3)\
  **Features:**
* Zap-in → convert a single token into an LP position
* Zap-out → withdraw an LP position back to one token
* Optimized routing for maximum output

***

#### Earn System Contracts

**MOORCraftsmanV2 (Farming Contract)**

* **Address:** `0x8eB6B2F5fda6ec6b459d6C92Ecb0F0ebef246Fa0`
* **Role:** Manages multiple farming pools with independent budgets and epochs
* **Explorer:** [View on Cronos Explorer](https://explorer.cronos.org/address/0x8eB6B2F5fda6ec6b459d6C92Ecb0F0ebef246Fa0)\
  **Features:**
* Pre-funded budget system (no minting)
* Epoch-based reward distribution
* Dynamic pool creation
* Anti-flash-loan protection (10 min stake min.)
* Emergency withdraw + developer fee (max 20%)

**MOORVaultV2 (Auto-Compounding Vault)**

* **Address:** `0x548620cE72691b490fD219679829068aa290bB2e`
* **Role:** Auto-compounds MOOR staking rewards from Pool #0
* **Explorer:** [View on Cronos Explorer](https://explorer.cronos.org/address/0x548620cE72691b490fD219679829068aa290bB2e)\
  **Features:**
* Permissionless harvest with bounty reward
* Share-based accounting
* Inflation attack prevention via minimum liquidity burn
* Early withdrawal fee window (72h)
* Public compounding with treasury fee (2%) + caller bounty (0.25%)

***

#### Token References

**MOOR Token**

* **Address:** `0xFAB5129E3A137032c0dDB55F07a980C963e387e5`
* **Role:** Native governance and reward token (fixed supply)
* **Explorer:** [View on Cronos Explorer](https://explorer.cronos.org/address/0xFAB5129E3A137032c0dDB55F07a980C963e387e5)

**WCRO (Wrapped CRO)**

* **Address:** `0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23`
* **Role:** Wrapped native token for Cronos
* **Explorer:** [View on Cronos Explorer](https://explorer.cronos.org/address/0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23)

> All contracts are **verified**, **non-upgradeable**, and **live on Cronos Mainnet (Chain ID 25).**

***

### 4.3 MoorRouter Capabilities

* **Best-Path Routing:** Calculates optimal split routes across 33+ DEX protocols.
* **Slippage Guard:** Reverts transactions below user-defined `minAmountOut`.
* **Positive Slippage Capture:** Captures up to 1% surplus for the protocol treasury.
* **Atomic Execution:** All-or-nothing transaction model.
* **Modular Adapters:** Supports Uniswap V2/V3, Curve-like, PMM, Balancer, and LB protocols.

***

### 4.4 Roles & Controls

**Owner (Emergency Use Only):**

* Pause/unpause critical functions.
* Update protocol parameters (fee cap, treasury, adapter allowlist).
* Add/remove adapters post-audit approval.

**Treasury:**

* Receives positive-slippage and fee revenue.

**No Custody Principle:**\
User funds are **never stored** beyond transaction execution.

> Recommendation: ownership to migrate to a **multi-sig (2/3)** post-launch.

***

### 4.5 Security Design

* **Reentrancy guards** on all swap and liquidity functions.
* **Checks-Effects-Interactions** pattern strictly followed.
* **Input validation** for token pairs and slippage values.
* **Fee cap** hard-limited to 1%.
* **No user balance storage** post-transaction.
* **Comprehensive testing:** 100+ unit & integration tests.
* **Audit phase:** scheduled post-launch with an open bug bounty.

***

### 4.6 Upgrade & Compatibility Policy

* **Immutable Core:** Router and Factory are permanent and non-upgradeable.
* **Extensible Adapters:** New protocols can be integrated via modular adapters.
* **Token Support:** Full ERC-20 compatibility, including fee-on-transfer tokens.
* **Backward Compatible:** Earn system built as separate modules, not requiring router redeployment.

***

### 4.7 Supported Protocol Families

| Category              | Examples                                                      |
| --------------------- | ------------------------------------------------------------- |
| **AMM V2**            | VVS Finance, MM Finance, CronaSwap, Obsidian, Ryoshi, MOOR V2 |
| **AMM V3 / CLAMM**    | VVS V3, Algebra V1, iZiSwap, Maverick V1/V2                   |
| **Stableswap**        | Ferro Protocol (planned), Pancake Stable, Saddle              |
| **PMM**               | DODO V2/V3                                                    |
| **Balancer-type**     | Weighted multi-token pools                                    |
| **Order-Book Hybrid** | WooFi                                                         |
| **Liquidity Book**    | LB V2.1                                                       |

***

### 4.8 Interacting with Contracts

#### Via MOOR App (Recommended)

Official interface: [**app.moor.finance**](https://app.moor.finance)

#### Via Cronos Explorer

1. Open the contract address.
2. Select “Write Contract.”
3. Connect your wallet.
4. Execute methods directly (swapExactTokensForTokens, addLiquidity, etc.).

#### Via Web3 Libraries (Example)

```javascript
import { createPublicClient, http } from 'viem'
import { cronos } from 'viem/chains'

const client = createPublicClient({
  chain: cronos,
  transport: http('https://evm.cronos.org'),
})

const MOOR_ROUTER = '0x9EC858F9ab92C8B7Bf72935c4Ee07780357978b7'
// Example: quote or swap function call
```

***

### 4.9 Network Information

* **Blockchain:** Cronos Mainnet
* **Chain ID:** 25
* **Native Token:** CRO
* **Primary RPC:** `https://evm.cronos.org`
* **Fallback:** Uses wallet-configured RPC
* **Block Time:** \~0.5 seconds
* **Explorer:** <https://explorer.cronos.org>


---

# 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/4.-smart-contracts.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.
