Skip to content

dylanpersonguy/dcc-aggregator

Repository files navigation

⚡ DCC Yield Aggregator

Production-grade automated yield optimization for DecentralChain

Built with RIDE TypeScript Next.js pnpm Turborepo License: MIT


Deposit once. Earn optimized DeFi yield. Auto-compounding strategies managed by battle-tested keeper bots.

ArchitectureFeaturesQuick StartStructureContractsSecurityRoadmap


🏗 Architecture

┌──────────────────────────────────────────────────────────────────┐
│                        DCC Yield Aggregator                      │
├──────────────────────────────────────────────────────────────────┤
│                                                                  │
│  ┌──────────┐   ┌──────────┐   ┌──────────────────────────────┐ │
│  │ Web App  │   │  Docs    │   │   Keeper Service             │ │
│  │ Next.js  │   │ Nextra   │   │   Harvest · Rebalance · Alert│ │
│  └────┬─────┘   └──────────┘   └──────────┬───────────────────┘ │
│       │                                    │                     │
│  ┌────▼────────────────────────────────────▼───────────────────┐ │
│  │                     @dcc-agg/sdk                            │ │
│  │     Vault Client · Strategy Client · Signer · Analytics    │ │
│  └────┬────────────────────────────────────────────────────────┘ │
│       │                                                          │
│  ┌────▼────────────────────────────────────────────────────────┐ │
│  │              DCC Node (RIDE Smart Contracts)                │ │
│  │                                                              │ │
│  │  ┌──────────────┐  ┌───────────┐  ┌──────────────────────┐ │ │
│  │  │VaultRegistry │  │ VaultCore │  │ Strategy Adapters     │ │ │
│  │  │              │  │           │  │                        │ │ │
│  │  │ • registry   │  │ • deposit │  │ • FarmAutoCompound    │ │ │
│  │  │ • roles      │  │ • withdraw│  │ • LendingSupply       │ │ │
│  │  │ • pause      │  │ • shares  │  │ • LendingCarry        │ │ │
│  │  │ • config     │  │ • fees    │  │ • LiquidStakingCarry  │ │ │
│  │  └──────────────┘  └───────────┘  └──────────────────────┘ │ │
│  │                                                              │ │
│  └──────────────────────────────────────────────────────────────┘ │
│                                                                  │
│  ┌──────────────────────────────────────────────────────────────┐ │
│  │           Underlying DeFi Primitives                        │ │
│  │  DEX/AMM · LP Farms · Liquid Staking · Lending · Stables   │ │
│  └──────────────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────┘

For a deep dive into data flows, contract interactions, and system design decisions, see ARCHITECTURE.md.


✨ Features

🔐 Smart Contracts (RIDE)

  • ERC-4626-style share accounting — deterministic, gas-efficient vault logic
  • Role-based access control — Admin, Guardian, Keeper, Strategist, User
  • 4 strategy adapters — Farm auto-compound, Lending supply, Lending carry, Liquid staking
  • Emergency mode & guardian pause — circuit breakers for DeFi risk
  • Dead shares bootstrap — first-depositor inflation attack protection
  • Fee model — management (2%), performance (10%), withdrawal (0.1%) with hard caps

📦 TypeScript SDK (@dcc-agg/sdk)

  • Full vault lifecycle — deposit, withdraw, preview, list
  • Strategy management — harvest, emergency exit, reporting
  • APY computation with snapshot-based analytics
  • Dual signer support — seed phrase (Node.js) + browser wallet (Cubensis Connect)
  • BigInt-native math with 8-decimal precision

🤖 Keeper Service

  • Automated harvesting — cooldown + profit threshold triggers
  • Portfolio rebalancing — drift detection with configurable tolerance
  • Health monitoring — auto-emergency exit on strategy anomalies
  • APY snapshots — periodic data collection for analytics
  • Alerting — structured logs + webhook dispatch (Slack, Discord, PagerDuty)
  • Idempotency guards, retry logic, rate limiting

🌐 Web Application

  • Next.js 14 App Router with SSR/SSG
  • Glass morphism UI — dark, premium, cosmic design system
  • Vault listing with risk badges, APY breakdown, deposit cap bars
  • Deposit/withdraw modals with real-time share previews
  • Portfolio dashboard with per-vault position tracking
  • Responsive layout with ambient gradient animations
  • Zustand + React Query for state management

🏭 Infrastructure

  • pnpm + Turborepo monorepo with incremental builds
  • Docker images for keeper and web services
  • Kubernetes deployment manifests with resource limits
  • Prometheus alert rules for keeper health, APY drift, and vault anomalies
  • Grafana dashboard templates
  • Testnet + mainnet deploy scripts

🚀 Quick Start

Prerequisites

Tool Version
Node.js >= 20.0.0
pnpm >= 9.1.0

Installation

# Clone the repository
git clone https://github.com/dylanpersonguy/dcc-aggregator.git
cd dcc-aggregator

