DeFi · Vault infrastructure · AI-native layerActive

Factor

Founding Engineer · Top contributor on Discover · 100% sole author on VaaS / Agent · 2023 – present

Visit website
01

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

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

Decisions

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.

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.

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).

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

Results

Feb 2024 – oraActive period
~140k LOCOwned codebases
468 + 253Commits on Discover · Studio
Arbitrum · Base · EthereumSupported chains
MCP · VaaS · AgentAI-native layer (2026)
05

Tech & Pillars

Tech Stack

SolidityERC-4626FoundryHardhatwagmiviemethersTypeScriptNode.jsExpressDrizzle ORMPostgresRedisBullMQReact 19Next.js 14ViteRainbowKitRadix UITailwindTanStack Query/TableMCP (Model Context Protocol)Anthropic SDKx402AsyncLocalStorageSentryDrizzle-KitZodLernai18next

Pillars touched

Traditional DevWeb3 / BlockchainAI EngineeringCloud / DevOps
Factor — DeFi · Vault infrastructure · AI-native layer · Andrea Ritondale