DODO DEX API — Trades, Liquidity Pools and Prices on BSC, Ethereum, Polygon and Arbitrum
DODO is a DEX built on the Proactive Market Maker (PMM) design. Its liquidity pools price trades around a reference price (set by the liquidity pool's creator or an oracle) instead of only from the ratio of the reserves. Bitquery decodes DODO swaps into the same cubes as every other DEX, under the protocol family Dodo with two protocol names:
ProtocolName | DODO version | Liquidity pool types |
|---|---|---|
dodo_v1 | DODO V1 | The original DODO liquidity pools (SellBaseToken / BuyBaseToken swaps) |
dodo_v2 | DODO V2 | DVM (DODO Vending Machine), DPP (DODO Private Pool, including DPP Advanced), DSP (DODO Stable Pool) and GSP (Gas Saving Pool). All of them emit the same DODOSwap event. |
Filter on ProtocolFamily: "Dodo" to get both versions, or on one ProtocolName to get one. Every example below runs in the IDE on a free account. The examples use BSC, where DODO trades the most; the chains table shows what to change for the other chains.
How to get DODO data
- Live and recent trades with USD price and trader: the Crypto Trades API (
Trading.Trades) withMarket: { Network: "Binance Smart Chain", ProtocolFamily: "Dodo" }. The Trading cube keeps about the last 30 days. - Per-swap detail and older history: the chain cubes
EVM(network: bsc) { DEXTrades }andDEXTradeByTokenswithTrade.Dex.ProtocolFamily: "Dodo". Without adatasetargument they read the realtime dataset (the last few days); adddataset: combinedordataset: archivefor older trades. - New liquidity pools: the
NewDVM,NewDPP,NewDSPandNewGSPevents of the DODO V2 factories in theEventscube.
DODO on each chain
The queries on this page work on every chain below. Change network: in EVM(...) queries, Network in Trading cube queries, and the factory addresses in the new liquidity pool query.
| Chain | EVM(network: ...) | Trading cube Network | DVM factory | DPP factory | DSP factory | GSP factory |
|---|---|---|---|---|---|---|
| BSC | bsc | Binance Smart Chain | 0x790b4a80fb1094589a3c0efc8740aa9b0c1733fb | 0xd9cac3d964327e47399aebd8e1e6dcc4c251daae | 0x0fb9815938ad069bf90e14fe6c596c514bede767 | 0x78d43a889f42a344fe98c3fb9455791dc8178d55 |
| Ethereum | eth | Ethereum | 0x72d220ce168c4f361dd4dee5d826a01ad8598f6c | 0x5336ede8f971339f6c0e304c66ba16f1296a2fbe | 0x6fddb76c93299d985f4d3fc7ac468f9a168577a4 | 0x710409d2121b7c8ea4acadd6803fde2d85df6473 |
| Polygon (Matic) | matic | Matic | 0x79887f65f83bdf15bcc8736b5e5bcdb48fb8fe13 | 0xd24153244066f0afa9415563bfc7ba248bfb7a51 | 0x43c49f8dd240e1545f147211ec9f917376ac1e87 | — |
| Arbitrum | arbitrum | Arbitrum | 0xda4c4411c55b0785e501332354a036c04833b72b | 0xa6cf3d163358af376ec5e8b7cc5e102a05fde63d | 0xc8fe2440744dcd733246a4db14093664defd5a53 | 0x46e55a974c5995675b025f7f607c3278b36f0c29 |
The factories are the current DODO V2 factories. Some chains also have older DVM and DPP factories, so a liquidity pool created long ago can carry an older factory address. DODO also trades on other chains, such as Base and Optimism; the DODO trades by chain query lists where it traded in the last 24 hours.
Live DODO trades on BSC
A stream of every DODO swap on BSC with the trader, the amounts, USD values and the liquidity pool address. Market.ProtocolFamily: "Dodo" covers both dodo_v1 and dodo_v2; Pair.Pool.Address is the liquidity pool.
subscription {
Trading {
Trades(
where: {Pair: {Market: {Network: {is: "Binance Smart Chain"}, ProtocolFamily: {is: "Dodo"}}}}
) {
Block {
Time
}
Side
Trader {
Address
}
Amounts {
Base
Quote
}
AmountsInUsd {
Base
}
Price
PriceInUsd
Pair {
Currency {
Symbol
Id
}
QuoteCurrency {
Symbol
Id
}
Market {
Protocol
Address
}
Pool {
Address
}
}
TransactionHeader {
Hash
}
}
}
}
Latest DODO swaps on BSC
DEXTrades returns both sides of each swap. Dex.SmartContract is the liquidity pool and Dex.OwnerAddress the factory that created it, which tells you the liquidity pool type (see the chains table). Transaction.From is the account that sent the swap.
{
EVM(network: bsc) {
DEXTrades(
where: {Trade: {Dex: {ProtocolFamily: {is: "Dodo"}}}}
limit: {count: 20}
orderBy: {descending: Block_Time}
) {
Block {
Time
Number
}
Trade {
Dex {
ProtocolName
SmartContract
OwnerAddress
}
Buy {
Currency {
Symbol
SmartContract
}
Amount
AmountInUSD
}
Sell {
Currency {
Symbol
SmartContract
}
Amount
AmountInUSD
}
}
Transaction {
From
Hash
}
}
}
}
Top DODO liquidity pools by 24-hour volume
Group DEXTrades by the liquidity pool address to rank DODO liquidity pools by trade count, traders and USD volume. The since_relative filter keeps the window at the last 24 hours whenever you run it.
{
EVM(network: bsc) {
DEXTrades(
where: {Trade: {Dex: {ProtocolFamily: {is: "Dodo"}}}, Block: {Time: {since_relative: {hours_ago: 24}}}}
orderBy: {descendingByField: "volumeUsd"}
limit: {count: 20}
) {
Trade {
Dex {
ProtocolName
SmartContract
OwnerAddress
}
}
trades: count
traders: uniq(of: Transaction_From)
volumeUsd: sum(of: Trade_Buy_AmountInUSD)
}
}
}
DODO V2 trades by liquidity pool type
Every DODO V2 liquidity pool is created by a DVM, DPP, DSP or GSP factory, and Dex.OwnerAddress holds that factory. Group dodo_v2 trades by it to see how much each liquidity pool type traded in the last 24 hours. Match the addresses to the chains table.
{
EVM(network: bsc) {
DEXTrades(
where: {Trade: {Dex: {ProtocolName: {is: "dodo_v2"}}}, Block: {Time: {since_relative: {hours_ago: 24}}}}
orderBy: {descendingByField: "trades"}
) {
Trade {
Dex {
OwnerAddress
}
}
trades: count
pools: uniq(of: Trade_Dex_SmartContract)
volumeUsd: sum(of: Trade_Buy_AmountInUSD)
}
}
}