Skip to content

sameezy667/DjedOPS-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

48 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎯 DjedOPS Command Center

License: MIT Next.js TypeScript Tests PRs Welcome

Real-time stability analytics and risk management dashboard for the Djed Protocol on Ergo Blockchain

Features β€’ Quick Start β€’ Architecture β€’ Documentation β€’ Contributing


πŸ“‹ Table of Contents


🌟 Overview

DjedOPS is a mission-critical monitoring platform providing operators and traders with real-time visibility into the Djed algorithmic stablecoin protocol on the Ergo blockchain. Built with a "Financial Brutalism" design philosophy, it combines live blockchain data, 3D visualizations, and automated risk management tools.

Project Maturity

βœ… Prototype β†’ βœ… MVP β†’ βœ… Alpha β†’ ⏳ Beta β†’ 🎯 Production β†’ πŸ”’ Audited

Current Status: Alpha (v0.1.0) - Production-ready features with 41 passing tests

✨ Features

πŸ“Š Core Monitoring

  • Live DSI Monitor - Real-time Djed Stability Index tracking with dynamic reserve ratio calculation
  • Transaction Feed - Live blockchain monitoring for MINT/REDEEM operations (SigUSD & SigRSV)
  • Oracle Consensus - Real-time ERG/USD price from Ergo blockchain oracles1
  • Reactive 3D Visualization - Dynamic Reserve Sun that transforms based on system health

πŸ’° Trading & Risk Management

  • Arbitrage Sniper - Live DEX price monitoring from Spectrum Finance2 with automated opportunity detection (Β±0.5% threshold)
  • Sentinel Mode - Automated guardian with configurable triggers for reserve ratio alerts and volatility warnings
  • Risk Scenarios - One-click stress tests: Flash Crash, Oracle Freeze, Bank Run

πŸ‘› Wallet Integration

  • Nautilus Wallet - Full dApp connector integration3 with auto-reconnect and balance polling
  • Real-Time Balance - Live ERG balance display with 30-second refresh

πŸ“± Cross-Platform

  • React Native App - Complete mobile companion app with Expo/EAS build support
  • Responsive Design - Mobile-first web dashboard with touch-optimized controls

Latest Updates (December 2025)

βœ… Live DEX Price Integration    βœ… Nautilus Wallet Support
βœ… Transaction Feed              βœ… Reactive Reserve Sun  
βœ… Performance Mode              βœ… Sentinel Mode
βœ… Risk Scenarios                βœ… Mobile App
βœ… 41 Tests Passing              βœ… Responsive Design

πŸ—οΈ Architecture

System Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Frontend (Next.js 14)                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚   React     β”‚  β”‚   Zustand   β”‚  β”‚     SWR     β”‚    β”‚
β”‚  β”‚ Components  β”‚β†’β†’β”‚    Store    │←←│  Data Hooks β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚                                   β”‚
             β–Ό                                   β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   API Routes (Proxy)   β”‚         β”‚  3D Visualization      β”‚
β”‚  β€’ /api/djed           β”‚         β”‚  React Three Fiber     β”‚
β”‚  β€’ /api/dex            β”‚         β”‚  (WebGL)               β”‚
β”‚  β€’ /api/feed           β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”
    β–Ό                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Ergo Explorerβ”‚  β”‚Spectrum Finance  β”‚
β”‚   API       β”‚  β”‚   DEX API        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow

  1. External APIs β†’ Ergo Explorer, Spectrum Finance DEX
  2. API Routes β†’ Next.js proxy endpoints (CORS handling, data transformation)
  3. Custom Hooks β†’ SWR for caching + business logic (useDjedData, useDexPrice, useWallet)
  4. Global State β†’ Zustand store (protocol data, wallet, sentinel config, simulations)
  5. React Components β†’ 50+ components consuming state and rendering UI

Key Design Patterns

  • Client-Side Rendering - All data fetching client-side via SWR
  • API Proxy Pattern - Next.js API routes prevent CORS issues
  • Optimistic Updates - Immediate UI feedback with background revalidation
  • Error Boundaries - Graceful degradation with fallback UI
  • Performance Mode - Conditional rendering based on device capabilities

πŸ› οΈ Tech Stack

Frontend

Technology Version Purpose
Next.js 14.2.33 React framework with App Router
TypeScript 5.0 Type-safe development
React 18.2 UI library
Tailwind CSS 3.4.1 Utility-first styling
Framer Motion 12.23.25 Advanced animations
React Three Fiber 8.15.0 3D graphics (WebGL)

State & Data

Technology Purpose
Zustand Lightweight state management
SWR Data fetching & caching

Testing

Technology Purpose
Jest Unit testing framework
Testing Library Component testing
fast-check Property-based testing

Mobile

Technology Purpose
React Native Native mobile framework
Expo Development & build platform
Reanimated Native animations

APIs & Blockchain


πŸš€ Quick Start

Prerequisites

Node.js 18+ or 20+
npm 9+ or yarn
Git

