Inspiration

I've always been interested in decentralized exchanges where users hold their own tokens and settle trades on chain so I decided to start Cirrus Swap.

When more SRC tokens come on the Cirrus sidechain, it will be important for users to be able to exchange them for others. This will help the token economy thrive.

About Cirrus Swap

The Cirrus Swap project consists of 4 smart contracts at the time of writing this and a UI built with Angular and Electron. The UI creates a clean user experience for swapping SRC for CRS tokens and hooks into the existing open ports to the Full Node that Cirrus Core uses. So, users only need to open Cirrus Swap UI with Cirrus Core wallet open to immediately being trading.

The four contracts included are BuyOrder, SellOrder, Orders, and JsonConfig. View the CirrusSwap Github repository to view documentation on each contract.

Each contract is fully tested using XUnit and Moq letting devs feel at ease if and when making changes.

Challenges

Early challenges were gas fees and limits, once I realized smart contracts don't work well when used similarly to a micro-service architecture, I knew I needed a UI to assist the user.

Then order books then became an issue, I didn't want users to have to manually post their orders somewhere for others to fill. I needed a quick solution and turn around, I created the Orders contract. The frontend adds newly created orders here after a successful creation. It then pulls the logs on interval, filters and calls each order contract to get the latest details.

This quickly becomes a scaling issue, there is no way hundreds of orders can be fetched on interval on each users machine. For now, this will do, with only the MEDI token coming soon and this still in beta, it will work. The new solution would be to have users update their orders on the order book after every interaction. This causes the users to pay gas for one more call, but overall will create a better experience.

User Interface

The UI for Cirrus Swap makes it easy for users to create, find, and fill orders. It chains the necessary calls for each action as well making simple actions such as placing an order extremely easy. One submission will create an order, set an allowance on an src contract, and log the order to an order book for example. These 3 calls, could take users minutes to do manually and leaves a lot of room for error.

Still very early beta, the UI has a lot of improvements and unfortunately, bugs to fix. The UI is not production ready but over the next few months, should be. The ultimate goal is to get this to Cirrus MainNet by Spring 2020 which is reasonable if I am working alone. With community contributions, it could be much sooner.

Built With

Share this project:

Updates