Inspiration

One backtesting analysis found 45 instances of price divergence between CeFi and DeFi within a month, offering a potential opportunity for CeFi quantitative trading firms to engage in Ce-DeFi arbitrage trading. However, many firms are struggling to take advantage of this opportunity due to various challenges. These include the differences in UI between DeFi and CeFi, the complex mechanisms of using leverage in DeFi, the low liquidity of DeFi due to multiple DEXs, and the need to allocate significant research and technical resources to DeFi trading. With a 94% drop in CEX liquidity from its peak, it is crucial for quant firms in CeFi to explore DeFi for more liquidity. Therefore, our DEX aggregator aims to improve trading efficiency and safety for quant firms by bringing CeFi liquidity into DeFi.

What it does

Eisen finds the optimal route possible in the current block by searching all DEXs and executes the swap. We capture potential arbitrage opportunities that are profitable, returning a portion of the profits to traders to offset their slippage loss. This helps traders experience less slippage when using our platform compared to other aggregators. Essentially, we distribute the profits that would have been taken by arbitrageurs to traders, preventing passive participants (arbitrageurs) from taking away profits from active participants (traders) in the DeFi space.

For those who are interested in understanding why there are potential arbitrage opportunities When traders trade A for B, the price of B increases. As a result, it may be possible to trade another asset, such as C (which doesn't necessarily have to be different from asset B), for B, then trade B for A, and finally trade A back to C. This could result in an increase in the amount of asset C that was initially invested, creating a profit. This process can be carried out using a flashloan, which allows us to borrow C without the limit.

How we built it

We fetched block data from solidity viewer codes and built the search algorithm to find the optimal swap route. We investigated AMMs of all DEXes and made optimal engine using rust. We executed transactions by deploying contracts in the hardhat framework. For user UI/UX, we used typescript and nestjs to interact with server(go) and web app. We accumulated time-series data by using Redis to provide a robust price oracle(time-weighted / liquidity-weighted pricing) using our optimal engine. We deployed web-app, server for app service, using argocd & amazon service in the mainnet environment. We used infura and allthatnode API for executing transactions and fetching the blockchain data.

Challenges we ran into

Adapting the interface for each DEX was one of the biggest obstacles, as there was little technical documentation and information on the contract address. Integrating the front-end & back-end was difficult to build due to the time difference.

Accomplishments that we're proud of

Our main accomplishment is aggregating separated liquidities and maximizing CeFi quant trading firms' outputs by using routing engine combined with cyclic arbitrage logic, thereby minimizing traders’ slippage. This will help CeFi quant trading firms to safely trade in DeFi space. When cyclic arbitrage didn’t start from the native tokens of the blockchain, the profitability of cyclic arbitrage had to be reevaluated considering the price of the native token for paying the gas fee. At this point, Chainlink oracle played a key role in feeding our protocol the accurate price of the native token.

What we learned

We investigated ERC20 token specs as tax tokens made a lot of problems in the DEX Aggregating router. Also, we went through many DEX interfaces and AMM modeling. We integrated curveV1, Balancer, and UniV2[including sushi, quickswap] models but it would be expanded to any other AMMs such as curveV2, UniV3.

What's next for Eisen

We plan to expand the capabilities of our aggregator by incorporating additional chains and enabling cross-chain swaps using bridges. Our upcoming features will allow CeFi quant trading firms to do automatic leverage trading and monitor price discrepancies between CeFi and DeFi for Ce-DeFi arbitrage opportunities. Furthermore, we will introduce a Request for Quote feature for small lot sizes to facilitate swaps with zero slippage. To provide CeFi quant firms with a seamless experience, we will also convert AMM market depths into a limit order book interface.

Built With

Share this project:

Updates