AI agent finding investment opportunities via Uniswap & Li.Fi using a hub-and-spoke state channel.
OmniSwap Agent is an autonomous, cross-chain liquidity manager that bridges the gap between high-level AI reasoning and low-level DeFi execution. In today's fragmented ecosystem, capital is often trapped on a single chain, missing out on yield opportunities elsewhere due to the complexity of bridging and manual swapping. Our project solves this by deploying a fleet of autonomous AI agents that act as professional fund managers for your personal vaults.
How it works: The agent utilizes Llama 3.1 via Groq to perform continuous market analysis. It scans vault balances across Ethereum Sepolia, Base Sepolia, and Arbitrum Sepolia to identify "yield gaps." When an opportunity is found, the agent doesn't just send a notification—it executes. Using the LI.FI Protocol, it routes assets across chains via the most efficient paths.
The Uniswap v4 Innovation: What sets this project apart is its integration with Uniswap v4 Hooks. Unlike traditional bots that require multiple transactions to bridge and then swap, our agent uses a custom "Hook-Receiver" vault. When funds arrive on a new chain through a bridge, a v4 Hook is automatically triggered to swap the incoming bridge asset (like USDC) into a specific target asset (like WETH) in a single atomic-like sequence. This ensures that the agent's strategy is fulfilled the moment the funds land.
Why it matters: This project represents the shift toward "Agentic Ethereum"—where smart contracts are no longer passive tools but active participants. By combining AI decision-making with the programmability of Uniswap v4, we have created a system that maximizes capital efficiency while abstracting away all the "crypto complexity" from the end user.
The Architecture: Our project is built as an autonomous closed-loop system, integrating high-level AI reasoning with low-level blockchain execution. We used Viem as our core library for multi-chain state orchestration, allowing our agent to simultaneously monitor Ethereum Sepolia, Base Sepolia, and Arbitrum Sepolia. The agent runs a perpetual "Scan-Think-Act" cycle. During the scanning phase, it queries our custom-deployed Solidity Vaults to aggregate a real-time global view of our liquidity.
The Intelligence Layer: We leveraged Groq’s Llama 3.1 models for the agent's decision-making engine. We chose Groq specifically for its ultra-low latency inference, which is critical when analyzing volatile DeFi markets. The "nitty-gritty" of our AI logic isn't just a simple prompt; we engineered a JSON-structured feedback loop. The agent receives raw blockchain data and must output a strictly formatted execution plan. We implemented intelligent guardrails within the prompt to ensure the agent performs gas-cost-benefit analysis—preventing it from attempting a swap if the transaction fees exceed the potential yield gain.
Cross-Chain & Execution Logic: The bridge execution is powered by LI.FI. A key technical hurdle was handling testnet fragmentation. To solve this, we utilized the LI.FI Staging API, which allowed us to access specialized testnet routes that standard production APIs often omit. For the "Actuator" phase, we didn't just move funds; we pioneered a dynamic bridging strategy. By using USDC as a "Universal Bridge Asset," we ensured 100% route availability across all three Sepolia chains.
The "Hacky" Notable Mention: One particularly notable "hacky" but effective solution was our Uniswap v4 Hook Integration. On the destination chain, our vaults aren't passive recipients. We wrote a custom onFundsReceived hook that intercepts incoming bridge transactions. In a single atomic-like sequence, the vault identifies the incoming bridge asset and triggers a Uniswap v4 swap to the final target token (e.g., WETH). This effectively bypasses the need for the agent to sign a second "swap" transaction on the destination chain, significantly reducing the "time-to-yield" and gas overhead.

