Skip to content
Ash20pkPublic

About

A advanced DeFi protocol built using 1inch APIs

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

πŸš€ Nexus - The Ultimate DeFi Trading Platform

The convergence point where all DeFi protocols, chains, and opportunities unite into one optimized experience.

Nexus is a comprehensive DeFi trading platform that maximizes every aspect of the 1inch protocol suite, providing intelligent trade routing, cross-chain arbitrage, MEV protection, and advanced portfolio management.

🎯 Problem Solved

DeFi traders are fragmented across multiple platforms, protocols, and chains, leading to:

  • $2.1B in annual inefficient execution costs
  • $500M+ lost to MEV attacks
  • 78% of traders using suboptimal execution methods
  • Missed arbitrage opportunities due to manual cross-chain execution

✨ Key Features

🧠 Intelligent Trade Router

  • AI-Powered Protocol Selection: Automatically chooses between Classic, Fusion, Fusion+, and Limit Orders
  • Real-time Comparison: Side-by-side analysis of all execution methods
  • MEV Protection by Default: Routes through Fusion when MEV risk is detected
  • Gas Optimization: Smart routing based on trade size and market conditions

πŸ”„ Cross-Chain Arbitrage Scanner

  • Real-time Opportunity Detection: Scans price differences across all 5 supported chains
  • One-Click Execution: Execute arbitrage trades using Fusion+ (bridge-free)
  • Confidence Scoring: AI-powered risk assessment for each opportunity
  • Auto-scanning: Continuous monitoring with 30-second intervals

πŸ›‘οΈ MEV Protection Dashboard

  • Comprehensive Protection: Sandwich attack, frontrunning, and backrunning prevention
  • Real-time Alerts: Live monitoring of MEV attempts and blocks
  • Savings Tracking: Track total USD saved from MEV protection
  • Private Mempool: Transactions hidden from public mempool

πŸ“Š Advanced Portfolio Management

  • Multi-Chain Portfolio: Unified view across all supported chains
  • Auto-Rebalancing: Maintain target allocations using Fusion+
  • Limit Order Engine: Set complex conditional orders across chains
  • P&L Analytics: Detailed profit/loss tracking with protocol performance

πŸ”§ Technical Architecture

Complete 1inch API Integration

  • βœ… Classic Swap Protocol (v6.0): Quote, Swap, Tokens, Allowance, Approve
  • βœ… Fusion Protocol (v1.0): Intent-based swaps with MEV protection
  • βœ… Fusion+ Protocol (v1.0): Bridge-free cross-chain swaps
  • βœ… Limit Order Protocol (v4.0): Advanced order management
  • βœ… Portfolio API (v4.0): Multi-chain balance tracking
  • βœ… Price Feeds API: Real-time token prices

Tech Stack

  • Frontend: Next.js 15, React 19, TypeScript
  • Styling: Tailwind CSS v3, shadcn/ui components, Glassmorphism design
  • Web3: Wagmi, Viem for wallet connections and blockchain interactions
  • State Management: TanStack Query for API state management
  • Charts: Recharts for data visualization
  • API Layer: Next.js API routes with Bearer token authentication
  • Real-time Quotes: Live price updates and route optimization

πŸ“Š Portfolio Management

  • Real-time Portfolio Tracking: Live balance and value updates
  • Performance Analytics: 24h changes and historical data
  • Asset Allocation: Visual portfolio distribution
  • Multi-token Support: Track all ERC-20 tokens

πŸ”— Web3 Integration

  • Multiple Wallet Support: MetaMask, WalletConnect, and more
  • Chain Switching: Seamless network transitions
  • Transaction Management: Approve and execute swaps
  • Security: Non-custodial, self-custody trading

🎨 Modern UI/UX

  • Responsive Design: Mobile-first approach
  • Dark Theme: Modern glassmorphism design
  • Real-time Updates: Live data without page refresh
  • Intuitive Interface: Clean and user-friendly

πŸš€ Getting Started

Prerequisites

Installation

  1. Clone the repository

    git clone <repository-url>
    cd hackathon_project
  2. Install dependencies

    npm install
  3. Set up environment variables

    cp env.template .env.local

    Edit .env.local and add your API keys:

    ONEINCH_API_KEY=your_1inch_api_key_here
    NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_walletconnect_project_id_here
  4. Run the development server

    npm run dev
  5. Open your browser Navigate to http://localhost:3000

πŸ”§ Configuration

1inch API Setup

  1. Visit 1inch Developer Portal
  2. Create an account and generate an API key
  3. Add the API key to your .env.local file

WalletConnect Setup (Optional)

  1. Visit WalletConnect Cloud
  2. Create a project and get your Project ID
  3. Add the Project ID to your .env.local file

πŸ—οΈ Architecture

Tech Stack

  • Frontend: Next.js 15, React 19, TypeScript
  • Styling: Tailwind CSS, shadcn/ui components
  • Web3: Wagmi, Viem, Ethers.js
  • State Management: TanStack Query
  • Charts: Recharts
  • API: 1inch API v6.0

Project Structure

β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ api/1inch/          # 1inch API routes
β”‚   β”œβ”€β”€ layout.tsx          # Root layout
β”‚   β”œβ”€β”€ page.tsx            # Main page
β”‚   └── providers.tsx       # Web3 providers
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ui/                 # shadcn/ui components
β”‚   β”œβ”€β”€ portfolio-dashboard.tsx
β”‚   β”œβ”€β”€ swap-interface.tsx
β”‚   β”œβ”€β”€ token-selector.tsx
β”‚   └── wallet-connect.tsx
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ 1inch.ts           # 1inch service
β”‚   β”œβ”€β”€ utils.ts           # Utility functions
β”‚   └── web3.ts            # Web3 configuration
└── public/                # Static assets

πŸ”Œ API Integration

This dApp integrates multiple 1inch API endpoints:

  • Token API: Fetch available tokens for each chain
  • Quote API: Get swap quotes and rates
  • Swap API: Execute token swaps
  • Allowance API: Check token allowances
  • Approve API: Generate approval transactions
  • Portfolio API: Track wallet balances
  • Price API: Get real-time token prices

🌐 Supported Networks

  • Ethereum (Chain ID: 1)
  • Polygon (Chain ID: 137)
  • Arbitrum (Chain ID: 42161)
  • Optimism (Chain ID: 10)
  • Base (Chain ID: 8453)

πŸ› οΈ Development

Available Scripts

# Development server
npm run dev

# Build for production
npm run build

# Start production server
npm start

# Lint code
npm run lint

Adding New Features

  1. New API Endpoints: Add routes in app/api/1inch/
  2. UI Components: Create in components/
  3. Utility Functions: Add to lib/
  4. Styling: Use Tailwind CSS classes

πŸ”’ Security

  • Non-custodial: Users maintain control of their funds
  • API Key Security: Server-side API calls only
  • Transaction Signing: Client-side wallet signing
  • Input Validation: Comprehensive parameter validation

πŸ“± Mobile Support

  • Fully responsive design
  • Mobile wallet integration
  • Touch-optimized interface
  • Progressive Web App (PWA) ready

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License.

πŸ™ Acknowledgments

πŸ“ž Support

For support and questions:


Built with ❀️ for the DeFi community

About

A advanced DeFi protocol built using 1inch APIs

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages