Skip to content

shri29s/DeStock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

36 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DeStock - Decentralized Trading Platform for Tokenized SharesπŸš€

Foundry Next.js Docker TypeScript

🌟 A comprehensive DeFi trading platform with AMM, order books, liquidity provision, and real-time microservices architecture 🌟


πŸ“‹ Table of Contents


🌟 Overview

DeStock is a professional-grade decentralized trading platform that enables trading of tokenized company shares using DSTK tokens. It combines automated market making (AMM), traditional order books, and liquidity provider rewards in a single platform.

DeStock Platform

πŸ—οΈ Architecture

graph LR
    A[Frontend Next.js] --> B[Load Balancer Nginx]
    B --> C[Microservices]
    C --> D[Trade Engine PostgreSQL]
    C --> E[Market Maker Bot]
    C --> F[Redis Cache]
    F --> G[Smart Contracts]
    G --> H[DeStock.sol Main Trading]
    G --> I[DeStockToken.sol Platform Token]
Loading
πŸ“ Architecture Diagram (Text)
Frontend (Next.js) ──► Load Balancer (Nginx) ──► Microservices
                                                  β”œβ”€β”€ Trade Engine (PostgreSQL)
                                                  β”œβ”€β”€ Market Maker Bot
                                                  └── Redis Cache
                                                        β”‚
Smart Contracts β—„β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”œβ”€β”€ DeStock.sol (Main Trading)                        β”‚
└── DeStockToken.sol (Platform Token) β—„β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Project Structure

DeStock/
β”œβ”€β”€ πŸ“± apps/web/                    # Next.js Trading Interface
β”œβ”€β”€ πŸ”— contracts/                  # Smart Contracts & Tests
β”‚   β”œβ”€β”€ src/                      # Solidity contracts
β”‚   β”œβ”€β”€ test/                     # Contract tests
β”‚   └── script/                   # Deployment scripts
β”œβ”€β”€ 🐳 services/                   # Microservices
β”‚   β”œβ”€β”€ trade-engine/             # Order matching engine
β”‚   └── market-maker/             # Automated trading bot
β”œβ”€β”€ πŸ—οΈ infrastructure/             # Docker & Config
β”‚   β”œβ”€β”€ docker-compose.yml        # Service orchestration
β”‚   └── nginx.conf                # Load balancer
β”œβ”€β”€ πŸ“œ scripts/                    # Automation scripts
β”œβ”€β”€ πŸ“š docs/                       # Documentation
└── 🎨 assets/                     # Static assets

πŸš€ Quick Start

Prerequisites

Requirement Version Installation
🐳 Docker Desktop Latest Download
🟒 Node.js 18+ Download
⚑ Foundry Latest curl -L https://foundry.paradigm.xyz | bash

One-Command Launch

# Clone and start the platform
git clone https://github.com/shri29s/DeStock.git
cd DeStock
chmod +x scripts/start-destock.sh
./scripts/start-destock.sh

🌐 Access the Platform

Service URL Description
🎯 Trading Platform http://localhost:3000 Main trading interface
πŸ”§ API Gateway http://localhost:80 Load balancer
⛓️ Blockchain RPC http://localhost:8545 Local blockchain

✨ Key Features

πŸ”— Smart Contract Features

πŸ€– AMM Trading

  • Automated market making with dynamic pricing
  • Liquidity pools with yield farming

πŸ“Š Order Book

  • Traditional limit orders with matching engine
  • Real-time order management

πŸͺ™ LP Tokens

  • Liquidity provider rewards system
  • Staking mechanisms

🏒 Company Tokenization

  • Create and trade company shares
  • Governance token integration

πŸ’° Trading Fees: 0.25% fee structure for platform sustainability

πŸ“ˆ Trading Interface

Feature Description
πŸ“‹ Real-time Order Book Live bid/ask spreads
πŸ“Š Professional Charts Candlestick charts with timeframes
πŸ’Ό Portfolio Dashboard Holdings and P&L tracking
πŸ—ΊοΈ Market Heatmap Visual market overview
⚑ Instant Trading Market and limit orders

πŸ› οΈ Microservices

  • πŸ”„ Trade Engine: Real-time order matching with PostgreSQL
  • πŸ€– Market Maker: Automated liquidity provision
  • πŸ“‘ WebSocket Streaming: Live price feeds and order updates
  • βš–οΈ Load Balancer: High-availability architecture

πŸ”§ Development

Smart Contracts

# πŸ—οΈ Contract Development
npm run contracts:build    # Compile contracts
npm run contracts:test     # Run tests  
npm run contracts:deploy   # Deploy to local chain

Frontend

# 🎨 Frontend Development
npm run web:dev           # Start development server
npm run web:build         # Build for production

Platform Management

# πŸš€ Platform Operations
npm run platform:start   # Start entire platform
npm run platform:stop    # Stop all services

πŸ§ͺ Testing

Smart Contract Tests

# πŸ” Contract Testing
cd contracts && forge test -vv

Service Health Checks

# πŸ₯ Health Monitoring
curl http://localhost:3002/api/health  # Trade Engine
curl http://localhost:3001/api/health  # Market Maker

πŸ“Š Tech Stack

Blockchain Layer

Solidity Foundry OpenZeppelin

Frontend

Next.js TypeScript Tailwind

Backend

Node.js Express PostgreSQL Redis

Infrastructure

Docker Nginx


🀝 Contributing

We welcome contributions! Please follow these steps:

  1. 🍴 Fork the repository
  2. 🌿 Create your feature branch: git checkout -b feature/amazing-feature
  3. πŸ’Ύ Commit your changes: git commit -m 'Add amazing feature'
  4. πŸš€ Push to the branch: git push origin feature/amazing-feature
  5. πŸ“¬ Open a Pull Request

πŸ“„ License

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


πŸ™ Acknowledgments

Special thanks to these amazing projects that made DeStock possible:

  • Foundry - Smart contract development toolkit
  • Next.js - The React framework for production
  • OpenZeppelin - Secure smart contract development

Built with ❀️ for the future of decentralized finance

⭐ Star this repository if you find it helpful!

Built with Love Powered by Coffee

About

Decentralized Stock Market

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors