← Back to home

Watchtower

Atomic Liquidation and Other Actions via 1-time Hooks 4 Sale on Uniswap V4

Problem Statement

Watchtower, a novel protocol for atomic price action triggered interventions. Uniswap V4 Hooks have allowed this protocol to react to price changes caused by executions of swaps. The reactions are atomic first-in-line without a possibility for anyone to intercept and front-run the reacting transaction.Watchtower allows for anyone to permissionlessly subscribe to desired price actions caused by swaps and and take advantage of the prompt atomic actions as desired. Such actions can be delinquent loan liquidations, limit orders, undercollateralized option and/or derivative liquidations and many other use cases.The implementation was facilitated by our One-time Hooks, which can be attached and detached dynamically to Uniswap V4 pools.Watchtower has an economic incentive model that is beneficial to all parties involved.

Solution

Pure Solidity to implement an elaborate Uniswap V4 hook that can manage dynamic "hooks".How does this work?In order to act on-chain, someone needs to initiate the contract call. This is not done by keepers, but byswapcallers on Uniswap V4. Unknowingly they can cause action trigger calls, which does not cost them anything and they are rewarded for this as well. The user simply visits the Web3 front end of Uniswap V4. As soon as they ask for a swap, the Uniswap V4 calculates a route for the most efficient execution of the swap. Multiple pools can be used, but almost no pool is left behind, as if that happens, the pool in question remains behind with a more favorable price and it becomes even more attractive.This is achieved via an Uniswap V4 Hook, attached to one of the above described pools. This hook can be used by multiple pools, as many as one would want. However this hook is quite complicated. As Uniswap V4 hooks are permanently attached to the pools, this hook:Manages a data structure of registered Watch-ers ("hooks for sale"; not Uniswap hooks). These Watch-ers can execute one-time, pay for this to both the swapper and the pool and drop off.As the price moves, it performs the proper calculation to efficiently trigger the appropriate Watch-ers in constant time ($O(1)$).Cleans up to avoid storage cost and get storage refunds.

Hackathon

ETHGlobal Taipei

2025

Prizes

  • 🏆

    Best Multi - chain App with Nodit's Web3 Data API2nd place

    Nodit

  • 🏆

    Uniswap v4 Hook Integrations1st place

    Uniswap Foundation

Contributors