Video thumbnail

Coupled Markets

DeFi Innovation: Coupling of Uniswap V4 Hook with AI Agent. Allows for improving the returns for the liquidity providers while maintaining market rate swap rates for all attached liquidity pools. Unique to our design: Minimal gas cost for swappers despite rich hook functionality

Coupled Markets

Created At

Agentic Ethereum

Winner of

Coinbase Developer Platform - AgentKit Pool Prize

Prize Pool

Project Description

Our project protects Uniswap V4 liquidity providers from IMPERMANENT LOSS and ASSURES MARKET-LEVEL SWAP rates for the swappers in those pools. The swappers suffer no gas cost for complex functionality introduced by Uniswap V4 hooksThis has been the downside of complex hook designs in the past.

Our project consists of a combination of a Uniswap V4 Hook and a HookAgent which is authorized to interact with the Hook. This combination allows for improving the returns for the liquidity providers while maintaining market rate swap rates for all liquidity pools which attach to the Uniswap V4 Hook.

Similar functionality has been developed in the past with complex hook functions that react on oracles or functionality that is running inside AVS systems. However, these approaches suffer often from high complexity and high gas cost that are born by the swappers in the pool.

Our hook will typically be tied to liquidity pools that serve as secondary markets servicing utility demand rather than investment, for instance users that need ETH or other utility tokens for gas, or currency conversion for cross boarder payments.

As initial functionality, we are building a liquidity pool coupled to a Coinbase market, namely offering liquidity for assets at prices that are close to the Coinbase market price. The flow is as follows:

  • The HookAgent queries for market rate for the pool swap pairs under his control
  • Whenever he finds a pool which is away from the market, he sets a one-sided damped rate for the hook. This rate is still better than the market rate but less detrimental to the liquidity providers than the market rate.
  • The agent posts the information on X and other channels to attract arbitrageurs who bring the normal pool rate again back to market.
  • Arbitrageurs or the Agent himself can come in to do this if they have liquidity or access to the counterswap on- or offchain
  • The gain from the damped swap is cashed in by the hook himself. He uses it to fund his cost but mostly redistributes it to the liquidity providers
  • When a pool is not out of balance any more, the agent resets the damping in the pool through the hook

How it's Made

Our project is based UniswapV4 Hook contract which is built from scratch and Agent developed with the Coinbase AgentKit framework.

We have built a solidity smart contract and deployed on Base Sepolia at 0x42Ea1FCDD265AB450936aCcAa6A10a82561a5044. We have used the Foundry framework and performed extensive unit and integration testing. All is documented in our repo. The Hook contract integrates with the Uniswap V4 protocol deployment in Base Sepolia

We have done several attempts for the agent which are also in the GitHub repo. The most complete version is the agentkit Typascript version. It has major additions to the agentkit template: (1) AgentHook Service-Providers which allows the agent to read and write on the hook contract (2) Service-Providers which allow the agent to perform swaps and liquidity position modifications to arbitrary pools attached to Uniswap V4. (3) Action-Providers for allowing the steering of the bot from the prompt (4) Action-Providers for swappers and liquidity providers for steering from the prompt

Further additions and optimizations are necessary on the agent going forward.

background image mobile

Join the mailing list

Get the latest news and updates