coinbase / coinbase/agentkit

feat: Add Uniswap V4 liquidity management actions

Open
#955 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.3k
Forks
815
Avg merge
13h 31m
Merged PRs (30d)
2

Description

## Summary

Add liquidity management actions to the Uniswap V4 action provider, enabling agents to mint, increase, decrease, and collect fees from V4 liquidity positions via the PositionManager contract.

## Motivation

The current V4 provider (PR #951) only supports swaps and quotes. Liquidity provision is a core DeFi primitive and the PositionManager address is already stored in our constants. Adding LP management would make the V4 provider feature-complete.

## Proposed Actions

| Action | Description |
|--------|-------------|
| `add_v4_liquidity` | Mint a new liquidity position with specified price range and amounts |
| `increase_v4_liquidity` | Add more liquidity to an existing position |
| `decrease_v4_liquidity` | Remove liquidity from an existing position |
| `collect_v4_fees` | Collect accumulated swap fees from a position |
| `get_v4_position` | Query details of an existing position (liquidity, fees owed, price range) |

## Implementation Notes

- Uses the PositionManager contract (already in constants)
- Positions are ERC721 NFTs (same as V3 but through new PositionManager)
- Need to handle tick math for price range specification
- Agent should help users select appropriate price ranges based on current pool price
- Support both native ETH and ERC20 token pairs

## Dependencies

- Builds on the V4 action provider from PR #951
- PositionManager ABIs needed (partially available in V4 periphery)

## References

- [Uniswap V4 PositionManager](https://docs.uniswap.org/contracts/v4/concepts/position-manager)
- [V4 Periphery Source](https://github.com/Uniswap/v4-periphery)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.