NexusBridgExtension
Nexus Browser extension - unifies cross-chain bridging with defi workflows for Aave, Morpho
Problem Statement
NexusBridgExtensionNexus Chain Abstraction Browser ExtensionA powerful browser extension that bringsunified multi-chain liquidityto DeFi applications through intelligent transaction interception and automated cross-chain bridging. Built on theA, this extension seamlessly integrates chain abstraction into any Web3 dApp without requiring protocol modifications.π What is This Project?This browser extension acts as anintelligent middleware layerbetween users and DeFi protocols, automatically detecting insufficient token balances and bridging assets from other chains to fulfill transactions. It transforms the fragmented multi-chain experience into a unified liquidity layer.Key FeaturesπAutomatic Cross-Chain Bridging + DeFi Execution: Detects when you lack sufficient tokens on one chain and automatically sources them from your balances on other chains, then executes the DeFi actionπ°Unified Balance View: Aggregates your token balances across all supported chains (Ethereum, Arbitrum, Base, Optimism, Polygon, Avalanche, BNB Chain, HyperEVM)π―Protocol-Agnostic Integration: Works with DeFi protocols like Morpho, Aave, Lido, Hyperliquid, LiFi, and more without requiring any protocol changesπNon-Custodial: All transactions are signed by your existing wallet - the extension never holds your fundsβ‘EIP-6963 Multi-Wallet Support: Automatically detects and works with MetaMask, Rabby, Rainbow, and other Web3 walletsπ¨Shadow DOM Isolation: Clean UI injection that doesn't interfere with dApp stylingποΈ ArchitectureComponentsContent Script (nexusCA.tsx):Intercepts Web3 provider requests using EIP-6963Analyzes transaction data to detect protocol interactions (Lido staking, Aave lending, DEX swaps, etc.)Triggers unified bridging flows when insufficient balances are detectedManages the Nexus SDK lifecycle and event handlingBackground Service Worker (background.ts):Handles extension lifecycle eventsManages persistent state across browser sessionsPopup UI (popup.tsx):Shows extension status and connected wallet infoDisplays provider information and connection stateInjected Components:IntentModal: User interface for approving cross-chain bridge intentsAllowanceModal: Token allowance approval flowNexusSteps: Progress tracking for multi-step bridging operationsSupported ProtocolsThe extension has specialized integrations for:Morpho- USDC vault deposits with automatic bridging and deposit execution on BaseAave V3- USDC lending with automatic bridging and supply execution on Base, Ethereum, Optimism, Arbitrum, Polygon, Avalanche, BNB Chain, ScrollLido- ETH staking with unified ETH across chains and automatic staking execution on Ethereum mainnetHyperliquid- Trading with automatic USDC bridgingLiFi- Cross-chain swaps with balance aggregationHypurrFi- Vault deposits on HyperEVMGeneric ERC20 Transfers- Supports any token transfer with auto-bridgingπ How It WorksExample Flow: Morpho USDC Vault DepositUser visits Morpho on Base and tries to deposit 1000 USDC into a vaultUser only has 400 USDC on Base, but has 600 USDC across Ethereum and ArbitrumExtension intercepts the transaction and detects the 600 USDC deficitShows unified balance modal with breakdown across chainsUser approves the intent to bridge 600 USDC from other chains β BaseNexus SDK handles the cross-chain transfer via Circle CCTPAfter bridging completes (~2-5 minutes), extension automatically calls Morpho's deposit function1000 USDC gets deposited into the vault and user receives vault tokens - all automatedExample Flow: Lido StakingUser visits Lido and tries to stake 5 ETHUser only has 2 ETH on Ethereum, but has 3 ETH on ArbitrumExtension intercepts the transaction and detects the deficitShows unified balance modal: "You need 3.002 more ETH (including gas)"User approves the intent to bridge from Arbitrum β EthereumNexus SDK handles the cross-chain transfer via Circle CCTPAfter bridging completes, extension automatically calls Lido's submit() function5 ETH gets staked and user receives stETH - fully automatedExample Flow: Aave USDC SupplyUser visits Aave on Base and tries to supply 1000 USDCUser has 300 USDC on Base, 400 on Ethereum, 300 on ArbitrumExtension detects 700 USDC deficit on BaseShows intent modal with breakdown of sourcesUser approves β Nexus bridges 700 USDC from multiple chains to BaseAfter arrival, extension automatically calls Aave's supply() function1000 USDC gets supplied to Aave and user receives aTokens - completely automatedπ¦ Installation & SetupPrerequisitesNode.js 18+ and npmA Chromium-based browser (Chrome, Edge, Brave, Arc)A Web3 wallet extension (MetaMask, Rabby, etc.)Build InstructionsClone and Installgit clone <repository-url> cd nexus-hyperliquid-poc npm installBuild the Extensionnpm run buildCreate Distribution Zip (Optional)npm run zip # or build + zip in one command npm run build-zipLoad Extension in BrowserOpen Chrome and navigate tochrome://extensionsEnableDeveloper Mode(toggle in top-right corner)ClickLoad UnpackedSelect thedist/folder from the project directoryThe extension icon should appear in your browser toolbarDevelopment ModeFor active development with hot reload:npm run devThen load thedist/folder as an unpacked extension. Changes will rebuild automatically.π§ Project Structurenexus-hyperliquid-poc/ βββ src/ β βββ injected/ β β βββ nexusCA.tsx # Main content script & transaction interceptor β β βββ cache.ts # Unified balance caching β β βββ caEvents.ts # Nexus SDK event handlers β β βββ checkNexus.ts # Nexus initialization checks β β βββ domModifier.ts # DOM manipulation utilities β β βββ networkInterceptor.ts # Network request interceptor β βββ components/ β β βββ intent-modal.tsx # Bridge intent approval UI β β βββ allowance-modal.tsx # Token allowance UI β β βββ event-modal.tsx # Progress tracking UI β β βββ expandable-row.tsx # Collapsible UI components β βββ utils/ β β βββ constants.ts # Token mappings & chain configs β β βββ multicall.ts # Multicall contract ABIs β β βββ lido.abi.ts # Lido protocol integration β β βββ aave.abi.ts # Aave V3 protocol integration β β βββ lifi.abi.ts # LiFi protocol integration β β βββ publicClient.ts # Viem public client setup β βββ background.ts # Service worker β βββ popup.tsx # Extension popup UI β βββ manifest.json # Extension manifest βββ public/ # Static assets βββ vite.config.ts # Vite build configuration βββ package.jsonπ οΈ Technical StackFramework: React 19 with TypeScriptBuild Tool: Vite 7 with web extension pluginWeb3 Libraries:Viem 2.33 (Ethereum interactions)@avail-project/nexus (Chain abstraction SDK)Browser APIs: Chrome Extension Manifest V3Wallet Integration: EIP-6963 (Multi-wallet discovery)Styling: Shadow DOM with isolated CSSπ― Supported ChainsEthereum Mainnet (Chain ID: 1)Arbitrum One (Chain ID: 42161)Base (Chain ID: 8453)Optimism (Chain ID: 10)Polygon (Chain ID: 137)Avalanche C-Chain (Chain ID: 43114)BNB Chain (Chain ID: 56)HyperEVM (Chain ID: 999)π Security ConsiderationsNon-Custodial: Extension never has access to private keysUser Approval: All bridge intents require explicit user confirmationTransaction Simulation: Nexus SDK simulates all transactions before executionShadow DOM Isolation: UI components are isolated from dApp codeRead-Only Balance Checks: Extension only intercepts and analyzes transactions, doesn't modify them without approvalπ Known LimitationsBridge Timing: Cross-chain bridges take 2-5 minutes - users must manually retry transactions after bridging completesGas Estimation: Currently uses fixed gas reserves (0.002 ETH) for native token bridgingProtocol Coverage: Specialized integrations only cover major protocols (Morpho, Aave, Lido, Hyperliquid) - other protocols use generic ERC20 detectionQuirksInjects the SDK and UI into the dapp using content-scriptCurrently only works on HyperliquidUses Vite and React
Solution
Core Architecture & Technology Stack Nexus Bridge is built as a Manifest V3 Chrome Extension using modern web technologies that seamlessly integrate with existing DeFi protocols without requiring any changes to their codebases.Majorly made with using Nexus BridgeFrontend Stack:React 19 with TypeScript for robust UI components and type safety Vite 7 as the build tool with custom web extension plugins for optimized bundling Shadow DOM for UI isolation to prevent conflicts with dApp styling Tailwind CSS for consistent styling across injected components Web3 Integration:Viem 2.33 for Ethereum interactions and smart contract calls EIP-6963 for universal wallet detection across MetaMask, Rabby, Rainbow, and other wallets Avail Nexus SDK as the core chain abstraction layer powering cross-chain bridging The Most Challenging Part - Seamless DeFi Integration The biggest technical hurdle was integrating with existing DeFi UIs without breaking them. We had to reverse-engineer how major protocols like Lido, Aave, and Morpho structure their interfaces and inject our functionality at exactly the right moments.DOM Mutation Observation Strategy: We use intelligent mutation observers that watch for specific UI elements appearing on DeFi sites. When a user opens Lido's staking interface, our extension detects this and injects a "Unified ETH" button. For Aave, we watch for USDC supply modals and immediately show unified balance options.Transaction Interception Magic: The most "hacky" but crucial part is intercepting Web3 provider calls before they reach the blockchain. We hook into eth_sendTransaction calls, analyze the transaction data to understand what DeFi action is being attempted, and determine if cross-chain bridging is needed. This happens completely transparently to both the user and the dApp.Protocol-Specific Smart Contract Integration: Each protocol required deep analysis of their smart contract interfaces. For Lido, we hook into their submit function for ETH staking. For Aave V3, we intercept supply calls for USDC lending. For Morpho, we detect vault deposit transactions. This required studying each protocol's ABI and understanding their exact function signatures.Partner Technology Integration - Avail Nexus SDK Avail Nexus SDK was absolutely crucial for handling the complex cross-chain infrastructure. Instead of building our own bridge aggregation, Nexus provides enterprise-grade bridging with automatic route optimization.Key Benefits of Nexus SDK:Automatic Route Optimization - Finds the cheapest and fastest bridge paths across 8+ chains Circle CCTP Integration - Native USDC bridging with 1:1 minting instead of wrapped tokens Multi-Chain Balance Aggregation - Real-time balance fetching across Ethereum, Arbitrum, Base, Polygon, etc. Intent-Based Architecture - Users approve outcomes rather than complex transaction sequences Notable Technical Innovations Unified Balance Caching System: We built a sophisticated caching layer that aggregates token balances across all supported chains in real-time. This creates the illusion of having one unified balance rather than fragmented balances across multiple chains.Automated Post-Bridge Execution: The trickiest engineering challenge was automatically executing DeFi actions after bridging completes. Cross-chain bridges take 2-5 minutes, but we needed to seamlessly continue the user's intended action once tokens arrive. We implemented smart polling mechanisms that detect when bridged tokens arrive and automatically trigger the original DeFi function.Shadow DOM UI Injection: To avoid CSS conflicts with existing dApps, we inject all UI components using isolated Shadow DOM. This ensures our modals and buttons don't break the original dApp styling while maintaining a native look and feel.Multi-Wallet EIP-6963 Support: Rather than hardcoding specific wallet integrations, we implemented EIP-6963 for universal wallet discovery. This means our extension automatically works with any compliant Web3 wallet without requiring separate integrations.Cross-Chain Bridge Flow Engineering The most complex engineering challenge was handling the asynchronous nature of cross-chain bridging while maintaining a smooth user experience. We had to design state management that tracks bridge progress, handles failures gracefully, and provides clear feedback throughout the multi-minute process.Smart Contract Interaction Optimization: We optimized gas usage by batching operations where possible and implementing intelligent gas estimation that accounts for cross-chain scenarios. The extension automatically reserves gas for the final DeFi transaction when calculating bridge amounts.Security & Non-Custodial Design Zero-Trust Architecture: The extension never has access to private keys or funds. All transactions are signed by the user's existing wallet, and we only intercept and analyze transaction data for optimization purposes.Transaction Simulation: Before executing any bridge or DeFi operation, the Nexus SDK simulates transactions to ensure they will succeed, preventing failed transactions and wasted gas fees.This project essentially creates a unified liquidity layer that makes multi-chain DeFi feel like single-chain DeFi, all while maintaining the security and decentralization that users expect.This covers the technical depth while focusing on the innovation and engineering challenges rather than code snippets! π₯
Hackathon
ETHOnline 2025
2025
Contributors
- shrinathprabhu
44 contributions
- ajaybutti
17 contributions
- decocereus
17 contributions
- svarcoder
6 contributions