- π Overview
- ποΈ Architecture
- π Project Structure
- π Quick Start
- β¨ Key Features
- π§ Development
- π§ͺ Testing
- π Tech Stack
- π€ Contributing
- π License
- π Acknowledgments
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.
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]
π 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) βββββββββββββββββ
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
| Requirement | Version | Installation |
|---|---|---|
| π³ Docker Desktop | Latest | Download |
| π’ Node.js | 18+ | Download |
| β‘ Foundry | Latest | curl -L https://foundry.paradigm.xyz | bash |
# 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| 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 |
|
π€ AMM Trading
π Order Book
|
πͺ LP Tokens
π’ Company Tokenization
|
π° Trading Fees: 0.25% fee structure for platform sustainability
| 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 |
- π 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
# ποΈ Contract Development
npm run contracts:build # Compile contracts
npm run contracts:test # Run tests
npm run contracts:deploy # Deploy to local chain# π¨ Frontend Development
npm run web:dev # Start development server
npm run web:build # Build for production# π Platform Operations
npm run platform:start # Start entire platform
npm run platform:stop # Stop all services# π Contract Testing
cd contracts && forge test -vv# π₯ Health Monitoring
curl http://localhost:3002/api/health # Trade Engine
curl http://localhost:3001/api/health # Market MakerWe welcome contributions! Please follow these steps:
- π΄ Fork the repository
- πΏ Create your feature branch:
git checkout -b feature/amazing-feature - πΎ Commit your changes:
git commit -m 'Add amazing feature' - π Push to the branch:
git push origin feature/amazing-feature - π¬ Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
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
