VortexAI

Automates rebalancing of multi-range positions around the current price

VortexAI

Created At

HackMoney 2026

Project Description

A DeFi fund (e.g., a DAO) deploys VortexAgent to manage liquidity in a volatile token pair like ETH/USDC. The agent monitors price via an oracle (e.g., Chainlink) and rebalances ranges to concentrate liquidity near the current tick, maximizing fees. This project ensures we have programmatic interaction with v4 pools, onchain state usage, reliability (atomic operations), transparency (auditable contract), composability (integrable with other agents/oracles)

How it's Made

Tech stack: Foundry (Solidity 0.8.26, Cancun EVM, via_ir), Uniswap v4-core, Solady, forge-std. Architecture: VortexAgent is an ERC721 (Solady) position manager that implements IUnlockCallback. It uses Uniswap v4’s PoolManager.unlock() so that add/remove/rebalance are all done in a single atomic unlockCallback. For per-position range storage it uses Solady’s RedBlackTreeLib, which does not support key 0, so int24 ticks are encoded with TICK_OFFSET = 887273 to map them to non-zero uint256 keys. Ranges and liquidity are stored in _positionTrees and _rangeInfo, and each range has a deterministic salt keccak256(abi.encode(tokenId, tickLower, tickUpper)). OptionalHook: A Uniswap v4 hook that charges 0.01% on add/remove when the caller is VortexAgent, using afterAddLiquidityReturnDelta and afterRemoveLiquidityReturnDelta. Uniswap v4 chooses which hooks to call from the contract’s address bits, so the deploy script notes that mainnet needs CREATE2 to target an address with the right permission bits. Partner tech: Uniswap v4-core provides the unlock flow, modifyLiquidity, and BalanceDelta settlement. Solady’s RedBlackTreeLib gives O(log n) tick tracking. Foundry handles tests, scripts, and deployment.

background image mobile

Join the mailing list

Get the latest news and updates

VortexAI | ETHGlobal