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)
}
}
}
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.
{
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.
{
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.
{
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
| Field | Cube | What it holds |
|---|---|---|
Trade.Dex.ProtocolFamily | DEXTrades, DEXTradeByTokens | Dodo for every DODO liquidity pool |
Trade.Dex.ProtocolName | DEXTrades, DEXTradeByTokens | dodo_v1 or dodo_v2 |
Trade.Dex.SmartContract | DEXTrades, DEXTradeByTokens | The DODO liquidity pool address |
Trade.Dex.OwnerAddress | DEXTrades, DEXTradeByTokens | The factory that created the liquidity pool; for DODO V2 it tells DVM, DPP, DSP and GSP apart |
Trade.Buy / Trade.Sell | DEXTrades | The two tokens of the swap with amount, USD amount and price |
Transaction.From | all EVM cubes | The account that sent the swap |
Pair.Market.Protocol | Trading | dodo_v1 or dodo_v2 |
Pair.Pool.Address | Trading | The DODO liquidity pool address |
Trader.Address | Trading | The trader of the swap |
Pitfalls
- Use
ProtocolFamilyfor both versions. Filtering only ondodo_v1misses every DVM, DPP, DSP and GSP liquidity pool, and only ondodo_v2misses 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_AmountInUSDonDEXTrades), not both. - The Trading cube keeps about 30 days. For older trades use
DEXTradesandDEXTradeByTokenswithdataset: combinedordataset: 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.
How do I get DODO DEX trades on BNB Chain through an API?
Query Trading.Trades with the network set to Binance Smart Chain and ProtocolFamily Dodo for live and recent DODO trades with USD values. For per-swap detail and older history, use DEXTrades on network bsc with Trade.Dex.ProtocolFamily Dodo.
Related pages
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.