Grant Proposal: CoW Swap Golang client & DCA/TWAP Order System w/ Interface

CoW Grant

The following document is intended to structure and define the first of two deliverables:

1. CoW Swap Golang SDK/client
2. CoW Swap TWAP/DCA CLI bot/app (with no TWAP smart order functionality)


It is also important to discuss the future milestones that will allow us to realize the full impact of this grant; offering CoW Swap users an interface to create TWAP and DCA smart orders:

  1. DCA/TWAP smart order development based on existing MVP
  2. Smart contract audit (might be done with core team resources)
  3. Adding TWAP smart order functionality to the CLI
  4. CoW Swap TWAP UI

outlined in the grant proposal submitted by @itsahedge in the CoW DAO forum.

Grant Proposal (Section 1: Go SDK)

About the grantee

@itsahedge is a software engineer at GFX Labs and can be found on GitHub and Twitter.

Grant Category

Developer tools (SDK)

Proposal

Build a CoWSwap Golang SDK/client that interfaces with the API.

This is a breakdown of the first milestone in the outlined proposal. The deliverable of the grant consists of the Golang SDK, SDK documentation, and example implementation starter code for interacting with the Golang SDK.

With the Golang SDK, it will provide developers a quick and easy way to natively integrate CoW Swap into their Go applications, without having to build their own CoW Swap client or write their own API.

Grant Goals and impact

The goal for creating the CoWSwap Golang SDK/client is to make it as simple and easy to integrate into existing (or future) Go applications. A CoW Swap Go SDK would allow for a more fluid opportunity to integrate into trading systems, bots, or any infrastructure that is already utilizing Go or wishes to interface with the CoW Protocol.

Funding request

After some discussions, it is proposed to split the grant into several funding milestones:

1. CoW Swap Golang SDK/client ($10k: $5k upfront, $5k on completion)
2. CoW Swap TWAP/DCA CLI bot/app (with no TWAP smart order functionality)
3. DCA/TWAP smart order development based on existing MVP
4. Smart contract audit (might be done with core team resources)
5. Adding TWAP smart order functionality to the CLI
6. CoW Swap TWAP UI

The budget breakdown in the following section will only focus on the cost of milestone No. 1 at this point in time.

Budget breakdown of Section 1: Go SDK

$10k (10,000 xDAI): development / labor cost (payed $5k upfront, $5k on completion)

Timeline

The estimate timeline is broken down in the following way:

  • Week of Nov 8 → During this week, the grantee and grants committee will discuss the contents of this document to iron out the final details to be included in the agreement.
  • Week of Nov 13 → During this week, the CoW Grants DAO will provide the first installment of 50% of the grant. The grantee will start the development and testing of the Golang SDK.
  • Week of Nov 20 → During this week, the grantee will continue with the development and testing of the Golang SDK and start drafting the Go SDK documentation.
  • Week of Nov 27 → Upon the completion of the Golang SDK, completed documentation, and example implementation/code snippet of the Golang SDK, the CoW Grants DAO will proceed to pay the outstanding amount of the grant.

Milestones

Each milestone is to be completed in due time and to be reviewed by the technical team at CoW Protocol. In the event that the code needs changes, milestones and timeline will be affected.

Milestone Section Milestone Specific Action Performed Date Link
Golang SDK Allows users to create a new order - - -
Golang SDK Allows users to get existing order from UID - - -
Golang SDK Allows users to cancel orders from UID by marking it invalid with timestamp - - -
Golang SDK Allows users to cancel and replace orders with a new one - - -
Golang SDK Allows users to get orders by settlement transaction hash - - -
Golang SDK Allows users to get existing trades - - -
Golang SDK Allows users to get the current batch auction - - -
Golang SDK Allows users to get orders of one user paginated - - -
Golang SDK Allows users to get native price for the given token - - -
Golang SDK Allows users to fetch quoted price and fee for the specified order parameter - - -
Golang SDK Allows users to get information about solver competition by auction id - - -
Golang SDK Allows users to get information about solver competition by transaction hash - - -
Golang SDK Allows users to get information about current deployed version of the API - - -
Golang SDK Proper response & error type definitions - - -
Golang SDK Allows users to use the SDK on Mainnet, Goerli & Gnosis Chain - - -
Golang SDK Allows users to easily sign orders - - -
Golang SDK Allows users to use the subgraph from the Golang SDK - - -
Golang SDK Allows users to check and set token allowance for trade with GPv2 Vault Relayer - - -
Documentation Provide documentation for interacting with CoWSwap Go SDK - - -
Documentation Provide example code snippet for implentation & use of the Go SDK - - -

