project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

4DLimitOrder

4-dimensional limit orders, are an extremely novel, simple, and powerful new order type. They are intuitive, and can replace many other order types, as well as do things previously impossible.

4DLimitOrder

Created At

ETHGlobal Istanbul

Winner of

CoW Protocol - CoW Programmatic Framework 2nd Place

Project Description

In this project, I used CoWSwap Programmatic Orders Framework, to develop a totally new type of limit order. Normal limit orders take:

  • amount to trade
  • a time window
  • a fixed price target

4-dimensional limit orders take:

  • amount to trade
  • a time window
  • a target price which can change over time

This simple addition means that you can more accurately model your trading intents. 4D Limit orders are flexible enough that they are a superset of many other order types, including: normal limit orders, market orders, dutch auctions, normal auctions. With a single 4D Limit order you can even model more complex preferences, such as an increasing time-preference. If we open up to 2+ 4D Limit orders, you can automatically trade an ascending channel pattern (buying low and selling high). Previously this would require coding skills to build a bot.

How it's Made

The code for the order type itself is in my fork of the CowSwap/composable-cow github repo (for easier development setup). there are unit tests for it, as well as a deployment script to test it out and run orders.

The order is deployed on Gnosis Mainnet, at: 0x1989fd64aa8883c221f5c09ef58d673347a4c3cf (https://gnosisscan.io/address/0x1989fd64aa8883c221f5c09ef58d673347a4c3cf)

Below, I've linked the order execution script, which creates a simple 4D Limit order (acting as a delayed market sell), to show how to set one up. But there are a few other files in the repo as well (see the commit log).

  • Setup script: https://github.com/earlyxyz/composable-cow/blob/main/script/submit_SingleLimit4D.s.sol
  • Order type code: https://github.com/earlyxyz/composable-cow/blob/main/src/types/Limit4D.sol

Future Work: I had started to build a small frontend visual order-building tool, but ran out of time, so I'd love to continue that, and finish it.

background image mobile

Join the mailing list

Get the latest news and updates