Docs

How the pieces fit together.

Quick start

  1. Open the app and connect your wallet.
  2. Deposit into a Morpho vault on the deposit page (Ethereum mainnet).
  3. Press Start tracking yield on the dashboard, first read is your baseline.
  4. Create an agent, copy its API key (shown once), set a budget.
  5. Point your agent at the spend endpoint, example in examples/agent.ts.

Architecture

vetorica, architecture
Morpho (Ethereum mainnet)        Robinhood Chain testnet (46630)
┌───────────────────┐            ┌────────────────────────┐
│ User positions    │            │ VetoricaCredit         │
│ (custody)         │            │ mintFromYield/spendFrom│
└────────┬──────────┘            └──────────▲─────────────┘
         │ GraphQL api.morpho.org           │ viem
┌────────▼──────────────────────────────────┴──────────┐
│ backend, yield reader + agent registry + indexer    │
└──────────────────────────▲───────────────────────────┘
                 dApp (Next.js + wagmi)

Credit flow

  1. Deposit into a Morpho vault or market (in-app on the deposit page).
  2. The yield reader snapshots your positions, the first read is a baseline, never minted.
  3. When supply assets grow, the delta mints USD credits (6 decimals) to your address on Robinhood Chain.
  4. Each mint is keyed by a deterministic yieldId, retries can never double-credit.

Agent API

Authenticate with the agent's API key (returned once at creation):

agent spend
curl -X POST $API/agents/1/spend \
  -H "X-Agent-Key: vtr_..." \
  -H "Content-Type: application/json" \
  -d '{"amountUsd": 2.5, "action": "inference"}'

Spends are checked against the agent's budget and maxSpendUsdguardrail, then burned on-chain via spendFrom.

Endpoints

POST /auth/nonce · /auth/verifywallet login → bearer token
GET /credits/:addressbalance + reports + indexed events
POST /users/:address/trackstart yield tracking (authed)
GET /users/:address/positionslive Morpho positions
POST/GET/PATCH /agents…agent CRUD + budget guardrails
POST /agents/:id/spendon-chain debit (owner or API key)
GET /agents/:id/usagespend history

Networks

CreditsRobinhood Chain Testnet · chain ID 46630 · ETH gas
Deposits (Morpho)Ethereum mainnet · chain ID 1
Morpho APIapi.morpho.org/graphql