Manipulation resistant instant dex proposal

dex

#1

Over the past 2 years with the surge in open finance solutions and tokens, a problem that has been constantly bugging me is the lack of a proper decentralized exchange for them. Despite the recent proliferation and advancement in the dex space, all defi apps use either an oracle or a centralized on chain exchange as a pricing source due to front running concerns.

In this post I would like to present a new dex architecture called Ping-Pong.
I’m posting here to get comments, opinions, and thoughts to know if this is something that should be polished and brought to a more usable level or dropped down at this point.
This new dex, created with the help of Oliver & the twitterless Alon Pluda:

  1. Is fully on chain, supporting uncensorable exchange of all ERC20 tokens
  2. Is manipulation/ front-running resistant
  3. Easily enables limit orders and aggregates liquidity
  4. Instantly settles trades

Outline

Let’s consider an exchange with fixed price order book where ETH is traded against TOKEN at fixed prices. For example, prices are pre-fixed at S percent intervals. Meaning that starting from a 1:1 ratio (1 TOKEN for 1ETH) all the pricing levels are:

P_n = (1 + S)^n

This kind of exchange allows us to aggregate large amounts of liquidity in those fixed price levels. This lowers gas costs enough to enable an on chain order book. On the downside it does force an artificial spread on price levels in the market, creating worse prices for smaller orders.

With the ping pong dex however we combine this order model with an automated market (x*y=k). Any time the price of the market-maker DEX hits one of the limit order fixed price walls it starts buying from it, either filling it completely and passing it or bouncing back (like ping pong between two walls).

In my opinion this kind of exchange could be ideal as a pricing source for dapps due to the manipulation resistance and replace pricing oracles.

A more detailed overview can be found here:

https://cardo.gitbook.io/project/ping-pong-dex-1/intro-and-motivation

The code for an initial version of the smart contracts lives here: