RFP: Stop-Loss Order


CoW Protocol allows “Smart Orders”, that is on-chain orders with arbitrary validation logic that is executed at settlement time. One application

This would allow users to place stop-loss orders, selling positions on certain tokens when the market price goes below a certain threshold, i.e. the “stop price”.

Furthermore, this can be implemented entirely externally to the core protocol and would provide a good starting point for future CoWmoonity “Smart Orders”.

TODO: Can probably have a better introduction, I don’t know what other information is useful for a grant RFP.


An initial stop-loss order type that only supports ChainLink oracles has already been implemented and deployed here: https://gnosisscan.io/address/0x0a5851524e638edf1652010c7e6fb50c81d70977. A version that supports custom “price oracles” is being developed and will be provided by the CoW development team. Effectively, implementing the actual order Solidity code is outside the scope of the grant.

The grant would specifically cover the work to create a Safe app for using these stop loss orders. Notably the Safe app is required to:

  • Create transactions for setting up a Safe for the conditional order framework (that is, setting the appropriate fallback handler which is required for the conditional order framework).
  • Configure a price oracle for reading the “stop price” on-chain from a curated list of oracles. Tentatively:
    • ChainLink
      • Note that UI should restrict swap tokens the the supported ChainLink pairs
    • Uniswap (V2/V3)
      • Unclear if we actually want to include this or not
  • Build the appropriate transaction for placing a conditional order on-chain
    • This includes setting required approvals to the CoW Protocol for the order
  • Display open and past orders, with links to the explorer once the order gets included in the orderbook (after the stop price is hit)
    • Since the orders are created with on-chain transactions, this data can be retrieved from the blockchain
  • Cancel existing orders.
  • Support for Ethereum and Gnosis Chain (we use Görli as a test network)