Morpho Integration

What is Morpho?

Morpho is a lending protocol optimizer. It offers MetaMorpho vaults — curated lending pools that algorithmically allocate capital across lending markets.

Morpho's vault curators manage the allocation strategy across lending markets. Returns are variable and depend on market conditions — they are not guaranteed. Vault performance may differ from displayed or historical rates.

How NMT Integrates

Layer Component
Contract MorphoModule.sol — deposit, withdraw (ERC-4626 standard)
Backend workers/src/defi/services/morpho/ — indexes vaults and APYs
Frontend lib/defi/morpho/ — vault interaction encoding
Data source The Graph (subgraph) + headless Chrome scraping

ERC-4626 Vault Standard

Morpho vaults follow the ERC-4626 standard, which defines a common interface for yield-bearing vaults:

Function Purpose
deposit(assets, receiver) Deposit tokens and receive vault shares
withdraw(assets, receiver, owner) Burn shares and receive tokens back
totalAssets() Total value locked in the vault
convertToShares(assets) Preview how many shares you'd get
convertToAssets(shares) Preview how many tokens shares are worth

Data Collection

The backend collects Morpho data from two sources:

  1. The Graph (GraphQL subgraph) — vault metadata, TVL, historical data
  2. Headless Chrome — the backend uses a browser to scrape dynamic data from Morpho's web interface that isn't available via API

The headless Chrome dependency is notable because:

  • It requires 2Gi of RAM allocated in Kubernetes
  • It's fragile — if Morpho changes their website, the scraper breaks
  • It's a known technical consideration for the infrastructure

Min TVL filter: $300,000 (only large MetaMorpho vaults are indexed)

Required secret: MORPHO_API_TOKEN for The Graph Gateway access

results matching ""

    No results matching ""