# Install dependencies
pnpm install

Development

# Start all services in dev mode (web, docs, keepers)
pnpm dev

# Start only the web app
pnpm --filter @dcc-agg/web dev

# Run the test suite
pnpm test

# Type-check the entire monorepo
pnpm typecheck

# Format all files
pnpm format

Build & Deploy

# Production build
pnpm build

# Deploy contracts to testnet
pnpm deploy:testnet

# Deploy contracts to mainnet
pnpm deploy:mainnet

# Start keeper service
pnpm keeper:start

# Run smoke tests
pnpm test:smoke

📁 Project Structure

dcc-aggregator/
├── apps/
│   ├── web/                 # Next.js 14 frontend (App Router)
│   └── docs/                # Documentation site (Nextra)
├── contracts/
│   └── ride/
│       ├── core/            # VaultRegistry, VaultCore
│       ├── strategies/      # Strategy adapter contracts
│       ├── lib/             # Shared libraries (keys, math, errors)
│       └── test/            # Mock contracts for testing
├── packages/
│   ├── sdk/                 # TypeScript SDK for contract interaction
│   ├── ui/                  # Shared UI component library
│   └── config/              # Shared configuration & constants
├── services/
│   └── keepers/             # Off-chain keeper automation service
├── scripts/
│   ├── deploy/              # Testnet & mainnet deployment scripts
│   └── smoke/               # End-to-end smoke tests
├── infra/
│   ├── docker/              # Dockerfiles & compose
│   ├── k8s/                 # Kubernetes manifests
│   └── monitoring/          # Prometheus alerts & Grafana dashboards
├── ARCHITECTURE.md          # In-depth system design
├── SECURITY.md              # Threat model & access control matrix
├── ROADMAP.md               # Feature roadmap & milestones
└── turbo.json               # Turborepo pipeline config

📜 Smart Contracts

All contracts are written in RIDE (DecentralChain's smart contract language) — a non-Turing-complete, functional language designed for safety and predictability.

Contract Hierarchy

VaultRegistry (singleton)
    │
    ├── VaultCore (one per vault)
    │       └── StrategyAdapter (one active per vault)
    │               └── Underlying Protocol (DEX, Farm, Lending…)
    │
    └── AccessControl / Config

Strategy Adapters

Strategy Description Yield Source
FarmAutoCompound Stakes LP tokens, auto-compounds farming rewards DEX LP Farms
LendingSupply Lends assets to earn supply-side interest Lending Protocols
LendingCarry Borrow-lend spread arbitrage across protocols Lending Markets
LiquidStaking Stakes native tokens via liquid staking derivatives PoS Staking

Fee Structure

Fee Type Rate Hard Cap
Management 2.00% 5.00%
Performance 10.00% 30.00%
Withdrawal 0.10% 1.00%

🛡 Security

Security is a first-class concern across every layer of the stack.

  • RIDE contracts — non-Turing-complete (no reentrancy), no flash loans on DCC, dead-share bootstrap protection
  • Role-based access — 5-tier permission model (Admin → Guardian → Keeper → Strategist → User)
  • Emergency systems — guardian pause, emergency exit, withdrawal-always-allowed when paused
  • Keeper isolation — keeper keys can only harvest/rebalance, never withdraw user funds
  • Fee caps — hard-coded maximum fee percentages enforced on-chain
  • Frontend — React auto-escaping, CSP headers, no dangerouslySetInnerHTML

Full threat model, attack vector analysis, and access control matrix available in SECURITY.md.


🗺 Roadmap

Phase Status Highlights
V1.0 — Foundation ✅ Complete Core contracts, SDK, keeper service, web app, infra
V1.1 — Hardening 🔄 Planned External audit, bug bounty, multi-sig admin, APY charts
V1.2 — Multi-Strategy 🔄 Planned Multiple strategies per vault, weighted allocation
V2.0 — Governance 📋 Future On-chain governance, tokenomics, fee distribution

Detailed milestone breakdown in ROADMAP.md.


🧰 Tech Stack

Layer Technology
Contracts RIDE (DecentralChain)
SDK TypeScript, BigInt math, @decentralchain/transactions
Frontend Next.js 14, React 18, Tailwind CSS, Zustand, React Query
Docs Nextra (Next.js-based documentation)
Keepers Node.js, cron scheduling, webhook alerts
Build pnpm 9, Turborepo 2, TypeScript 5.4, Vitest
Infra Docker, Kubernetes, Prometheus, Grafana

📄 License

This project is licensed under the MIT License — see the LICENSE file for details.



Built with ⚡ for the DecentralChain ecosystem

ArchitectureSecurityRoadmap

About

⚡ Production-grade automated yield aggregation platform for DecentralChain — RIDE smart contracts, TypeScript SDK, keeper automation, and a glass-morphism Next.js frontend

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors