project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4

Uniswap V4 Hooks - Stop Loss Orders

Onchain stop loss orders courtesy of Uniswap V4 Hooks. Guaranteed execution offers great UX for spot traders, leveraged positions, and protocols

Uniswap V4 Hooks - Stop Loss Orders

Created At

ETHGlobal Waterloo

Winner of

trophy

🥇 Compound Grants Program — Best Use

trophy

🥇 MakerDAO — Best Use

Project Description

Stop loss orders: "if the price falls below a trigger price, market sell the asset"

With the Uniswap V4 preview, hooks introduced programmability to the swap lifecycle -- this feature creates new opportunities for trading UX. For the hackathon, I decided to implement onchain stop loss orders.

While stop loss functionality can be built with external actors, there are trust assumptions around execution. Enabling onchain stop loss orders results in guaranteed execution -- to the benefit of all participants. For example, this order type can supercharge leverage users by trustlessly procuring funds for debt repayment. Protocols could also adopt stop loss orders to facilitate liquidations (assuming additional safety checks for market depth) -- instead of relying on external liquidators.

How it's Made

Just another classic foundry repo -- 100.0% solidity.

The project defines a Hook contract which will enable new V4 pools to support stop loss orders. To showcase potential use-cases, the project includes example orders that are used to repay loans on Spark (MakerDAO) and Compound III.

background image mobile

Join the mailing list

Get the latest news and updates