Inspiration

Trading tools are an important part of every DeFi ecosystem as it allows traders to remove imbalances and inefficiencies between and in different protocols. We saw that there is a lack of such tools on Celo and decided to build a simple margin trading tool, as such instrument is on the most popular for traders together with futures, options and perpetuals

What it does and how it works

Let's say a user wants to open 3x long position cUSD against CELO and has $1000 cUSD in his wallet.

  1. User approves $1000 cUSD to Solaris Margin Contract and delegates a credit line of $2000 in CELO (via Moola v2 credit delegation feature)
  2. User asks our smart contract to create 3x long position. The contract does the following actions on behalf of a user to create a long position:
    1. Takes $2000 cUSD flashloan on Moola
    2. Pulls $1000 cUSD from user's wallet and swaps $3000 cUSD to $3000 CELO on Ubeswap
    3. Deposits $3k CELO as collateral to Moola and borrows $2000 cUSD + .35% flashloan fee
    4. Returns $2000 cUSD flashloan + .35% flashloan fee
  3. As a result the user has $2000 cUSD debt and $3k CELO as collateral - 3x long leveraged cUSD -> CELO position. Than, for example he/she can create a limit order for it which when executed will close this position. Adding limit orders is the next step for us

How we built it

We worked on this idea in Celo Camp. As the first step we interviewed traders if they need tools like this and why. Then we defined a minimum set of features that should be in MVP and built the app.

Challenges we ran into

We ran into three challenges: 1) A problem with debugging contracts on Celo (we've found a workaround finally) 2) Price difference between Moola oracle on testnet and Ubeswap price (we did a kind of arbitrage bot to make these prices almost equal) 3) It was hard to track user's positions in a smart contract without limit orders.

Accomplishments that we're proud of

We built it finally!

What we learned

We learned how to build on Celo, met a lot of people from Celo community. It was great experience.

What's next for Solaris Margin

Get 100 users that are interested in using our app Add limit orders to create seamless experience for traders Add isolated margin trading based on Kashi

Built With

Share this project:

Updates