← Back to home

MEGA Quant

MEGA QUANT: Multi-chain Delta Neutral Trading Desktop Application with trustless EIL Integration

Problem Statement

⏺ MEGA QUANT - Multi-Chain Delta-Neutral Trading PlatformMEGA QUANT is a desktop trading application that enables seamless asset transfers and trading across networks (currently Ethereum and Base). It uses the EIL (Ethereum Interoperability Layer) protocol, to allow traders to manage their wallets.Key Innovation: It is an open source platform, that allows quant traders to have their natural feel of a traditional high frequency trading platforms. Traders only needs to understand the price, the costs of trading, and to execute the trade/swaps. Here, we wrapped complex smart contract integration with a javascript class and allow traders to seamlessly and with great control to programatically interact with the blockchain.We also leveraged EIL's ERC-7683 voucher system to execute trustless cross-chain transfers with just one signature., enabling transfers of tokens ( Currently USDC or ETH between Ethereum and Base) in ~30 seconds, to manage their funds in their wallet addresses - the entire multi-chain operation is atomic (either all chains succeed or all revert).How It Works (Trading):Create a Wallet and Select your RPC.Enter the API Configurations for Alchemy, 1inch, etherscan, coinmarketcap.Create a strategy and start coding the trading logic.Run the strategy.Technical Stack:Electron to build the desktop applicationA DeltaTrade javascript class used for trading1inch APIs for getting quotes and making a swapuniswapv4 API for getting quotes and making a swapHow It Works (Fund Management):Approve & Request: On the source chain (e.g., Ethereum), approve USDC and request a voucher from cross-chain liquidity providersRedeem & Transfer: On the destination chain (e.g., Base), automatically redeem the voucher and transfer tokens to the recipientGas Sponsorship: Paymaster contracts sponsor gas fees, allowing users to pay in USDC instead of ETHTechnical Stack:ERC-4337 Account Abstraction with UserOperationsEIL SDK for cross-chain coordinationSmart contract wallets with EntryPoint depositsTenderly virtual networks for testingBuilt with Electron, React, TypeScript, and ViemBenefits:Native High Frequency Trading Programatic Feel for Quant TradersNo traditional bridge risk or long wait times for fund managementTrustless and atomic transfers when managing funds.Pay gas in USDC via paymasters while managing fundsPerfect for traditional high frequency traders or someone learning HFT to use the platform and begin trading!

Solution

Technical Deep Dive: Building MEGA QUANTDesktop Architecture with Electron We built MEGA QUANT as a native desktop application using Electron, combining the flexibility of web technologies with the performance and security of a native app. This architecture allows us to securely manage private keys locally while providing a responsive trading interface. The Electron main process handles sensitive operations (key management, database access) while the renderer process focuses on UI and real-time data visualization.DeltaTrade Class: Core Trading Engine At the heart of our trading system is the DeltaTrade JavaScript class, which implements delta-neutral arbitrage strategies. This class allows programmatic monitoring of price discrepancies across Uniswap V3, Uniswap V4, and 1inch aggregator to identify profitable arbitrage opportunities. The DeltaTrade engine calculates optimal position sizes, manages slippage tolerance, and executes multi-step trades atomically to maintain delta neutrality while capturing spread profits.Web Workers for Performance To keep the UI responsive during intensive calculations, we offloaded all strategy execution to Web Workers (strategy-worker.js). Each deployed trading strategy runs in its own isolated worker thread, performing continuous price monitoring, technical indicator calculations, and trade simulations without blocking the main UI thread. This architecture allows traders to run multiple strategies simultaneously while maintaining smooth 60fps chart rendering and real-time market data updates.Multi-DEX Integration Uniswap V4: We integrated Uniswap V4's new hook system and singleton architecture. Unlike V3's pool-per-pair model, V4 uses a single contract with custom hooks for advanced features. We leverage the Quoter contract to simulate swaps and calculate optimal routing across different fee tiers and hook configurations.1inch Aggregator: For maximum liquidity and best execution, we integrated 1inch's fusion mode API. The aggregator automatically routes trades across 100+ DEXs, finding the optimal path while minimizing gas costs and slippage. We poll the quote API every 15 seconds to maintain fresh pricing data for our arbitrage detection algorithms.Cross-Platform Binary Distribution A major challenge was packaging Node.js along with the Electron app to ensure consistent runtime across Windows, macOS, and Linux. We bundle a stripped-down Node.js binary (resources/nodejs/) with the application, allowing backend services to run independently of the user's system Node installation. This approach eliminates version conflicts and ensures our complex dependency tree (ethers.js, viem, Web3 providers) works reliably across all platforms.Database & Encryption All sensitive data (private keys, API keys, trading history) is stored in a local SQLite database with AES-256-GCM encryption. The master password never touches the disk - it exists only in memory during the session. We implemented a secure key derivation function (PBKDF2) to generate encryption keys from the user's password, with each encrypted field storing its own IV and authentication tag for maximum security.Real-time Market Data Pipeline We built a WebSocket-based live data service that maintains persistent connections to Alchemy's WebSocket API for real-time mempool monitoring. The service filters pending transactions targeting Uniswap/1inch routers, decodes swap calldata, and broadcasts relevant trades to the frontend via WebSocket. This allows traders to see incoming trades before they're mined, enabling front-running detection and MEV opportunity analysis.EIL Integration for Cross-Chain Fund Management Finally, we integrated the Ethereum Interoperability Layer (EIL) protocol to enable seamless fund movement between Ethereum and Base. Using ERC-4337 account abstraction and ERC-7683 cross-chain intents, traders can rebalance portfolios across chains with a single signature. The voucher-based system provides trustless, atomic transfers in ~30 seconds, with gas fees sponsored by paymasters - eliminating the need to maintain ETH balances on multiple chains. This lets traders keep capital efficient while accessing liquidity on both networks.Notable Hacks & OptimizationsBundle Size Optimization: We use Vite's code-splitting to lazy-load trading chart libraries (lightweight-charts) only when needed, reducing initial load time by 60%.Provider Caching: Ethers.js providers are expensive to create. We maintain a singleton cache keyed by (networkId, rpcUrl) to reuse providers across components.Ring Buffers: For real-time trade feeds and mempool data, we use fixed-size ring buffers (50 items) instead of unbounded arrays to prevent memory leaks during extended trading sessions.Monaco Editor Integration: We embedded Monaco (VS Code's editor) for strategy development with full TypeScript IntelliSense, allowing traders to write and test strategies with autocomplete for our trading API.The result is a professional-grade trading platform that feels like a native desktop app while leveraging the entire JavaScript/TypeScript ecosystem for rapid development and cross-chain DeFi integration.

Hackathon

ETHGlobal Buenos Aires

2025

Prizes

  • 🏆

    Utilize 1inch APIs

    1inch

Contributors