The DEX trades table contains swaps made on decentralized exchanges, consolidated into a single table.

Project Coverage:

Currently, we support the following projects on Tron.

ProjectsProtocol
sunswap, justswap, intercroneswap, uswap, tofuswapuniswap_v2
sunswapuniswap_v3

Sample Query

Finding the swap volume of indexed projects on Tron in the last 7 days.

select 

  date(block_timestamp) as date,

  project, 

  sum(usd_amount) as usd_volume 

from tron.dex.trades

  where current_date - date(block_timestamp) < 7

  group by date, project

  order by date desc 

Table Columns

_str columns are numeric fields cast as varchar to retain precision when summing.

ColumnDescription
projectThe project (decentralized exchange) of the liquidity pool that the swap occurred from.
protocolDEX protocol (& version, if applicable) of the contract address facilitating the swap.
liquidity_pool_addressContract address of the liquidity pool holding the asset. For protocol without the concept of LP such as airswap, this will be null.
sender_addressThe address of the sender emitted on the swap event logs. This can be a router or pool address, which is different from the transaction initiator transaction_from_address that initiated the swap.
to_addressAddress of the recipient emitted on the swap event logs. For example, we use the to_address from the uniswap v2 swap event log and the recipient_address from the uniswap v3 swap event log.
token_sold_addressToken address of the token sold.
token_sold_nameName of the token sold.
token_sold_symbolSymbol of the token sold.
token_sold_decimalsToken decimals of the token sold.
token_sold_amount_raw_strRaw amount of tokens sold (unnormalized) in string.
token_sold_amount_rawRaw amount of tokens sold (unnormalized).
token_sold_amount_strAmount of tokens sold in string.
token_sold_amountAmount of tokens sold.
usd_sold_amountAmount of token sold in USD value.
token_bought_addressToken address of the token bought, i.e. the asset acquired from the trade.
token_bought_nameName of the token bought.
token_bought_symbolSymbol of the token bought.
token_bought_decimalsToken decimals of the token bought.
token_bought_amount_raw_strRaw amount of tokens bought (unnormalized) in string.
token_bought_amount_rawRaw amount of tokens bought (unnormalized).
token_bought_amount_strAmount of tokens bought in string.
token_bought_amountAmount of tokens bought.
usd_bought_amountAmount of token bought in USD value.
usd_amountUSD value of the swap. This field preferentially selects the USD value of ETH and Stablecoin (USDT/USDC) tokens, as spam token prices may conflate the true swap value.
extra_fieldsThis field contains all the extra columns emitted from the event/function call that were not part of the convetional DEX trades columns.
swap_countSwap count within the transaction.
transaction_feesFees paid at the transaction level.
transaction_fees_usdFees paid in USD.
fee_detailsAdditional fee details of the transaction, including max priority fee, gas price and gas used for the transaction.
transaction_from_addressTransaction sender address. I.e. the address of the transaction initiator. (from_address in the raw.transactions field for the transaction_hash of this swap).
transaction_to_addressTransaction receiver. (to_address in the raw.transactions field for the transaction_hash of this swap).
transaction_hashTransaction hash that this swap belongs to.
transaction_indexThe position of this transaction in the block that it belongs to. The first transaction has index 0.
selector4byte selector of the transaction.
log_indexThe position of the swap event log in the transaction.
block_timestampBlock timestamp of the swap event.
block_numberBlock number of the swap event.
block_hashBlock hash of the swap event.
unique_idUnique ID of each trade.