Either by signing a DeFi transaction or just looking at the information in a liquidity pool, every xExchange user has interacted with the DEX service at least once.
It complements the xExchange Smart Contracts stack and sits at the core of the main modules, including Energy, Farms, Metabonding, Price Discovery or Smart Swaps.
For example, when someone inputs an amount in the swap page, the DEX Service accesses the information about token quantities of that specific SC pool and does the math behind the scenes to quote the price that is displayed soon after.
If everything is fine and the user decides to complete the swap, the DEX Service will step in again and create the transaction with the address, amount, gas and data field already filled, removing the hassle.
The same capabilities of presenting information in a user-friendly format are used in the Analytics module as well, where apart from streaming real time data, historical data is shown in the form of easy-to-read charts. A more complex example here would be the integration done by our partners from TradingView.
Not only a bridge between complex information and what users are reading, but also a way of adding orders of efficiency to the overall infrastructure. The DEX Service reduces the amount of data requested from the blockchain and VM for usual events, such as a liquidity change in a pool by refreshing the globally distributed data cache only when the event happens without querying the blockchain.
All that being said, the DEX Service is one of the most important components to go open source and become an ecosystem resource.
Beyond DeFi applications and protocols, it can be used as a proof of concept for almost any kind of microservice, as it touches on many relevant areas of use.
If you have any improvements or suggestions, community contributions are more than welcome.
It’s time to build!