dSynths v3 Progress Report

dSynths is a 3rd-party exchange building on the DEUS v3 architecture layer. This report outlines the latest developments and upgrades.

dSynths
DEUS Publication
6 min readFeb 24, 2023

--

21.02.2023

Over a month has passed since our V3 Alpha launch and it’s been overwhelmingly insightful. P2P Bilateral Agreements aren’t a set of magical contracts with mathematical wizardry, instead, it’s a system composed of an intricate balance between on-chain & off-chain actors. Every bug that’s been reported since our launch was directed at either the v3-core contracts and its peripherals, the dSynths frontend, the dSynths backend indexing solution, or the hedger operations. This report aims to address what’s been fixed, and what’s still ahead of us!

Contracts

The v3-core contracts have been pretty stable throughout the testing period. We’ve tried to minimize the number of features & configurability, allowing us to focus on the system’s core mechanics. For instance, users are strictly limited to Market orders, and the overall flow of processing RFQs and Close Requests is simple in nature. This is also beneficial to our hedger in order to stabilize data flow and operations.

  • Hedgers now have the ability to use a preferred amount of margin that they’re willing to lock inside of a position, whereas initially they were bound to the same amount that their bilateral counterpart provides. This allows them to manage their risk accordingly, while also having the ability to allocate their capital as they please.
  • To maintain the health of open positions and in order to not get liquidated, hedgers & users are able to top up their margin (named “free margin”). Initially, the funds used for this operation are the same funds used to open positions. Our hedger got affected by this mechanism by opening positions until it had no more margin left. Subsequently, it didn’t have any money left to maintain its health, forcing several liquidations. Since our update, free margin is now taken from a different balance slot, allowing a hedger to manage its balances more easily.
  • Patched some issues with the Liquidations and the Liquidation Oracle.
  • Trading sessions are more troublesome than initially thought. Assets within the same sector can still have slightly alternating trading sessions. For starters, this poses an issue between hedgers and the veto oracle (e.g. a hedger getting unrightfully punished for XYZ because he and the oracle report different trading sessions). Secondly, liquidating a cross-user that has out-of-session positions is again troublesome for the hedger. We will be addressing this in a later release.

In the next iteration of improvements, more features will be added, particularly supporting Limit orders and implementing static funding formulas. Additionally, we’re looking to support delegate contracts that can trade on behalf of users, e.g. a use case that dSynths is particularly interested in.

Hedger Engine

We’ve had to make surprisingly few modifications & patches to the hedger engine. Core mechanics have proven themselves to be stable, and race conditions between nodes were dealt with accordingly.

  • The biggest upgrade was in regards to the update on the core contracts where hedgers can manage their free margin more easily. We’re running a 24/7 bot that monitors our positions and moves money around accordingly. Right now he’s targeting to have 0.33$ in free margin available for every 0.67$ allocated for trades. Is this sufficient? We don’t know, only time will tell.
  • We’ve added a connector that pulls candlesticks from our brokerage, which can be streamed to dealers like dSynths. This feature is still unstable, and thus not yet been released.

dSynths App

The frontend has had its niggles and issues, below are some of the challenges that were faced and addressed:

  • People using free Arbitrum RPCs have had tons of issues with not being able to see their positions and RFQs. It was hard to pinpoint whether to blame this on the actual RPC, or on the dSynths private indexer. Turns out it was a combination of both, where even our indexer had troubles with its premium RPC. Fortunately, this has all been patched and hopefully put to rest once and for all.
  • In light of the above issue, half of the problems were due to the Isolated vs Cross selector that switches your trading context. We’ve made an upgrade to the UI where you can see all of your positions — both Isolated and Cross — at once.
  • The page would freeze after being idle for a while. This was a WebSocket issue, where the hedger would continue to stream prices to the app, despite it not being in view. Our patch cuts the connection as soon as you leave the page.
  • Users are now able to view their Trading History (e.g. closing & liquidations), powered by Subgraphs. A feature has been requested a lot.
  • Plenty of users are confused by our Tradingview chart, which doesn’t align with the prices reported by the hedger. That’s because the chart pulls data from a generic data provider! We’re currently working on integrating the hedger’s private candlesticks.
  • As protocol developers, we also want to have advanced insights into our protocol performance and the behavior of users and hedgers. For that reason, we’re developing a Dashboard page where various charts & statistics are made available.

Liquidation Oracle

Liquidators play an essential & independent role in our system, they are the cornerstone to ensure positions remain bilaterally composed. Unfortunately, we did encounter some issues with them, causing our hedger to lose money in some cases (although we’re still investigating if the CVA covered those edge cases).

  • We’re running our oracle on a private Muon network. The developers failed to transmit to us that the network performed an unannounced hot upgrade in late January. For that reason, liquidators were unable to liquidate positions for a few days due to invalid signatures. It’s a private network, after all, maintenance was to be expected. Our takeaway here is our failure to pick up on these issues any sooner. We’re currently putting systems in place to monitor for these types of situations & anomalies, as we should’ve done in the first place.
  • Since the introduction of the Trading History subgraph, we can finally review the liquidation performance. We’ve detected some anomalies in some liquidations, where the liquidator wasn’t acting punctually. These issues will be addressed in the upcoming weeks.
  • In light of the performance issues, we also only have one active liquidator. For that reason, we will be publishing an alternative & optimized open-source liquidation bot for anyone to run.

Dashboard Development

A full dashboard with extensive metrics is currently being developed. Here’s a sneak peek (styling and colors may change in final version)

--

--

dSynths
DEUS Publication

Crosschain decentralized stocks exchange with over 50,000 available assets. No Slippage. Low Fees. Powered by Web3.