Eta X NonML V3: Expanded DEX Support and Larger Trades With Order Splitting

Jack Lodge
Deeplink Labs
Published in
5 min readFeb 23, 2023

· Eta X V1 Recap
Why is Eta X Important?
What is Eta X?
· Eta X NonML V3 Updates
Order Splitting
Additional DEX Support
DEX Community Suggestions
· Try It Out Yourself

Eta X V1 Recap

The core concepts and motivation behind Eta X are explored in great detail in our previous article:

However, we will briefly summarize Eta X V1 for readers who are unfamiliar with our progress.

Why is Eta X Important?

The growth of decentralized finance has led to an increase in the number of DEXs, which provide a trustless solution for trading crypto assets. Eta X stands out by offering a platform that is resilient to manipulation and provides the best possible trade routes as calculated by reverse engineering publicly available smart contracts and their respective AMM conservation functions, without engaging in any biased practices.

What is Eta X?

Eta X is a decentralized exchange (DEX) aggregator and smart order routing (SOR) tool developed by Deeplink that can help traders find the most profitable trade routes by considering factors such as price impact, liquidity, and gas fees. Eta X V1 uses a modified Djisktra algorithm to traverse and validate paths from the token being sold to the token being purchased.

To evaluate the profitability of each route, Eta X V1 uses reverse-engineered conservation functions from each exchange to calculate a minimum return and price impact percentage. The algorithm returns a list of recommended routes for a user in descending order of highest returns. While early versions of Eta X are simply analytics tools to inform traders, the ultimate goal of Eta X is to facilitate the execution of profitable trade opportunities via wallet and smart contract integration.

Eta X NonML V3 Updates

Order Splitting

One of the largest new features introduced to Eta X since our last publication is order splitting, a feature that facilitates trades that are larger than could be executed within a single pool or even single path of swaps across pools.

For example, if you wanted to exchange 7,500,000 AGIX (approximately $36,66,849.18 USD) for the maximum amount of AGIX, previous iterations of Eta X would suggest trading in whole quantities across Uniswap V3:

This trade route would incur an averaged 7.37% price impact, a gas fee of 0.00147753598 ETH (approximately $2.19 USD), and a total minimum return of 485,955 LINK (approximately $3,563,750.99 USD). Eta X however, can do better.

With our new order-splitting feature, Eta X will suggest breaking this trade into smaller trades. In effect, this mitigates the effects of price impact by making use of the distributed liquidity of DeFi.

By breaking the trade down into two smaller trades, we can now observe an average price impact of 5.47%, a cumulative gas fee of 0.00247769267 ETH (approximately $4.38 USD), and a total minimum return of 497,211 LINK (approximately $3,646,296.87 USD) — in this case, saving you $82,545.88 USD in value that would otherwise have been lost to price impact, and this is on top of the savings already made by the old version of the router.

How it Works

Essentially, Eta X takes the routes identified, and if any exceed a given price impact threshold of 10%, it will then calculate a maximum amount that can be put into the best route until the price impact threshold is reached, then it will repeat with the next, and so on. You can think of this as though the trade were being poured into a bucket, once that bucket fills, it begins to spill over into the next bucket, and so on, until the amount traded is distributed across as many buckets as needed.

The function works by starting at the end of the path (i.e., the pool containing the buy token) and calculating the amount of sell token that can be swapped in that pool without exceeding the maximum price impact limit. It then moves back to the previous pool in the path and calculates the amount of sell token needed to swap the amount calculated in the previous pool, as well as the amount of the sell token in the current pool required to not break the price impact limit. The minimum of these two values is taken as the maximum amount of sell token that can be swapped in the current pool without exceeding the price impact limit. This process is repeated until the start of the path (i.e., the pool containing the sell token) is reached.

The function uses the relevant constant product formula to calculate the expected price impact of swapping the sell token for the buy token in each pool. It also takes into account any adjustment needed for Sushiswap subgraphs.

Once the maximum amount of sell token that can be swapped in the path without exceeding the price impact limit is determined, the function returns this amount as the maximum sell amount for the order. If the maximum sell amount is less than the total sell amount, the order is split into multiple smaller orders and this process is repeated until the entire sell amount is swapped through the path.

Additional DEX Support

In the Time since our last publication we have expanded Eta X’s DEX aggregation functionality to include:

  • Uniswap V2
  • Uniswap V3
  • SushiSwap V2
  • Curve
  • Balancer

The addition of Uniswap V3 and Curve in particular (the two top DEXs by volume according to CoinGecko) has expanded the effectiveness of Eta X’s SOR capabilities dramatically, by enabling the inclusion of some of DeFi’s most liquid pools.

DEX Community Suggestions

Deeplink’s R&D team is vigilantly searching for the most opportune DEXs to include within the scope of Eta X, dYdX, and Hashflow being targets of interest to us right now. However, we would like to invite you, the community, to have a say in what DEXs you would like to see included in Eta X. As such, we have included a community submissions box for DEX suggestions in which a user can vote on a set of contenders from a list of considerations, or suggest a completely new DEX by entering its name or a contract address such as its deployer or factory contract.

To use this feature, simply click the ‘+ Add New’ button located under the tickboxes for DEX filtering.

Try It Out Yourself

You can try the Eta X NonML V3 app yourself at the following link:
https://etax3.deeplink.network/

The source code for Eta X NonML V1 can be found here:
https://github.com/Deeplink-Network/EtaX-V1

--

--