Market Stop Loss Order Safe on CowSwap

Grant Title: Market Stop Loss Order Safe on CowSwap

Authors: Matthew Fogel, Lawson Graham, Sena Gul Hazir, Derrick Cui

About Us: We are a group of students at UC Berkeley with majors across Electrical Engineering, Computer Science, and Business. We are all senior members of the organization Blockchain at Berkeley, as well. Collectively, we have a significant amount of experience in the blockchain space through jobs, projects, and hackathons. We previously developed a production-level DeFi investment application on SUI, and we are familiar with designing and developing full-stack applications. We also have experience with Gnosis Chain and CoW Protocol from a user perspective.

Additional Information:

Matthew Fogel:

  • Matthew has worked at Nethermind as a Software Engineering and Research Intern, working on projects such as Voyager, a block explorer for StarkNet. He has also developed projects with Ava Labs (Avalanche) and IO Global (Cardano).
  • Linkedin
  • Github

Lawson Graham:

  • Lawson Graham was previously a founding engineer at Thala Labs and has interned at Martian Wallet. He also led the consulting at Blockchain at Berkeley.
  • Linkedin
  • GitHub

Sena Gul Hazir:

  • Sena has worked as technical analyst at Signum Capital and software engineering intern at Goldman Sachs. She has worked on grants projects with Osmosis and Aleo in the past building and designing DeFi tools.
  • Linkedin
  • GitHub

Derrick Cui:

Grant Category: Trading Related Applications

Grant Description:
RFP: RFP: Stop-Loss Order

DeFi markets can be highly volatile, and asset prices can experience significant fluctuations. This is a major deterrent for the majority of users in Web3. Therefore, a stop-loss order app would allow users to set predefined price levels at which their assets would be automatically sold if the price moves in an unfavorable direction. This is a common feature in centralized exchanges, but less so in DeFi protocols.

This application would enable users to create a Safe for the Market Stop-Loss orders. This contract has been implemented by the CoW development team, but we currently lack a user-friendly interface to use it. To read the current price on-chain and execute the order for designated stop price, the option to choose from a list of allowed oracles will be listed for the user (currently only ChainLink oracles are supported by the contract). Moreover, users would be able to view a list of open orders and executed orders and cancel existing orders before the stop price is hit. The executed orders would all be linked to their respective explorer link when it gets placed in the orderbook.

The RFP above lists more features of the Safe app. The project could also be extended to develop Trailing Stop-Loss, Stop-Limit, and Buy Stop-Loss Order contracts, upon success of this first implementation.

Grant Goals and Impact:

The creation of a Safe app with stop loss orders will achieve several critical goals that will have a substantial positive impact on the CoW Protocol ecosystem and its users. One of the primary goals of this project is to provide an enhanced risk management tool to allow users to protect their funds from unfavorable price movements. This will integrate more risk-averse users by providing a smooth user experience while also protecting their assets. This increased accessibility will provide more user adoption and growth within the CoW protocol ecosystem. By offering stop-loss order types and customization of price controls, the project will cater to a diverse set of trading strategies and risk profiles. As the CoW development team has recently finalized a smart contract for stop-loss order that supports the customization of oracle selection, we believe it is very much essential that this contract’s benefits could be utilized by a user-friendly and secure interface.

Milestones:

The following assumes a start date of January 22, 2024.

Milestone Due Date Payment
1 - Safe app development with initial frontend (functionality to setup Safe with fallback handler, build transaction for placing conditional order on-chain) February 26, 2024 $10,000 USD
2 - Extended functionality for oracle configuration and selection March 25, 2024 $5,000 USD
3 - Extended functionality for displaying open and past orders as well as option to cancel orders April 22, 2024 $5,000 USD

Funding Request:

We request a funding amount of 20k xDAI.

Budget Breakdown:

The funds for this project will be used towards product design, development, and research. We will have 4 engineers working ~10 hours per week each and the whole production will be finished in 3 months with the below timeline.

First Milestone Deliverables:

  • Design mockup for the following pages / flows: Safe setup, transaction builder, oracle configuration, order dashboard
  • Initial functional implementation for the safe setup and transaction builder
  • Extensive documentation of technical architecture plan so that future “Smart Orders” can build off of our work

Second Milestone Deliverables:

  • Using the technical architecture and design mockups, extend the functionality of our Safe to allow users to select the oracle that provides price data when placing a stop-limit order
  • Continued documentation and communication with the CoW development team

Third Milestone Deliverables:

  • Implementation of dashboard displaying the previous and current orders, including the option to cancel existing orders
  • Final adjustments after feedback as well as security checks

Gnosis Chain Address: 0x510950e2Fa9aEFDC47CE25528c6917B09d6E9bEe

Terms and Conditions:
By submitting this grant application, I acknowledge and agree to be bound by the CoW DAO Participation Agreement and the CoW Grant Terms and Conditions.

4 Likes

Nice! A follow up milestone could be to extend the existing stop loss smart order contract to trigger automated de-leveraging of debt positions in case the loan’s health ratio goes below a certain threshold. This could potentially avoid costly liquidations like https://twitter.com/API3DAO/status/1737918439136854410

But an easy to use safe interface for stop loss is a great start imo…

3 Likes

Dear Applicant,

Thank you for submitting your grant proposal. We are eager to review it. Please be aware that due to the recent renewal of our grants program and the holiday season, we are currently experiencing a delay in our review process. This may result in an extended timeline for the grants committee to establish their procedures and provide you with specific feedback. We appreciate your understanding and patience during this time.

1 Like

This sort of functionality and integration would be extremely useful to the both the SafeDAO and CowDAO community. I support this proposal.

1 Like