Web Dashboard

# 1. Clone the repository
git clone https://github.com/yourusername/djedops.git
cd djedops

# 2. Install dependencies
npm install

# 3. Start development server
npm run dev

# 4. Open browser
# Navigate to http://localhost:3000

Production Build

# Build for production
npm run build

# Start production server
npm start

Mobile App

# 1. Navigate to mobile directory
cd mobile

# 2. Install dependencies
npm install

# 3. Start Expo development server
npm start

# 4. Run on specific platform
npm run ios       # iOS simulator (Mac only)
npm run android   # Android emulator
npm run web       # Web browser

# 5. Build for production (requires EAS CLI)
npm install -g eas-cli
eas login
npm run build:android  # or build:ios

Demo Mode

For testing without external API access:

http://localhost:3000?demo=true

Uses static mock data from public/mock-data.json


πŸ§ͺ Testing

Run Tests

# Run all tests
npm test

# Watch mode
npm test -- --watch

# Coverage report
npm test -- --coverage

Test Coverage

Test Suite Tests Status Coverage
calculations.test.ts 12 βœ… Unit tests for DSI & reserve ratio
simulation.test.ts 15 βœ… Scenario & price simulation logic
wallet.test.ts 8 βœ… Nautilus wallet integration
TerminalFeed.test.ts 6 βœ… Transaction feed component
Total 41 βœ… Comprehensive coverage

Testing Approach

  • Unit Tests - Pure functions, calculations, utilities
  • Component Tests - React component rendering & interactions
  • Integration Tests - Multi-component workflows
  • Property-Based Tests - Using fast-check for edge cases

Status: All 41 tests passing βœ…

For detailed testing guide, see NEW_FEATURES_TESTING.md


πŸ“ Project Structure

djedops/
β”œβ”€β”€ app/                          # Next.js App Router
β”‚   β”œβ”€β”€ layout.tsx               # Root layout with fonts & error boundary
β”‚   β”œβ”€β”€ page.tsx                 # Main dashboard
β”‚   β”œβ”€β”€ globals.css              # Financial Brutalism theme
β”‚   └── api/                     # API routes (CORS proxy)
β”‚       β”œβ”€β”€ djed/route.ts       # Ergo Explorer proxy
β”‚       β”œβ”€β”€ dex/route.ts        # Spectrum Finance proxy
β”‚       └── feed/route.ts       # Transaction feed proxy
β”œβ”€β”€ components/                   # React components (50+)
β”‚   β”œβ”€β”€ HeroSection.tsx          # Main dashboard section
β”‚   β”œβ”€β”€ ReserveSunWithVisibility.tsx  # 3D visualization wrapper
β”‚   β”œβ”€β”€ MarketOpportunityCard.tsx     # Arbitrage signals
β”‚   β”œβ”€β”€ SentinelPanel.tsx        # Automated monitoring
β”‚   β”œβ”€β”€ TerminalFeed.tsx         # Transaction log
β”‚   β”œβ”€β”€ WalletConnect.tsx        # Nautilus integration
β”‚   β”œβ”€β”€ ErrorBoundary.tsx        # Global error handling
β”‚   └── isolated/                # Reusable components
β”‚       β”œβ”€β”€ ReserveSun.tsx       # 3D sphere visualization
β”‚       └── DataGrid.tsx         # Metrics display
β”œβ”€β”€ lib/                         # Business logic & utilities
β”‚   β”œβ”€β”€ calculations.ts          # DSI & reserve ratio formulas
β”‚   β”œβ”€β”€ store.ts                 # Zustand global state
β”‚   β”œβ”€β”€ types.ts                 # TypeScript interfaces
β”‚   β”œβ”€β”€ constants.ts             # Configuration constants
β”‚   β”œβ”€β”€ demo-service.ts          # Mock data service
β”‚   β”œβ”€β”€ hooks/                   # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ useDjedData.ts      # Protocol data fetching
β”‚   β”‚   β”œβ”€β”€ useDexPrice.ts      # DEX price & arbitrage
β”‚   β”‚   β”œβ”€β”€ useTransactionFeed.ts # Blockchain transactions
β”‚   β”‚   β”œβ”€β”€ useWallet.ts        # Nautilus wallet logic
β”‚   β”‚   └── usePageVisibility.ts # Tab visibility detection
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   └── dsiCalculator.ts    # DSI calculation logic
β”‚   └── __tests__/               # Unit tests
β”‚       β”œβ”€β”€ calculations.test.ts
β”‚       β”œβ”€β”€ simulation.test.ts
β”‚       └── wallet.test.ts
β”œβ”€β”€ mobile/                       # React Native app
β”‚   β”œβ”€β”€ app/                     # Expo Router
β”‚   β”œβ”€β”€ components/              # Mobile components
β”‚   β”œβ”€β”€ utils/                   # Mobile utilities
β”‚   └── package.json             # Mobile dependencies
β”œβ”€β”€ public/                      # Static assets
β”‚   β”œβ”€β”€ mock-data.json          # Demo mode data
β”‚   └── manifest.json           # PWA manifest
β”œβ”€β”€ stories/                     # Storybook stories
β”œβ”€β”€ tailwind.config.ts          # Tailwind + theme config
β”œβ”€β”€ jest.config.js              # Jest configuration
└── package.json                # Dependencies & scripts

