OmyBot

AI agent that autonomously manages your Uniswap v4 LP positions so you don't have to.

OmyBot

Created At

HackMoney 2026

Project Description

Most liquidity providers on Uniswap lose money. Concentrated liquidity means better capital efficiency, but it also means your position goes out of range the moment the market moves — and suddenly you're earning zero fees while eating impermanent loss. Managing it manually is a full-time job: watching prices, pulling liquidity, re-centering your range, collecting fees, repeat.

OmyBot takes that job off your hands. It's an autonomous AI agent that manages the entire LP lifecycle on Uniswap v4: minting concentrated positions, watching the pool in real time, and automatically rebalancing when the price drifts too far toward the edge of your range. When it's time to act, it executes everything atomically in a single transaction — removes the old position, mints a new one centered on the current price, and sweeps any leftover tokens back to your wallet.

Under the hood, the agent reads live pool state (current tick, price, liquidity depth) every 15 seconds and makes a decision: hold, collect fees, or rebalance. It starts with a reliable rule-based strategy, but can optionally use a PPO reinforcement learning model trained on real Base mainnet swap data to make smarter decisions about when to rebalance and how wide to set the range.

For the demo, everything runs on an Anvil fork of Base mainnet with simulated market activity, so you can watch the full cycle happen end-to-end: position minted, price moves, agent detects drift, rebalance fires, new position appears — all with a live dashboard and full decision logs.

How it's Made

This project started as a question: can you build an LP manager from scratch in a weekend, with AI doing most of the heavy lifting?

The first thing we did was launch a team of 6 AI research agents using Claude Code's agent teams feature. Three agents ran in parallel investigating Uniswap v4's new PositionManager API, the ML pipeline design, and data indexing with Subsquid. Once they finished, three more dove into hook contract design, agent architecture, and integration planning. In about an hour, we had a 50-page research document with exact function signatures, code snippets, and gotchas — like the fact that V4 has no collect() function (you fake it with a zero-liquidity decrease), or that the PositionManager isn't ERC721Enumerable so you need to track your token IDs yourself.

With the research blueprint in hand, we used Claude Code and OpenAI Codex agents working in parallel to build the actual system. The Python agent has three core modules: a state reader that queries V4's StateView contract for real-time pool data (tick, sqrtPriceX96, liquidity), an LP manager that hand-encodes PositionManager commands using raw eth_abi (there's no Python SDK for V4 LP operations, so every mint/rebalance/fee-collect is assembled byte by byte), and the decision loop that ties it all together.

The trickiest part was getting the V4 command encoding right. Each LP operation is a batch of action codes — MINT_POSITION, DECREASE_LIQUIDITY, CLOSE_CURRENCY, SWEEP — packed into a single modifyLiquidities() call. Getting the ABI encoding, the Permit2 approval chain, and the native ETH value forwarding all working together took multiple iterations and careful cross-referencing against V4's actual Solidity source.

For the ML layer, we built a custom Gymnasium environment that simulates LP management using historical swap data from Base. A PPO agent (Stable-Baselines3) learns a 4-dimensional continuous action space: how wide to set the range, how much liquidity to deploy, and when to pull the trigger on a rebalance. The trained model plugs into the live agent as an optional brain — if the model outputs something unreasonable, the agent falls back to rule-based logic automatically.

The E2E harness (run_e2e.py) orchestrates the whole demo: spins up an Anvil fork of Base, funds the agent via whale impersonation, starts the agent loop, fires simulated swaps to move the price, and verifies that mints and rebalances actually happen. A Flask dashboard (run_demo.py) lets you watch it all in real time.

Technologies used: Python, web3.py, eth-abi, Uniswap v4 (PositionManager + StateView on Base), Stable-Baselines3 (PPO), Gymnasium, Foundry (Anvil), Flask. Built with Claude Code agent teams + OpenAI Codex for parallel AI-assisted development.

background image mobile

Join the mailing list

Get the latest news and updates

OmyBot | ETHGlobal