Gnosis Chain Address (to receive the grant):

0x33A6415cC6d315B29Ef8F859D84766600b313E8F

Referral

This project has been the culmination of discussions between myself, Master_Cow, Middleway and Netrunner.

Terms and conditions

By applying for this grant, the grantees agree to be bound by the CowDAO Participation Agreement and the COWDAO Grant Terms and Conditions.

Final Grant Agreement signal

Since the original application has slightly changed, this document serves as the final version of the grant description, milestones, funding and more, as well as a forum poll on https://forum.cow.fi where only the grantee, and the grants committee will be able to vote on it. The vote will serve as the final confirmation for the acceptance of the details found in this document.

1 Like

This looks very interesting and agree that building more tools to improve integration into other trading systems/infrastructure a good way to grow the CoW Protocol.

If the rest of the committee approves, the funding would be broken up into smaller batches, with final payment likely contingent upon the team accepting the CoW Swap Golang Client & DCA/TWAP Order System w/ Interface.

Hi @itsahedge,

Thank you for writing this proposal, it sounds very interesting.

In order for the committee to be able to judge better your skillsets for completing this grant (If approved), can you share a public github repo with past work? or something that can demonstrate the you do have the skills required? Dont get me wrong, I trust you past job experience, but this is just a prevention measure.

That said, give the committee some time to evaluate the proposal and get back to you asap.

Kind regards #Mooo

I have updated the original post with my Github profile

1 Like

Hey @itsahedge, welcome to the CoW forums!

I generally like your proposal and I think it contains several value adds to the CoW ecosystem. I agree that more sophisticated order types and and execution strategies are needed and could attract many traders to use CoW Swap.

It is not entirely clear to me why a golang client is necessary / beneficial. Would love to get your view

Do you think it is possible to structure the proposal without the golang client? focusing on the DCA and TWAP interface and tooling?
(I’m not opposed to developing a client but just trying to understand the value and why golang would be the best choice. Also trying to understand if we can separate the development of the client, interface and CLI to independent milestones)

Hey @middleway.eth thanks for the response!

The idea for building the Golang client would be the same reason people build SDK’s for Nodejs or Python - because those are commonly used tools/languages. When it comes to building with Ethereum, there is an official Go Ethereum client. And since it’s quite easy to work with Ethereum given the official go-ethereum client, it makes it easy for Go developers to plug and play with interacting with Ethereum.

Providing a Go client for CoW Swap would make it super easy for any Go developer to integrate CoW Swap into their applications, without having to build their own CoW Swap client or write their own API.

If the committee would like me to re-structure the proposal without the Golang client that’s no issue, but I believe it will be valuable to the developer ecosystem for those wanting to easily interact with CoW Swap.

Here’s a more clear/detailed outline of independent milestones:

Completed Client

  • Build & implement client
  • Documentation & code examples of using the client

Completed CLI

  • Build the API that handles DCA/TWAP orders
  • Use the API to execute DCA/TWAP orders
  • Build & Implement as a CLI program
  • Documentation & examples of using the CLI program

Completed Interface

  • Design & Build DCA/TWAP order interface
  • Implement API for DCA/TWAP orders
  • Documentation & example of interacting with the interface along with running the interface locally.
2 Likes

The OP was edited to reflect the latest state of the proposal that outlines the milestones in a high level and focuses on a detailed definition of the first milestone.
This will allow the grantee to start working on the first milestone while details of next milestones are fleshed out.

If there’s agreement from the grants committee, payment of the first milestone can be processed.

2 Likes

I agree with the changes. This proposal has my support.

2 Likes

Just updating that the first milestone of this grant was approved and payed:

@itsahedge would appreciate regular (weekly?) updates on your progress, any specific blockers etc
Ideally just as a comment to this thread :pray:

2 Likes

Working repo: github.com/itsahedge/go-cowswap

2 Likes

Here is the finished CowSwap go client. Devs feel free to test!

https://github.com/itsahedge/go-cowswap

https://pkg.go.dev/github.com/itsahedge/go-cowswap

3 Likes

Love the repo name - Go CoWSwap!

3 Likes