Skip to main content

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:

ProtocolNameDODO versionLiquidity pool types
dodo_v1DODO V1The original DODO liquidity pools (SellBaseToken / BuyBaseToken swaps)
dodo_v2DODO V2DVM (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) with Market: { 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 } and DEXTradeByTokens with Trade.Dex.ProtocolFamily: "Dodo". Without a dataset argument they read the realtime dataset (the last few days); add dataset: combined or dataset: archive for older trades.
  • New liquidity pools: the NewDVM, NewDPP, NewDSP and NewGSP events of the DODO V2 factories in the Events cube.

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.

ChainEVM(network: ...)Trading cube NetworkDVM factoryDPP factoryDSP factoryGSP factory
BSCbscBinance Smart Chain0x790b4a80fb1094589a3c0efc8740aa9b0c1733fb0xd9cac3d964327e47399aebd8e1e6dcc4c251daae0x0fb9815938ad069bf90e14fe6c596c514bede7670x78d43a889f42a344fe98c3fb9455791dc8178d55
EthereumethEthereum0x72d220ce168c4f361dd4dee5d826a01ad8598f6c0x5336ede8f971339f6c0e304c66ba16f1296a2fbe0x6fddb76c93299d985f4d3fc7ac468f9a168577a40x710409d2121b7c8ea4acadd6803fde2d85df6473
Polygon (Matic)maticMatic0x79887f65f83bdf15bcc8736b5e5bcdb48fb8fe130xd24153244066f0afa9415563bfc7ba248bfb7a510x43c49f8dd240e1545f147211ec9f917376ac1e87—
ArbitrumarbitrumArbitrum0xda4c4411c55b0785e501332354a036c04833b72b0xa6cf3d163358af376ec5e8b7cc5e102a05fde63d0xc8fe2440744dcd733246a4db14093664defd5a530x46e55a974c5995675b025f7f607c3278b36f0c29

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.

Run this query in the IDE

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.

Run this query in the IDE

{
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.

Run this query in the IDE

{
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.

Run this query in the IDE

{
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)
}
}
}

Trades in one DODO liquidity pool​

Put the liquidity pool address in Dex.SmartContract. The example is a WBNB/USDT DODO Private Pool on BSC, 0xfd2ca32dba07450e0381c5caf80468b894ed29c3.

Run this query in the IDE

{
EVM(network: bsc) {
DEXTrades(
where: {Trade: {Dex: {SmartContract: {is: "0xfd2ca32dba07450e0381c5caf80468b894ed29c3"}}}}
limit: {count: 20}
orderBy: {descending: Block_Time}
) {
Block {
Time
}
Trade {
Buy {
Currency {
Symbol
}
Amount
AmountInUSD
Price
}
Sell {
Currency {
Symbol
}
Amount
AmountInUSD
}
}
Transaction {
From
Hash
}
}
}
}

New DODO liquidity pools​

Each DODO V2 factory emits an event when it creates a liquidity pool: NewDVM, NewDPP, NewDSP or NewGSP. The arguments are baseToken, quoteToken, creator and, last, the new liquidity pool address (named dvm, dpp and so on). The query reads the four BSC factories over the last 30 days; widen days_ago for older liquidity pools, or swap in the factory addresses of another chain from the chains table.

Run this query in the IDE

{
EVM(network: bsc) {
Events(
where: {Log: {SmartContract: {in: ["0x790b4a80fb1094589a3c0efc8740aa9b0c1733fb", "0xd9cac3d964327e47399aebd8e1e6dcc4c251daae", "0x0fb9815938ad069bf90e14fe6c596c514bede767", "0x78d43a889f42a344fe98c3fb9455791dc8178d55"]}}, Block: {Time: {since_relative: {days_ago: 30}}}}
limit: {count: 20}
orderBy: {descending: Block_Time}
) {
Block {
Time
}
Log {
SmartContract
Signature {
Name
}
}
Transaction {
Hash
}
Arguments {
Name
Value {
... on EVM_ABI_Address_Value_Arg {
address
}
}
}
}
}
}

To follow new liquidity pools as they are created, change the opening { to subscription { and drop the Block filter, limit and orderBy.

DODO trades by chain​

The Trading cube covers DODO on every chain it indexes. This query counts DODO trades of the last 24 hours per chain and version, largest first.

Run this query in the IDE

{
Trading {
Trades(
where: {Pair: {Market: {ProtocolFamily: {is: "Dodo"}}}, Block: {Time: {since_relative: {hours_ago: 24}}}}
orderBy: {descendingByField: "count"}
limit: {count: 20}
) {
Pair {
Market {
Network
Protocol
}
}
count
}
}
}

Fields​

FieldCubeWhat it holds
Trade.Dex.ProtocolFamilyDEXTrades, DEXTradeByTokensDodo for every DODO liquidity pool
Trade.Dex.ProtocolNameDEXTrades, DEXTradeByTokensdodo_v1 or dodo_v2
Trade.Dex.SmartContractDEXTrades, DEXTradeByTokensThe DODO liquidity pool address
Trade.Dex.OwnerAddressDEXTrades, DEXTradeByTokensThe factory that created the liquidity pool; for DODO V2 it tells DVM, DPP, DSP and GSP apart
Trade.Buy / Trade.SellDEXTradesThe two tokens of the swap with amount, USD amount and price
Transaction.Fromall EVM cubesThe account that sent the swap
Pair.Market.ProtocolTradingdodo_v1 or dodo_v2
Pair.Pool.AddressTradingThe DODO liquidity pool address
Trader.AddressTradingThe trader of the swap

Pitfalls​

  • Use ProtocolFamily for both versions. Filtering only on dodo_v1 misses every DVM, DPP, DSP and GSP liquidity pool, and only on dodo_v2 misses the original DODO liquidity pools.
  • DPP prices are set by their owner. A DODO Private Pool trades at the price its owner sets. A small DPP can print a price far from the market, so filter to one liquidity pool with Dex: {SmartContract: {is: "..."}} or rank liquidity pools by volume before you take a price from DODO.
  • Wrapped native tokens. DODO V2 liquidity pools hold ERC-20 tokens, so trades show WBNB or WETH, not the native coin.
  • Don't sum both sides for volume. Each swap has a buy side and a sell side of the same USD value. Sum one of them (Trade_Buy_AmountInUSD on DEXTrades), not both.
  • The Trading cube keeps about 30 days. For older trades use DEXTrades and DEXTradeByTokens with dataset: combined or dataset: archive.

Frequently Asked Questions

How do I get DODO trades on BSC?

Use Trading.Trades with Market Network Binance Smart Chain and ProtocolFamily Dodo for live and recent trades with USD values, or EVM(network: bsc) DEXTrades with Trade.Dex.ProtocolFamily Dodo for per-swap detail and older history.

What is the difference between dodo_v1 and dodo_v2?

dodo_v1 is the original DODO liquidity pool design. dodo_v2 covers the DODO V2 liquidity pools: DVM, DPP (including DPP Advanced), DSP and GSP, which all emit the DODOSwap event.

Which chains does the DODO API cover?

BSC, Ethereum, Polygon (Matic) and Arbitrum, and other chains where DODO trades, such as Base and Optimism. Run the DODO trades by chain query to see the current list.

How do I find new DODO liquidity pools?

Query the Events cube for NewDVM, NewDPP, NewDSP and NewGSP on the DODO V2 factory contracts of the chain. The last argument is the new liquidity pool address.

Build with Bitquery

Ready to run this in production?

Get an API key and run these queries in minutes, or talk to us about plans and enterprise delivery.