MCP COO DeFi
README.md
<div align="center">
# β‘ Grok World Orchestrator
**Autonomous DeFi Yield Autopilot for Worldcoin Mini Apps**
[]()
[]()
[]()
*Verified humans only. Zero-friction. AI-driven. 24/7 autonomous.*
</div>
---
## π― What it does
Idle WLD/USDC in World App β automatically deployed to the highest-yield, risk-adjusted Morpho Blue market on World Chain, continuously monitored and rebalanced by an autonomous Grok-powered worker.
Sign once. Earn forever. Verified by World ID. No bots. No seed phrases.
---
## ποΈ Architecture
```
World App (Mini App)
β MiniKit.signMessage (EIP-191)
Vercel Edge (Next.js 15)
β POST /api/inference
Railway API (Grok + Gemini fallback)
β DecisionZ β BullMQ
Railway Worker (24/7)
ββ Morpho Blue executor (viem)
ββ APY monitor (60s loop)
ββ Auto-rebalance engine
ββ Session-key withdrawals (ERC-4337)
β
PostgreSQL + Redis + Prometheus + Grafana
```
---
## π Quick Deploy (production)
```bash
# 1. Repo
gh repo create grok-world-orchestrator --private --clone && cd grok-world-orchestrator
# 2. Merge monorepo
git remote add fincloud ../fincloud-mono
git fetch fincloud
git merge fincloud/main --allow-unrelated-histories -m "chore: merge fincloud-mono"
# 3. Railway (API + Worker β set Root Directory per service)
railway link && railway up
# 4. Vercel (Mini App + Dashboard)
cd apps/web && vercel --prod
```
**Required env vars (Railway):** `EXECUTOR_PK`, `WORLD_CHAIN_RPC`, `DATABASE_URL`, `REDIS_URL`, `XAI_API_KEY`, `GOOGLE_GENERATIVE_AI_API_KEY`, `BACKEND_INTERNAL_KEY`, `CALLBACK_HMAC_SECRET`.
**Required env vars (Vercel):** `NEXT_PUBLIC_WORLD_APP_ID`, `NEXT_PUBLIC_API_URL`.
---
## π Security
| Layer | Defense |
|-------|---------|
| Auth | EIP-191 via `viem.verifyMessage` + nonce + 5min TTL |
| Rate | Redis 10 req/min per IP+address |
| Secrets | Railway/Vercel encrypted, never in code, rotated 90d |
| Contracts | Morpho Blue `0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb` (audited) |
| Exec | maxAmount cap, minAPY 4.5%, maxSlippage 0.5%, Safe + 48h timelock |
| CI | Slither + Mythril + Foundry invariants 100k runs + TruffleHog |
| Headers | CSP, XFO, XXSS, Referrer-Policy strict |
| Kill-switch | `GLOBAL_PAUSE=true` via Railway β instant halt |
---
## π APIs
| Endpoint | Description |
|----------|--------------|
| `POST /api/inference` | Sign β Grok decision β auto-queue |
| `GET /api/health` | DB + Redis + LLM status |
| `GET /api/decisions/recent?risk=high&limit=10` | Recent decisions feed |
| `GET /api/decisions/:id` | Decision detail + execution result |
| `POST /api/decisions/:id/resolve` | Approve/block manual override |
---
## π¨ Design System
```ts
font: PP Neue Montreal + SΓΆhne + JetBrains Mono
color: #0A0A0A / #FAFAFA / #BEFF00 (acid accent) / #FF2D75 (danger)
motion: Framer Motion spring (380/30), 160-240ms transitions
shadow: 0 0 80px rgba(190,255,0,0.15) glow
```
Reference tier: Linear Β· Arc Β· Rainbow Β· Phantom Β· Family.
---
## π Growth mechanics
- **Red envelopes (ηΊ’ε
)** β Friday 20:00 CET random WLD airdrop to top 100 active users
- **Group buying** β +0.5% APY boost when 3 World-ID-verified friends deposit
- **Lucky draw** β 1 ticket per $10 deposited, weekly $1K WLD prize
- **Live counter** β Server-Sent Events feed: "X users earned Y WLD today"
- **Super-app** β yield β swap β lend β insurance in one mini app
---
## π Metrics & Observability
- Grafana dashboards: queue backlog, failed jobs, inference P95, risk distribution
- Prometheus alerts: backlog >20, failed >10%/h, latency >10s
- Pino structured logs with secret redaction
---
## πΊοΈ Roadmap
| Phase | Milestone |
|-------|-----------|
| Week 1 | Mainnet launch, invite-only 1K verified users |
| Week 4 | Public launch + Layer3 quest + Galxe campaign |
| Month 2 | Featured in World App store |
| Month 3 | Multi-protocol expansion (Aave + Pendle + Re7) |
| Month 6 | Insurance vault + social yield boost |
| Month 12 | Full super-app: swap + lending + insurance |
---
## π§ͺ Local development
```bash
pnpm install
pnpm --filter backend prisma generate
pnpm --filter backend prisma db push
pnpm --filter backend prisma db seed
docker compose up -d
curl localhost:3001/api/health # β
healthy
```
---
## π Emergency
```bash
railway variables set GLOBAL_PAUSE=true --service backend --service worker
# Smart contract: guardian.pause() via Safe (instant)
```
---
## π¦ Monorepo structure
```
grok-world-orchestrator/
βββ apps/
β βββ web/ β Mini App (Vercel, Next.js 15)
β βββ api/ β Backend (Railway, Route Handlers)
β βββ worker/ β Autonomous executor (Railway, BullMQ)
β βββ dashboard/ β Ops dashboard (Vercel)
βββ packages/
β βββ shared/ β Zod schemas, prompts, verifySignature
β βββ ui/ β Design tokens + components
β βββ queue/ β BullMQ wrappers
βββ infra/
β βββ prometheus/ β metrics config
β βββ grafana/ β provisioning
βββ prisma/ β schema + seed
βββ .github/workflows/ β ci.yml + deploy.yml + audit.yml
βββ docker-compose.yml
βββ turbo.json
βββ README.md
```
---
## π License
MIT Β© 2026 Luis Felipe Vega Rodriguez
---
<div align="center">
**Built for the 25M+ verified humans on World App.**
[Worldcoin](https://worldcoin.org) Β· [Morpho](https://morpho.org) Β· [Railway](https://railway.app) Β· [Vercel](https://vercel.com)
</div>
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo issues