UniswapV3 limit orders

UniswapV3 provides a very cool feature called concentrated liquidity and range orders.

Imagine that using those cool feature we can implement a limit order on top of UniswapV3 that allows to do limit trades, but not using swaps, rather using the range orders feature as mentioned in the Uniswap guide:

https://docs.uniswap.org/protocol/concepts/V3-overview/range-orders

One important distinction: range orders, unlike traditional limit orders, will be unfilled if the spot price crosses the given range and then reverses to recross in the opposite direction before the target asset is withdrawn. While you will be earning LP fees during this time, if the goal is to exit fully in the desired destination asset, you will need to keep an eye on the order and either manually remove your liquidity when the order has been filled or use a third party position manager service to withdraw on your behalf.

That means only we have to do monitor and exit the liquidity when the order has been filled using a third party position manager service.

Sounds simple enough, but how can to implement such third-party position manager service, scalable and profitable for the users and the 3rd party manager service.

  1. First need to implement a smart contract that open a range order position on users behalf. This is as simple as using the UniswapV3 smart contract API.
  2. Second, need to implement a check for exit conditions of the range order and remove the liquidity when the order has been filled. The tricky part is checking for the exit condition when the spot price crosses the given range.
  3. Third, trigger the exit condition contract check from outside automation network every now and then, since smart contract cannot trigger functions themselves.

By implementing those 3 points, we can build a third party position manager service that monitors and removes liquidity on user's behalf when the range order has been filled.

This is so simple and already explained in the Uniswap documentation.

The complication is how to compensate for the associated gas cost of removing the position that needs to be paid somehow. And this is where the third party position manager services will compete among each other who will provide better services to its users i.e who will manage the liquidity better on user's behalf.

Disclaimer: Member of Kromatika Finance, a third party position manager service for UniswapV3 range orders.

UniswapV3 limit orders