Aug 2022 Release Notes: The Graph Migration (aka Legacy Backend Migration)

Brought to you by Sovryn

August 4, 2022

It seems like only yesterday since we started onboarding people onto Zero from the early access waitlist. In less than 2 months, we’re on the cusp of reaching $2 million in TVL on the protocol. 

Since then, we’ve also released an entirely new product on Sovryn: Perpetual Futures! Yes, you can now trade decentralized perpetual futures on Sovryn using bitcoin as collateral, without the need for KYC. 

In our previous release notes, we outlined a number of Quality of Life updates to the dApp. In this month’s instalment, we’re delighted to share details on what has been an ongoing initiative over the past while: The Graph Migration!


This release includes improvements to our backend systems used to provide data to the Sovryn dApp, and UX enhancements to our Cross-Chain flow.

Changes in this Release

Backend migration work to improve performance and reliability of data loading for the following areas of the Sovryn dApp

Landing page

  • Asset price 


  • History table


  • History table


  • APY chart
  • History table


  • Stake history


  • Available / Total Balances

Yield Farm

  • History table

Enhanced UX for our Cross-Chain (Bridge) flow

  • Instead of using the ambiguous terms "deposit" and "withdraw", we're now using the terms "Send" and "Receive" to reflect sending funds from the user's wallet or receiving funds to the user's wallet.

Layout updates

  • The progress bar has been moved to the top of the page, and clear explanations have been added for each step.
  • Minor visual and functional bugs have been fixed.

General dApp updates

  • A ‘tiny position’ check when closing loans has been added so that you don’t leave a very small position open when closing a loan. 

Smart contract updates

  1. Update to the lending pool contracts to reduce the gas costs for margin trading
  2. Update to the wrapper contract used for AMM interactions
  • Now supporting liquidity provisions for ERC20/ERC20 pairs with automatic participation at the liquidity mining program
  • General refactoring to reduce gas costs

Backend Migration Summary

The reasons we carried out the migration are outlined below:

  • Data is more robust and reliable from The Graph.
  • Any code for The Graph support can be much more easily maintained and extended by our developers than the previous backend architecture, and the community in general.
  • The Graph is a battle-tested framework designed specifically for indexing blockchains.
  • There is an out-of-the-box GraphQL (Graph Query Language) API. GraphQL offers the benefit that it is much more community-friendly and transparent - users can query whatever data they want, however they want.
  • When The Graph adds full support for RSK blockchain, we can fully decentralize data services by using the whole Graph ecosystem.

Changes we have made in the migration:

  • Switched majority of the data used in the Sovryn dApp to be loaded from The Graph (where possible).
  • Where processing is required but cannot be handled by the Graph, we have created backend microservices to perform the same operations - these can easily be scaled up to prevent problems with large/sudden spikes in traffic to the dApp.

Trading Chart Update

All price data for our charts now comes from The Graph. This offers transparency, robustness, efficiency and greater potential for open-source contributions. See “Contribute to Sovryn Data Services development” section below for more details on how you can interact with our data.

With this change we have now updated our Trading charts now with some long awaited features:

  • Addition of Volume Indicators - these values are quoted in the quote token rather than dollars or RBTC. For example SOV/XUSD is quoted in SOV.
  • With the addition of volume, all trading indicators that rely on volume should now be functional - enjoy charting with RSI and more!
  • High performance - our charts load promptly no matter what timeframe you select. Now you can view the last year of trades quickly if desired!
  • Recent Trades - this is also using The Graph now for better consistency between the charts and the trades shown here. This will also auto-refresh so you can see trades as they are being made.


Something you may notice appearing differently, is that now only trading pairs that have RBTC or XUSD as the quote asset (e.g. XXX/XUSD or XXX/RBTC based pairs),will have candlestick charts - all others will use line charts. This was a conscious design choice for performance reasons.

Previously we were storing data for every single trading pair combination in our protocol (even those we do not have direct AMM pools for - e.g. SOV/ETHs). This meant that our database tables would grow exponentially for every new token that was added to the protocol. In order to prevent unsustainable growth, we have restricted candlestick charts to only those pairs which have either RBTC or XUSD on one side.

For an informative explanation of what The Graph is, how we are using it, and the benefits of doing so, check out our overview of The Graph on the Sovryn wiki.

Users are encouraged to explore and use The Graph. To help you get started, we have out together technical usage documentation which you can find in the wiki, following the link above.

Contribute to Sovryn Data Services development!

To get involved, take a look at our code on Github:

  1. Sovryn subgraph:
  2. Zero Subgraph:
  3. Graph Wrapper:
  4. AMM Apy:

And come find out more and engage with the community on our Discord server!

That’s all for now folks.

Stay Sovryn

You May Also Like

Leave A Reply