🤖 GoDegen: AI-powered DeFAI trading platform on Base that automates trades using real-time market predictions, advanced pool analytics, and risk management. Trade smarter with AI! #DeFi #Base #Trading
GoDegen revolutionizes DeFi trading by combining artificial intelligence with automated trading strategies on the Base network. At its core, it's a sophisticated trading platform that leverages AI predictions to execute optimal trades while managing risk, check honeypots, The platform enables users to create AI-managed portfolios that automatically execute trades based on market predictions and risk parameters.
Key innovations:
- AI-Driven Trading: Real-time market predictions and risk assessment using our custom AI Oracle
- Dynamic Pool Management: Automatic discovery and optimization of Uniswap V3 pools across multiple fee tiers
- Advanced Analytics: Real-time whale detection, market making patterns, and arbitrage opportunity identification
- Risk Management: Multi-layer protection including honeypot detection, slippage control, and liquidity verification
GoDegen is built using a modern tech stack carefully chosen for reliability, speed, and user experience:
- Portfolio Manager: Built with Solidity 0.8.x, manages user portfolios and handles token deposits/withdrawals
- AI Trader: Integrates with Uniswap V3, implementing custom pool discovery and quote optimization algorithms
- AI Oracle: Provides real-time market predictions using a sophisticated scoring system
- Security: Implements permit2 for gasless approvals and multi-step validation for trades
- Real-time Updates: Uses WebSocket connections for live trade and block monitoring
- State Management: Custom hooks for efficient data handling and real-time updates
- UI Components: Built with Tailwind CSS for a responsive and modern interface
- Web3 Integration: Ethers.js v6 for blockchain interactions and transaction management
- Pool Discovery: Custom algorithms to find and validate the best pools for trading
- Quote Optimization: Multi-strategy approach with fallback mechanisms
- Analytics Engine: Real-time analysis of market conditions, whale activity, and trading patterns
- Error Handling: Comprehensive error detection and recovery system
- Dynamic Fee Optimization: Automatically tests multiple fee tiers (0.01%, 0.05%, 0.3%, 1%) to find the most efficient trading route
- Advanced Quote System: Implements both direct pool and path-based quotes with automatic fallback
- Real-time Analytics: Custom algorithms for detecting whale activity, market making patterns, and arbitrage opportunities
- Gas Optimization: Efficient contract design and permit2 integration for reduced gas costs
GoDegen consists of three main components:
-
Smart Contracts (Solidity)
PortfolioManager.sol
: Manages user portfolios and executes tradesGoDegen.sol
(AI_Trader): Handles trade execution through Uniswap V3AIOracleV1.sol
: Provides AI-powered market predictionsInterfaces.sol
: Contains necessary interface definitions
-
Frontend (Next.js + TypeScript)
- Modern, responsive UI built with React and Tailwind CSS
- Real-time trading interface and portfolio management
- Auto-trading configuration dashboard
- Advanced market analytics and monitoring
-
AI Oracle System
- Provides real-time market predictions
- Analyzes market sentiment and trends
- Detects potential risks and opportunities
- Honeypot detection and risk scoring
- Create personalized portfolios with custom risk levels
- Deposit and withdraw tokens
- Track portfolio value and performance
- View real-time token balances
- Configure auto-trading parameters
- Automated trading based on AI predictions
- Configurable trading parameters:
- Minimum confidence threshold (0-100)
- Maximum risk score (0-100)
- Trade amount in USDC
- Auto-trading toggle
- Real-time market analysis and predictions
- Multiple quote strategies (direct pool and path-based)
- Honeypot detection
- Slippage protection
- Risk score assessment
- Multi-level validation before trade execution
- Pool liquidity verification
- Dynamic fee tier selection
- Live trade monitoring with detailed analytics:
- Price impact analysis
- Trend direction and confidence
- Whale activity detection
- Market making detection
- Arbitrage opportunity identification
- Block monitoring
- Transaction tracking
- Pool liquidity monitoring
- Automatic discovery of available pools
- Testing multiple fee tiers (0.01%, 0.05%, 0.3%, 1%)
- Liquidity verification for each pool
- Selection of best pool based on:
- Available liquidity
- Fee tier optimization
- Quote testing
- Multi-strategy quote retrieval:
1. Direct pool quote (quoteExactInputSingle)
2. Path-based quote fallback (quoteExactInput)
- Quote validation and verification
- Zero-amount quote protection
- Pool initialization checks
- Real-time price impact calculation
- Trend analysis with confidence scoring
- Whale detection with size classification:
- Medium (>$10k)
- Large (>$250k)
- Massive (>$1M)
- Market making pattern detection
- Arbitrage opportunity identification
- Comprehensive error detection:
- Pool liquidity issues
- Initialization status
- Quote failures
- Execution reverts
- Detailed error reporting
- Automatic fallback strategies
- Transaction monitoring
- Initial Setup
User -> Configure Auto-Trading Settings
- Enable/disable auto-trading
- Set minimum confidence (0-100)
- Set maximum risk score (0-100)
- Set trade amount (USDC)
- Trade Preparation
System -> Check Conditions
- Verify AI prediction confidence
- Check risk score
- Validate honeypot status
- Verify USDC balance
- Pool Discovery
System -> Find Best Pool
- Check all fee tiers
- Verify pool existence
- Test pool liquidity
- Validate pool initialization
- Quote Process
System -> Get Quote
1. Try direct pool quote
2. Fallback to path-based quote
3. Validate quote amount
4. Check price impact
- Trade Execution
System -> Execute Trade
- Verify approvals
- Set appropriate gas limit
- Execute with slippage protection
- Monitor transaction
- Log results
// AI Trader Interface
interface IAITrader {
executeManualTrade(
address tokenIn,
address tokenOut,
uint256 amountIn,
address recipient
) external returns (uint256 amountOut);
findBestPool(
address tokenIn,
address tokenOut
) external view returns (address pool, uint24 fee);
}
// Portfolio Manager Interface
interface IPortfolioManager {
updateAutoTrading(
bool enabled,
uint256 minConfidence,
uint256 maxRiskScore,
uint256 tradeAmount
) external;
getAutoTradingSettings(address user) external view returns (
bool enabled,
uint256 minConfidence,
uint256 maxRiskScore,
uint256 tradeAmount
);
}
interface PriceAnalytics {
priceImpact: number;
trendDirection: "up" | "down" | "neutral";
confidence: number;
whaleActivity: {
detected: boolean;
size: "medium" | "large" | "massive" | null;
predictedImpact: number;
};
marketMaking: {
detected: boolean;
addresses: string[];
confidence: number;
};
arbitrage: {
detected: boolean;
profitEstimate: number;
route: string[];
};
}
- Node.js v16+
- MetaMask wallet
- Base network connection
-
Clone the repository
git clone https://github.com/harshmittal1750/goDegen cd goDegen
-
Install dependencies
# Install contract dependencies cd contracts npm install # Install frontend dependencies cd frontend npm install
-
Configure environment variables
# Frontend (.env.local) NEXT_PUBLIC_WS_RPC_URL=your_websocket_url NEXT_PUBLIC_HTTP_RPC_URL=your_http_url
-
Run the development server
npm run dev
- Smart contract access controls
- Slippage protection
- Token whitelist system
- Multi-step trade validation
- Honeypot detection
- Risk assessment
- Pool validation
- Quote verification
- Solidity (Smart Contracts)
- TypeScript (Frontend)
- Next.js (Framework)
- ethers.js (Blockchain Interaction)
- Tailwind CSS (Styling)
- Uniswap V3 (DEX Integration)
- WebSocket (Real-time Updates)
- Network: Base
- Chain ID: 8453
- Explorer: https://basescan.org
portfolioManager: "0x5311762b56488E6A5bE780910bAb20353A93FBdb";
aiTrader: "0x3d66bc567613a5E7D3b49bb3b8C7BFf53EEB82f6";
aiOracle: "0x8e5aF933650BE4af3A58d949e5B817194aC5d91f";
Trading cryptocurrencies carries significant risk. This platform uses AI predictions which, while based on sophisticated algorithms, are not guaranteed to be accurate. Users should carefully consider their risk tolerance before using the auto-trading features.