All case studies

Completed · DeFi · Vault infrastructure · AI-native layer

Factor

Role
Founding Engineer · Top contributor on Discover · 100% sole author on VaaS / Agent
Period
2023 – 2025
Screenshot of Factor

Key numbers

  • 2023 – 2025Active period
  • ~140k LOCOwned codebases
  • 468 + 253Commits on Discover · Studio
  • Arbitrum · Base · EthereumSupported chains

01 · Factor

Problem

Build the infrastructure for an end-to-end DeFi vault-as-a-service experience: ERC-4626 contracts with manager-adapter pattern, a typed SDK, two production UIs (power-user + depositor) and — from 2026 — an AI-native layer exposing vaults and strategies to LLMs, autonomous agents and pay-per-call HTTP APIs.

02 · Factor

Architecture

Factor.fi is a DeFi vault infrastructure on Arbitrum, Base and Ethereum: ERC-4626 Studio Pro vaults, a manager-adapter pattern integrating Aave, Compound, Morpho, Silo, Uniswap V3, OpenOcean and Pendle, plus a typed SDK (`@factordao/sdk`, `@factordao/sdk-studio`). Two production UIs ride on top: Factor Studio (Vite + React 19 + wagmi + RainbowKit, ~78k LOC, ~253 Andrea commits) for power-users to compose and manage vaults, and Factor Discover (Next.js 14 + Sentry, ~56k LOC, ~468 Andrea commits — top individual contributor) for depositors on `pro.factor.fi`. In 2026 I added an AI-native layer: an MCP server (`factor-mcp`, 68 tools) exposing the entire SDK to LLMs with two modes (classic stdio and stateless multi-tenant via AsyncLocalStorage); a Vault-as-a-Service HTTP product (`factor-vaas`, 100% sole author) with x402 / USDC payments on Base, BullMQ workers, an HD-derived wallet pool (treasury at index 0, each worker at its own index — no shared keys) and an Anthropic-driven rebalancing engine; an autonomous DeFi agent (`factor-agent`, 4.8k LOC, working tree only) that consumes the MCP server over cron-scheduled tasks (vault-monitor, position-tracker, strategy-executor, auto-compound, risk-guard, reporter) with Telegram + Discord notifications.

03 · Factor

Decisions

  • 01

    HD wallet pool with per-worker isolation

    In `factor-vaas` the treasury sits at HD index 0; each worker derives its own index. No shared keys, horizontal scaling out-of-the-box, minimal blast radius if a worker is compromised.

  • 02

    Stateless MCP via AsyncLocalStorage

    `factor-mcp` ships two modes: classic stdio and stateless for multi-tenant gateways. `chainId` and environment ride in per-request context via AsyncLocalStorage; `sendTransaction` returns unsigned calldata instead of broadcasting — one process serves many users with zero global-state mutation.

  • 03

    x402 payments for on-chain primitives

    VaaS gates `POST /api/vault` behind x402 (Coinbase, USDC on Base): the client gets a 402 Payment Required, signs the payment and retries. No accounts, no credit cards, a clean HTTP+blockchain primitive. Pricing is a function of components (`3 + adapters*1 + assets*0.10` USDC).

  • 04

    Reusable manager-adapter pattern

    Each protocol (Aave, Morpho, Silo, Compound, Uniswap V3, OpenOcean, Pendle) is an isolated adapter behind a shared interface. Strategies become composable building blocks rather than monolithic contracts — simpler audits, incremental onboarding of new protocols.

04 · Factor

Results

  • 2023 – 2025

    Active period

  • ~140k LOC

    Owned codebases

  • 468 + 253

    Commits on Discover · Studio

  • Arbitrum · Base · Ethereum

    Supported chains

  • MCP · VaaS · Agent

    AI-native layer (2026)

05 · Factor

Tech & Pillars

Tech stack

  • Solidity
  • ERC-4626
  • Foundry
  • Hardhat
  • wagmi
  • viem
  • ethers
  • TypeScript
  • Node.js
  • Express
  • Drizzle ORM
  • Postgres
  • Redis
  • BullMQ
  • React 19
  • Next.js 14
  • Vite
  • RainbowKit
  • Radix UI
  • Tailwind
  • TanStack Query/Table
  • MCP (Model Context Protocol)
  • Anthropic SDK
  • x402
  • AsyncLocalStorage
  • Sentry
  • Drizzle-Kit
  • Zod
  • Lerna
  • i18next

Pillars touched

  • Traditional Software Engineering
  • Web3 / Blockchain
  • AI Engineering
  • Cloud & DevOps

Contact

Building something similar?

Walk me through the context in a 30-minute call.

hello@andrea0x.me · @andrea0x_eth

Factor — DeFi · Vault infrastructure · AI-native layer · Andrea Ritondale