Skip to content

0xsupremedev/adaptive-liquidity-orchestrator

Repository files navigation

Adaptive Liquidity Orchestrator

AI-Driven DEX Liquidity Manager on opBNB

License: MIT Built for BNB Chain opBNB

Reduce slippage and impermanent loss with intelligent liquidity rebalancing. The first AI-driven DEX liquidity orchestrator on opBNB.

image

Tech Stack

Frontend

React Vite TypeScript TailwindCSS Framer Motion

Web3 & Auth

Thirdweb Wagmi RainbowKit Reown

Blockchain

Solidity Hardhat Ethers.js OpenZeppelin

Backend

Node.js Fastify


Problem Statement

DeFi liquidity providers face significant challenges:

  • Impermanent Loss (IL): Up to 40% loss in volatile markets.
  • Manual Position Management: Hours spent monitoring and adjusting ranges.
  • High Slippage: Large trades on thin pools incur heavy slippage.
  • Static LP Positions: Most LPs use V2-style pools without optimization.

Solution

Adaptive Liquidity Orchestrator uses AI-driven algorithms to automatically manage LP positions:

  1. Real-time Volatility Monitoring: Tracks market conditions using simple-statistics and on-chain data.
  2. Intelligent Rebalancing: Automatically adjusts liquidity ranges based on AI recommendations.
  3. Slippage Reduction: Optimizes depth across price ranges.
  4. IL Protection: Shifts liquidity to stable pools during volatility spikes.

Architecture

flowchart TB
    subgraph Frontend["Frontend (React + Vite)"]
        UI[User Interface]
        Wallet[Wallet Connection]
        Charts[Metrics Charts]
    end
    
    subgraph Backend["Backend (Fastify)"]
        API[REST API]
        Optimizer[AI Optimizer]
        Relayer[Transaction Relayer]
    end
    
    subgraph Blockchain["opBNB L2"]
        VM[VaultManager]
        SM[StrategyManager]
        RE[RebalanceExecutor]
        DEX[PancakeSwap V3]
    end
    
    subgraph External["External"]
        Oracle[Binance Oracle]
        Scan[opBNBScan]
    end
    
    UI --> API
    Wallet --> VM
    API --> Optimizer
    Optimizer --> Relayer
    Relayer --> RE
    RE --> VM
    VM --> DEX
    Oracle --> SM
    VM --> Scan
Loading

Quick Start

Prerequisites

  • Node.js 20+
  • npm or yarn
  • MetaMask wallet (opBNB Testnet)

Installation

# Clone the repository
git clone https://github.com/0xsupremedev/adaptive-liquidity-orchestrator.git
cd adaptive-liquidity-orchestrator

# Install dependencies (Root, Backend, Frontend)
npm run install:all # (Hypothetical script, or run manually)

Environment Setup

Create a .env file in the root:

PRIVATE_KEY=your_private_key
OPBNBSCAN_API_KEY=your_api_key
VITE_THIRDWEB_CLIENT_ID=your_thirdweb_client_id

Run Locally

  1. Smart Contracts Node:

    npm run node
    npm run deploy:local
  2. Backend:

    cd backend
    npm run dev
  3. Frontend:

    cd frontend
    npm run dev

AI Strategy Overview

The optimizer uses volatility-based heuristics:

  1. Volatility Detection: Calculates Exponential Moving Average (EMA) of price changes.
  2. Threshold Comparison: Recommendations trigger if volatility > 5%.
  3. Action Selection:
    • High Volatility: Widen range + move to stable pool.
    • Trending Up: Shift range upwards.
    • Trending Down: Shift range downwards.

BNB Hackathon 2025

Built for the BNB Chain Hackathon 2025.

  • Innovation: First AI-driven LP manager on opBNB.
  • Integration: Native opBNB L2 deployment, Thirdweb Auth, RainbowKit.
  • User Experience: Premium "Minimal Animated Hero" UI.

License

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

Releases

No releases published

Packages

 
 
 

Contributors