> ## Documentation Index
> Fetch the complete documentation index at: https://docs.darkmatter.rdytobash.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Earn Zap

> Earn Zap — Dark Matter Protocol on Robinhood Chain.

# Earn Zap Router (Morpho)

`EarnZapRouter` is the one-signature entry point into **Morpho Earn (VaultV2)** on
Robinhood Chain. Users hold nothing but ETH and sign ONE transaction — the router
handles wrap → swap → deposit (and the reverse on exit).

## The zap flows

```
Deposit   ETH ─▶ wrap WETH ─▶ Uniswap V3 swap ─▶ USDG ─▶ vault.deposit
Withdraw  vault.redeem ─▶ USDG ─▶ Uniswap V3 swap ─▶ WETH ─▶ unwrap ─▶ ETH
```

* Vault shares mint **directly to the user** (`onBehalf = user`). The router tracks
  bookkeeping (`balanceOfShares`) but **never takes custody of positions**.
* The WETH/USDG leg uses the 0.01% pool (`POOL_FEE = 100`) — the deepest WETH/USDG
  tier on the chain.
* Both swap legs are slippage-bounded (`amountOutMinimum`): a sandwich beyond
  tolerance reverts the whole zap atomically.

## Fees

| Fee | Value | Recipient |
| - | - | - |
| Deposit | **0%** — deposits are never taxed | — |
| Exit | **1%** (`EXIT_FEE_BPS = 100`), **immutable**, on the ETH side | DarkMatterTreasury |

Cumulative lifetime exit fees are tracked publicly (`totalExitFees`) for
transparency.

## Worked example

User zaps **1 ETH** into a USDG Morpho vault (USDG = 1 USD):

| Step | Amount |
| - | - |
| 1 ETH → WETH → swap (0.01% pool, ≤ slippage bound) | ≈ 3000 USDG (illustrative) |
| vault.deposit(3000 USDG, user) | user receives vault shares |
| Shares minted to | **user's address, directly** |
| Fee | **0** |

Later, redeeming all shares worth 3300 USDG:

| Step | Amount |
| - | - |
| vault.redeem → 3300 USDG → swap → WETH → unwrap | ≈ 1.1 ETH |
| Exit fee (1%) | 0.011 ETH → treasury |
| User receives | ≈ **1.089 ETH** |

## Security model

**1. Vault allowlist — additive-only.** Vaults are whitelisted at deploy or via
`addVault()`; there is no removal. Every addition is emitted. The router can never be
pointed at a hostile "vault" to farm share approvals.

**2. No custody, no approvals over user funds.** Users approve the router **only for
vault shares at exit time** (`VaultV2.redeem` pulls from `onBehalf = user`). The
router's own token approvals cover only in-flight swap amounts produced *inside* the
contract during a zap.

**3. Checks-Effects-Interactions everywhere.** The share bookkeeping is decremented
**before** any ETH leaves — a malicious treasury or receiver cannot reenter into a
stale position.

**4. No stray ETH acceptor.** The only ETH path out is the WETH unwrap; there is no
state-changing fallback. Tokens that land on the router outside a zap (donations,
misdirected transfers) can be rescued via `sweepDust(token, amount)` → treasury —
zap flows never leave tokens at rest on the router.

## Beyond the zap

The Earn module surfaces (all read through the same client):

* **Morpho Borrow** — supply collateral → borrow → repay → withdrawCollateral, direct
  Morpho Blue calls, no router, no custody. Full closes use a fork-safe
  repay-by-exact-shares path so closing never leaves debt residue.
* **Morpho Farms** — Merkl rewards claiming for positioned users.
* **Longbow pools** — supply/withdraw shortcuts with entry/exit guidance based on
  utilization; my-position cards pinned with badges.
* **Native stock tokens** — the dividend and lootbox rails swap into the same
  canonical Robinhood Stock Tokens the swap legs use.

Next: [NFT Loan Pool](nft-loans.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.