How it works

Functionality and how OpenOcean works under the hood

How OpenOcean Finds the Best Prices

To get the best trade, it's important to access exchanges with the best prices and deep liquidity. OpenOcean helps users with this by searching several DEXes and CEXes for prices and liquidity, and then split the order into different routes to get the best trade.

DeFi has given rise to a lot of DEXes such as Uniswap and PancakeSwap. Each DEX has their own separate pools and liquidity that cannot conveniently be accessed at the same time. The problem is that each pool has different prices and not always deep enough liquidity to provide low slippage, especially when users are making large volume trades. The OpenOcean protocol solves this by sourcing, prioritizing/optimizing, and splitting liquidity routes across different DEXes in order to maximize the overall return on your trade.

Normally when doing a trade on OpenOcean the protocol will execute these 3 steps:

  1. Price quotation from DEXes and CEXes

  2. Optimize and find the best trading routes for best price with low slippage

  3. Communicate the prices to the user and execute trades

Protocol algorithms and smart contracts

OpenOcean protocol consists of public smart contracts deployed on each aggregated public chain and proprietary technology such as discovery and routing algorithms. OpenOcean utilizes an optimized version of the Dijkstra algorithm (D-star) which then splits routing between different protocols for better transaction rates. This ensures that users get the best price on the market with less gas consumption and lower slippage.

  • Applies an optimizing algorithm based on Dijkstra and D-star to get the initial best route

  • Additionally it constantly optimizes the routes based on machine learning using platform data

  • Offers the best price to users by comparing the prices on aggregated DEXes with the best price on CEXes

  • Protects user interests by subsidizing slippage losses with OOE tokens

  • Utilizes transparent pricing mechanism without charging additional protocol transaction fees

The public smart contracts facilitate the transactions between users and the exchanges through an API which is either accessed via the OpenOcean interface or user's own API setup. The contracts include several inner contracts that each perform a specific function such as swap, price quote, route, calculate, optimize, and also communicate with the algorithms.

Below are the public addresses:

ETH: 0x26d26b1a0243566d1cd38ff9afd5fd3f0fb6cbb4

BSC: 0x6679800c37e2f7eb072a7af3fb3b81b17a0af153

Avalanche: 0xc0006Be82337585481044a7d11941c0828FFD2D4

POLYGON: 0x042AF448582d0a3cE3CFa5b65c2675e88610B18d

SOLANA: 2mJZ38dRtFLyzwdAmWy5iZjeXkmERX5jJdWQ3Lo5JwBd

HECO: 0x67Cfc574A3ed38Bf1d1EAB05F0dB3fDEd1EcBA18


ONT: 351134766ae933edd509e968166f1f3471f95f4b

OKExChain: 0xc0006Be82337585481044a7d11941c0828FFD2D4


At the time of writing, the protocol has implemented swap, manual arbitrage, liquidity mining, and governance. Automated arbitrage SaaS, combined margin pool, and cross-chain swap are currently in development.