LongPlay: Automated Liquidity Management Flow

👤
User
LP Provider
🪝
Uniswap v4 Hook
Price Tracker
🛡️
AVS Service
EigenLayer Validator
⚙️
Operator
Off-chain Executor
1
Position Configuration User → AVS

User configures their position with a tick threshold and strategy choice (e.g., supply to Aave). Pays a flat service fee (0.0001 ETH) and approves AVS to manage position.

configurePosition(tickThreshold, strategyId, positionId, posM, ...)Event: PositionConfigured
2
Price Movement Detection Hook

On every swap, the Hook tracks price changes by comparing current tick with last tick. When movement detected, creates a task for the AVS service.

afterSwap() → getCurrentTick() → createNewTask()
3
Task Emission AVS Service

Service receives task from Hook and emits WithdrawNeeded event with pool context, last tick, and deadline for operator to process.

createNewTask(poolKey, lastTick, deadline, poolId)Event: WithdrawNeeded
4
Position Discovery Operator

Operator listens to WithdrawNeeded events, computes eligible tick thresholds between lastTick and currentTick, discovers all matching user positions from cache.

computeThresholdBounds() → discoverValidPositions() → loadConfigs()
5
Liquidity Withdrawal & Strategy Execution Operator → AVS

Operator signs and calls withdrawLiquidity with validated configs. AVS burns LP positions, realizes token balances, and executes chosen strategies.

withdrawLiquidity(task, taskIndex, configs, signature) burnPosition() applyStrategy()Event: PositionBurned
6
Strategy Application AVS → DeFi Protocol

Based on user's configured strategy, AVS supplies withdrawn assets to external protocols (e.g., Aave) or executes other strategies. User can opt-out anytime via cancelDelegation.

AAVE_POOL.supply(asset, amount, onBehalfOf, ...)Event: SupplySuccess/SupplyFailed