🎨 Design System

Financial Brutalism Philosophy

High-contrast, terminal-inspired aesthetics with zero fluff. Designed for rapid data interpretation in high-stress trading scenarios.

Color Palette

Color Hex Usage
Deep Void Black #050505 Background
Obsidian #080808 Surface
Terminal Green #39FF14 SAFE/NORMAL state, primary actions
Alert Red #FF2A2A CRITICAL state, warnings
Off-white #E5E5E5 Primary text
Steel Grey #888888 Secondary text

Typography

  • Display: Unbounded (700, 900) - Headers and emphasis
  • Body: Inter (400, 700, 900) - General text
  • Monospace: JetBrains Mono, Space Mono - All numeric data

Visual Effects

  • ✨ CRT scanline overlay (nostalgic terminal aesthetic)
  • πŸ’š Green glow on positive signals (text-shadow: 0 0 10px rgba(57, 255, 20, 0.6))
  • ❀️ Red glow on alerts (text-shadow: 0 0 10px rgba(255, 42, 42, 0.6))
  • πŸ“ Corner L-brackets on all containers (brutalist decoration)
  • πŸ”² Hollow text effect (stroke with transparent fill)

Accessibility

  • βœ… WCAG AA compliant (4.5:1 text contrast)
  • βœ… Keyboard navigation with visible focus indicators
  • βœ… prefers-reduced-motion support
  • βœ… ARIA labels and live regions
  • βœ… Semantic HTML structure

πŸ”Œ API Integration

Ergo Explorer API

Base URL: https://api.ergoplatform.com/api/v1

// Oracle price data
GET /oracle/poolBox
Response: { price: number, datapoints: OracleData[] }

// Protocol metrics
GET /addresses/{address}/balance/total
Response: { nanoErgs: number }

Polling: 15 seconds
Cache: SWR with 10s revalidation
Error Handling: Exponential backoff, fallback to demo data

Spectrum Finance API

Base URL: https://api.spectrum.fi/v1

// DEX pool data
GET /amm/pools
Response: SpectrumPool[]

// Price calculation
price = (reserveY / 10^decimalsY) / (reserveX / 10^decimalsX)

Polling: 15 seconds
Arbitrage Detection: Β±0.5% spread threshold

Nautilus Wallet Integration

dApp Connector: EIP-0012 standard3

// Connection flow
ergo.request({ method: "wallet_connect" })
β†’ User approves in Nautilus
β†’ ergo.get_balance() for ERG balance
β†’ localStorage persistence for auto-reconnect

Balance Polling: 30 seconds
Reconnection: Automatic on page load


πŸ“š Documentation

Core Documentation

Feature Guides


🀝 Contributing

We welcome contributions! Please follow these guidelines:

Development Workflow

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Make changes following our code style
  4. Write/update tests
  5. Run test suite: npm test
  6. Commit: git commit -m 'Add amazing feature'
  7. Push: git push origin feature/amazing-feature
  8. Open Pull Request

Code Style

  • TypeScript: Strict mode enabled
  • Components: Functional components with hooks
  • Styling: Tailwind utility classes (no CSS modules)
  • Testing: Jest + Testing Library
  • Commits: Conventional Commits format

Design Principles

All contributions must maintain Financial Brutalism aesthetic:

  • βœ… High contrast (3:1 minimum)
  • βœ… Monospace fonts for all numeric data
  • βœ… Terminal green (#39FF14) and alert red (#FF2A2A)
  • ❌ No gradients
  • ❌ No rounded corners (except functional elements)
  • ❌ No decorative shadows (only functional glows)

πŸ“„ License

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

MIT License

Copyright (c) 2025 The Stable Order

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction...

πŸ™ Acknowledgments

Core Technologies

Ergo Ecosystem

Resources & Documentation

  • Ergo Explorer API - Blockchain data provider
  • Ergo Oracle Pools - Decentralized price feeds1
  • Financial Brutalism - Design philosophy inspiration

Contributors

Built with AI-assisted development tools while maintaining human-driven architecture and design decisions.


πŸ“– References


Built with ❀️ for the Ergo community

Report Bug β€’ Request Feature β€’ Documentation

Footnotes

  1. Ergo Oracle Pools Documentation - Decentralized oracle design ↩ ↩2

  2. Spectrum Finance Documentation - AMM protocol on Ergo ↩ ↩2

  3. EIP-0012: dApp Connector Standard - Wallet integration standard ↩ ↩2 ↩3

  4. Djed: A Formally Verified Crypto-Backed Stablecoin - Academic whitepaper ↩

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors