There are three basic models for DEX price discovery: orderbooks (dYdX, Injective, Sei, Uni v3), AMMs (Perp v2, Osmosis) and oracle-based models (GMX, Gains, Synthetix). The basic tradeoffs between them can be seen as follows:

While orderbooks and AMMs are well-represented in the Cosmos, oracle-based solutions are not. Oracle-based solutions have capped upside in the long-term but are likely to be the most successful short-term.

We believe we’ve just scratched the surface of the design space here and we’re particularly interested in oracle-based models that don’t require native assets (e.g. Gains Network). These are particularly well-suited to Cosmos since, unlike GMX-style models, they don’t even require the native assets themselves, meaning you only need to bootstrap a stablecoin pool rather than attracting liquidity for each market they want to list. With native USDC coming to Cosmos, this is far lower risk/friction than making users bridge over native assets from non-IBC enabled chains and inheriting the associated bridge risk. This model also allows users to speculate on anything with an oracle price feed, including cryptoassets, forex, commodities, stocks, sportsbetting, etc.

The real challenge with these models is the risk engine, which must balance capital efficiency with blow-up risk by not allowing too much exposure to build up on any single market. We’re interested in seeing further experimentation with more advanced on-chain risk engines and liquidation models that can drive efficiency. As part of this, we’re also interested in seeing models that have dynamic slippage parameters, perhaps leveraging something like the Pyth liquidity oracle.

A second challenge with oracle-based dexes is the latency inherent to price updates, and the tension between trader user experience and LP profitability. If oracle updates are slow, traders can take advantage and LPs begin to leak value. If traders are required to wait for these oracle updates to protect LPs, trader UX is degraded. Clever usage of off- and on-chain mechanisms to balance these concerns are required for a successful oracle-based dex. This is an area where app-chains can offer significant benefits. Since vote extensions allow validators to include arbitrary data alongside tendermint votes, this functionality can be leveraged to update oracles on a per-block basis. This eliminates the MEV games where protocols are trying to guarantee protocols get oracle updates in before arbitrageurs.

A third challenge is the need for some sort of orderbook functionality for critical components such as limit, stop, take profit and stop loss order types. This can be built using a service like Warp or Autonomy.

Where: This would be most appropriate on faster chains such as Injective for faster oracle updates. However, it would also make sense on Osmosis given user base and existing DeFi applications. Eventually, this could also be implemented as an app-chain to benefit from the vote extension feature mentioned above.

Hackathon MVP

Create the foundation for an oracle-based DEX with stablecoin liquidity and collateral, and synthetic leverage for assets via Oracles. Scope can be reduced by simulating the deposit-side logic and ignoring trader PnL risk for the purposes of the hackathon.

On-chain Logic:

Middleware:

Front-end: