Skip to main content
Schema: sui.defi Table: ez_dex_swaps Type: Base Table

Description

This table provides a comprehensive view of decentralized exchange (DEX) swap activity across the Sui blockchain ecosystem, enriched with token pricing, metadata, and user labels. It consolidates swap events from seven major DEX protocols (Cetus, Turbos, Bluefin, Aftermath AMM, FlowX, DeepBook, and Momentum) into a standardized format with USD valuations, token metadata, and enhanced labeling. The model transforms raw swap data by adding price information, decimal-adjusted amounts, USD volume calculations, and human-readable labels for platforms, pools, and traders. This enables cross-protocol DeFi analytics, volume comparisons, and comprehensive trading pattern analysis.
Data Coverage: This table contains full historical coverage from May 2023 - Present (91.3M rows), covering DEX swap activity since shortly after the launch of Sui mainnet.

Key Use Cases

  • Cross-protocol DeFi volume analysis and market share comparison
  • Token pair trading volume and liquidity analysis
  • DEX performance benchmarking and protocol adoption tracking
  • Trader behavior analysis and wallet clustering
  • USD-denominated volume metrics and financial reporting
  • Token flow tracking and cross-protocol arbitrage detection
  • Fee revenue analysis and protocol economics modeling
  • Real-time DeFi dashboard development and monitoring

Important Relationships

  • Sources data from sui.silver.dex_swaps for base swap events
  • Enriches with token pricing from crosschain.price.ez_prices_hourly for USD calculations
  • Joins with crosschain.core.dim_labels for platform, pool, and trader labeling
  • Supports downstream DeFi analytics and cross-protocol dashboards
  • Provides foundation for token flow analysis and market microstructure studies

Commonly-used Fields

  • platform and platform_name: Essential for protocol-specific analysis and filtering
  • amount_in_usd and amount_out_usd: Critical for volume analysis and financial reporting
  • swap_volume_usd: Primary field for cross-protocol volume comparisons and market analysis
  • token_in_symbol and token_out_symbol: Key for token pair analysis and trading pattern identification
  • block_timestamp: Primary field for time-series analysis and trend detection
  • trader_address and trader_name: Essential for wallet tracking and user behavior analysis
  • pool_address and pool_name: Important for liquidity pool analysis and pool-specific metrics

Columns

Column NameData TypeDescription
CHECKPOINT_NUMBERNUMBERThe sequential number of the checkpoint in which this record was finalized on the Sui blockchain. Checkpoints are consensus milestones that bundle and finalize multiple transactions, providing the primary unit of finality and recovery in Sui. Starts at 0 (genesis checkpoint) and increments by one for each new checkpoint. Used for time series analysis, transaction ordering, and measuring network throughput. Once a transaction is included in a checkpoint, it is permanently recorded and cannot be reverted. This dataset only includes checkpoints greater than or equal to 96605300. Example: 96605301.
BLOCK_TIMESTAMPTIMESTAMP_NTZThe network-agreed timestamp (in milliseconds since Unix epoch) when the checkpoint containing this record was finalized by Sui consensus. Represents the authoritative time of transaction finality, as determined by validator signatures. Used for temporal analytics, trend analysis, and aligning on-chain activity with real-world time. Example: ‘2024-06-01 12:34:56.789’.
TX_DIGESTTEXTA 32-byte cryptographic hash (Base58-encoded) uniquely identifying the transaction’s contents and structure. Serves as the primary key for transaction lookup, integrity verification, and cross-model joins. Enables cryptographic proof of transaction inclusion and supports lineage tracing across all Sui analytics. Example: ‘6Qk8…9Xz’.
EVENT_INDEXNUMBERZero-based index ordering events within a transaction. Ensures deterministic event ordering for sequence reconstruction and analytics. Example: 1.
PLATFORM_ADDRESSTEXTThe smart contract address of the DEX platform that facilitated this swap. This represents the deployed contract address for the specific DEX protocol on the Sui blockchain. Used for contract verification, security analysis, and linking to platform-specific metadata and configurations. Essential for protocol-specific analysis and filtering across different DeFi platforms.
PLATFORM_NAMETEXTThe human-readable name of the DEX platform, derived from address labeling or defaulting to the platform address if no label exists. This field provides user-friendly platform identification for analytics, reporting, and dashboard displays. Examples include “Cetus AMM”, “Turbos Finance”, “Bluefin”, etc. Essential for protocol-specific analysis and cross-platform comparisons.
POOL_ADDRESSTEXTThe address of the liquidity pool involved in the swap. For protocols that use AMM (Automated Market Maker) pools, this identifies the specific pool contract. May be NULL for order book-based protocols like DeepBook or centralized limit order protocols. Essential for pool-specific analytics, liquidity analysis, and understanding which pools are most active for different token pairs.
POOL_NAMETEXTThe human-readable name of the liquidity pool involved in the swap, derived from address labeling or defaulting to the pool address if no label exists. This field provides user-friendly pool identification for analytics and reporting. Examples might include “SUI-USDC Pool”, “ETH-USDT Pool”, etc. Essential for pool-specific analysis and liquidity concentration studies.
AMOUNT_IN_RAWNUMBERThe raw amount of tokens being swapped in (input amount) before any decimal adjustments. This represents the exact on-chain token amount as it appears in the swap event. Preserves precision for accurate calculations and is essential for volume analysis, price impact calculations, and swap size distribution analysis. Critical for calculating swap rates and understanding the actual token amounts exchanged in each swap.
AMOUNT_OUT_RAWNUMBERThe raw amount of tokens being swapped out (output amount) before any decimal adjustments. This represents the exact on-chain token amount that the user receives from the swap. Critical for calculating swap rates, slippage analysis, and understanding the actual token amounts exchanged in each swap. Essential for volume analysis and swap size distribution analysis.
A_TO_BBOOLEANA boolean flag indicating the direction of the swap within the pool. When TRUE, the swap goes from token A to token B; when FALSE, it goes from token B to token A. This field is protocol-specific and may be NULL for some DEX platforms. Important for understanding swap direction and pool token ordering conventions. Follows each protocol’s specific pool token ordering conventions.
FEE_AMOUNT_RAWNUMBERThe raw amount of fees charged for the swap transaction. This includes protocol fees, liquidity provider fees, and any other transaction costs. May be 0 for protocols that don’t charge explicit fees or when fees are embedded in the swap amounts. Essential for fee revenue analysis and total cost of trading calculations. For some protocols like Aftermath, this may be NULL as fees are handled differently.
PARTNER_ADDRESSTEXTThe address of a partner or affiliate that facilitated the swap (if applicable). Used primarily by Cetus for their partner program where swaps can be routed through partner contracts. May be NULL for most protocols or when no partner was involved. Useful for tracking partner performance and affiliate program analytics within the DEX ecosystem.
STEPSNUMBERThe number of steps or hops required to complete the swap. For simple swaps, this is typically 1. For complex swaps involving multiple pools or routing through multiple protocols, this indicates the number of intermediate steps. Essential for understanding swap complexity and routing efficiency across different protocols. Critical for analyzing multi-hop swaps and routing optimization.
TOKEN_IN_TYPETEXTThe full type identifier of the token being swapped in (input token). This follows Sui’s Move type format (e.g., “0x2::sui::SUI” for the native SUI token). Essential for token identification, pricing lookups, and token-specific analytics. Used for calculating USD values and token pair analysis. Some models ensure proper formatting by adding ‘0x’ prefix if missing.
TOKEN_IN_ADDRESSVARIANTThe extracted token address from the full token type identifier, representing the contract address of the input token. This field is derived by splitting the token_in_type on ’::’ and taking the first component. For native SUI tokens, this will be ‘0x2’. Essential for token identification, pricing lookups, and cross-model joins with token metadata tables.
TOKEN_IN_SYMBOLTEXTThe trading symbol for the input token, such as ‘SUI’, ‘USDC’, ‘USDT’, etc. This field is populated from token price data and provides user-friendly token identification for analytics and reporting. May be NULL for tokens without established price data. Essential for token pair analysis and trading pattern identification.
TOKEN_IN_NAMETEXTThe full descriptive name of the input token, such as ‘Sui Token’, ‘USD Coin’, ‘Tether USD’, etc. This field is populated from token price data and provides complete token identification for analytics and reporting. May be NULL for tokens without established price data. Useful for comprehensive token analysis and user interface displays.
TOKEN_OUT_TYPETEXTThe full type identifier of the token being swapped out (output token). This follows Sui’s Move type format and represents the token that the user receives from the swap. Critical for token pair analysis, swap rate calculations, and understanding token flow patterns across the DeFi ecosystem. Some models ensure proper formatting by adding ‘0x’ prefix if missing.
TOKEN_OUT_ADDRESSVARIANTThe extracted token address from the full token type identifier, representing the contract address of the output token. This field is derived by splitting the token_out_type on ’::’ and taking the first component. For native SUI tokens, this will be ‘0x2’. Essential for token identification, pricing lookups, and cross-model joins with token metadata tables.
TOKEN_OUT_SYMBOLTEXTThe trading symbol for the output token, such as ‘SUI’, ‘USDC’, ‘USDT’, etc. This field is populated from token price data and provides user-friendly token identification for analytics and reporting. May be NULL for tokens without established price data. Essential for token pair analysis and trading pattern identification.
TOKEN_OUT_NAMETEXTThe full descriptive name of the output token, such as ‘Sui Token’, ‘USD Coin’, ‘Tether USD’, etc. This field is populated from token price data and provides complete token identification for analytics and reporting. May be NULL for tokens without established price data. Useful for comprehensive token analysis and user interface displays.
AMOUNT_INFLOATThe decimal-adjusted amount of tokens being swapped in (input amount), calculated by dividing the raw amount by the token’s decimal places. This field provides human-readable token amounts for analysis and reporting. For example, if amount_in_raw is 1000000000 and token_in_decimals is 9, then amount_in would be 1.0. Essential for user-friendly volume analysis and token flow calculations.
AMOUNT_OUTFLOATThe decimal-adjusted amount of tokens being swapped out (output amount), calculated by dividing the raw amount by the token’s decimal places. This field provides human-readable token amounts for analysis and reporting. For example, if amount_out_raw is 500000000 and token_out_decimals is 6, then amount_out would be 500.0. Critical for calculating swap rates and understanding actual token exchange ratios.
FEE_AMOUNTFLOATThe decimal-adjusted amount of fees charged for the swap transaction, calculated by dividing the raw fee amount by the input token’s decimal places. This field provides human-readable fee amounts for cost analysis and reporting. May be NULL when no fees are charged or when fee information is not available. Essential for fee revenue analysis and total cost of trading calculations.
TOKEN_IN_PRICEFLOATThe USD price of the input token at the time of the swap, sourced from hourly price data. This field enables USD-denominated volume calculations and financial analysis. May be NULL for tokens without available price data. Essential for calculating amount_in_usd and swap_volume_usd fields.
TOKEN_OUT_PRICEFLOATThe USD price of the output token at the time of the swap, sourced from hourly price data. This field enables USD-denominated volume calculations and financial analysis. May be NULL for tokens without available price data. Essential for calculating amount_out_usd and swap_volume_usd fields.
TOKEN_IN_DECIMALSNUMBERThe number of decimal places for the input token, used for converting raw amounts to human-readable values. This field is sourced from token price data or defaults to common values (6 for USDC/USDT, 9 for others). Essential for accurate amount_in calculations and token precision handling.
TOKEN_OUT_DECIMALSNUMBERThe number of decimal places for the output token, used for converting raw amounts to human-readable values. This field is sourced from token price data or defaults to common values (6 for USDC/USDT, 9 for others). Essential for accurate amount_out calculations and token precision handling.
AMOUNT_IN_USDFLOATThe USD value of the input token amount, calculated as amount_in * token_in_price. This field provides USD-denominated volume metrics for financial analysis and reporting. May be NULL when token_in_price is not available. Essential for cross-protocol volume comparisons and financial reporting.
AMOUNT_OUT_USDFLOATThe USD value of the output token amount, calculated as amount_out * token_out_price. This field provides USD-denominated volume metrics for financial analysis and reporting. May be NULL when token_out_price is not available. Essential for cross-protocol volume comparisons and financial reporting.
SWAP_VOLUME_USDFLOATThe USD volume of the swap, calculated as the average of amount_in_usd and amount_out_usd when both prices are available, or using whichever price is available when only one is present. This field provides the primary metric for volume analysis and cross-protocol comparisons. May be NULL when no price data is available. Essential for DeFi volume analytics and market analysis.
TRADER_ADDRESSTEXTThe address of the wallet or account that initiated the swap. May be NULL for some protocols that don’t explicitly track the trader address in their events. Essential for user behavior analysis, wallet tracking, and understanding individual trader patterns and preferences across different DEX platforms. For some protocols like Aftermath, this is extracted from the transaction sender.
EZ_DEX_SWAPS_IDTEXTA unique surrogate key generated from the combination of transaction identifiers and swap details. For the general DEX table, this combines tx_digest and event_index. For protocol-specific tables like Aftermath, this may include additional fields like trader_address, token_in_type, token_out_type, amount_in_raw, and amount_out_raw. This provides a stable, unique identifier for each swap event that can be used as a primary key for downstream analytics and data modeling. Ensures data integrity and prevents duplicate processing.
INSERTED_TIMESTAMPTIMESTAMP_NTZTimestamp when the record was inserted into the analytics database. System-generated by the ETL pipeline, typically in TIMESTAMP_NTZ format. Used for data lineage, ETL monitoring, and freshness checks. In Sui analytics, this field is essential for tracking data ingestion latency, validating pipeline health, and supporting incremental model builds. Example: ‘2024-06-01 12:34:56.789’.
MODIFIED_TIMESTAMPTIMESTAMP_NTZTimestamp when the record was last modified in the analytics database. System-generated for change tracking, data versioning, and consistency verification. In Sui, this supports incremental processing, late-arriving data correction, and auditability of analytics workflows. Used to monitor data staleness and trigger downstream updates. Example: ‘2024-06-01 12:34:56.789’.
_INVOCATION_IDTEXTA unique identifier for the dbt run that created or updated this record. This field is used for data lineage tracking and debugging purposes. Helps identify which specific dbt execution was responsible for processing each record and enables traceability back to the source code and configuration used. Essential for ETL monitoring, data quality tracking, and troubleshooting pipeline issues.