Skip to main content

Overview

This module allows a DEX to capture the MEV generated by its users' order flow.

The problem

Due to the fragmentation of liquidity for a particular token across many different liquidity pools, when a user trades against a subset of the pools a token is listed in it usually creates an arbitrage opportunity where traders in subsequent transactions can profit from rebalancing the token liquidity between the pools to normalize the price. This arbitrage opportunity can be conceptualized as value leaking from the protocols ecosystem to the MEV supply chain due to imperfect execution.

To prevent this leak a user's transaction would need to be divided proportionally across all available liquidity pools at execution time in order to create the same price impact across all of them, effectively eliminating the arbitrage opportunity. In practice this is difficult to do as it requires complex off-chain routing logic, changes to on-chain execution, and may significantly increase gas usage of transactions due to interaction with many liquidity pools. Furthermore, for a protocol that has both end users and liquidity providers as stakeholders, routing transactions to a competitor's LPs may not be desirable as it will reduce volume to their LPs. Finding a way to balance the opposing concerns of these two stakeholder groups is necessary here.

The solution

By integrating Atlas Backruns, a DEX is able to capture the majority of the value that is leaked due to imperfect execution and retain it within their ecosystem.

This is achieved using Atlas' Execution Abstraction, where many “operations” are bundled together into a single transaction. This effectively gives the DApp the capability to sequence transactions, the same capability used by searchers and validators further down the transaction supply chain to extract MEV from DApps and users.

Furthermore, Atlas Backruns has been designed to be compatible with the existing router contracts used by a DEX, preventing the need for a ground-up rewrite as would be required by the move to a fully intent based solution.

How it works

The DEX Backrun Module is integrated directly into the frontend of a DEX. Instead of having the user create a transaction that is sent directly to the router contract of the DEX, an operation is created in place of the user's transaction.

Rather than being sent directly to the users RPC, the operation is first offered to a solver network who have the opportunity to bid on the right to backrun the users operation. These bids (also in the form of operations) are finally collected together, sequenced by the DApp, and turned into a transaction that is sent to the blockchain.

When the transaction executes on-chain, the Atlas entrypoint contract ensures that both the users and solvers transactions are executed using the rules outlined by the DApp, that the winning solver pays its full bid amount, and the bid value is allocated how the DApp wants.