Inspiration

Trading ERC20 tokens from one cryptocurrency to another is commonplace these days. However, trading large amounts of tokens does not guarantee exact exchange rates and the amount lost in transaction fees, gas fees, etc. is called slip. We realized that since slip does not occur in small trading amounts, we can split the large sum into smaller amounts so that we hit a sweet spot between minimum slip and gas fees. This idea resulted in our product, SlipSwap.

What it does

The front end is a simple web page asking you for some information: The 2 tokens you wish to swap between, and the amount you need to swap. Click the submit button and you will receive a list of transactions to be performed to minimize the slip to swap the tokens.

How we built it

The first thing we did was brainstorm for an algorithm that finds the exact split amounts. We thought of simple differentiation but that would mean assuming that the split amounts would be the same, which might not be the case. Hence we came up with a better dynamic programming solution (thanks to competitive programming practice). The next thing was to set up a server that would run the algorithm. Finally, since we had time remaining, we also threw in a decent front end to demonstrate the product.

Challenges we ran into

Most of our time went into formulating the algorithm that would result in a profitable split amount. Once that was down, we tried to implement it in a time and space-efficient way so as to serve requests as quickly as possible.

Accomplishments that we're proud of

Coming up with a complex algorithm from scratch and being able to implement it too.

What we learned

We learned about the problem of slip prevalent not only in the cryptocurrency exchange scene but also in normal currency exchanges. We are glad we could provide a decent solution to the problem.

What's next for SlipSwap

Currently, the algorithm is at its peak performance but is slowed down by too many RPCs to the Kyber exchange service. A distributed solution for the same(e.g making the RPCs from 2-3 Kubernetes pods and then aggregating the results for further use) would result in better scalability and in turn better user experience and onboarding.

Share this project:

Updates