upd silver docs

This commit is contained in:
Jack Forgash 2025-08-12 17:22:34 -04:00
parent 5fe9b46c6f
commit 8db8378dfd
8 changed files with 451 additions and 324 deletions

View File

@ -574,4 +574,152 @@ Whether the token is verified by the Flipside team.
Example: true
{% enddocs %}
{% docs platform_address %}
The 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.
{% enddocs %}
{% docs pool_address %}
The 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.
{% enddocs %}
{% docs amount_in_raw %}
The 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.
{% enddocs %}
{% docs amount_out_raw %}
The 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.
{% enddocs %}
{% docs a_to_b %}
A 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.
{% enddocs %}
{% docs fee_amount_raw %}
The 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.
{% enddocs %}
{% docs partner_address %}
The 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.
{% enddocs %}
{% docs steps %}
The 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.
{% enddocs %}
{% docs token_in_type %}
The 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.
{% enddocs %}
{% docs token_out_type %}
The 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.
{% enddocs %}
{% docs trader_address %}
The 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.
{% enddocs %}
{% docs dex_swaps_id %}
A 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.
{% enddocs %}
{% docs platform %}
The name of the decentralized exchange platform where the swap occurred. Currently supports seven major Sui DEX protocols: Cetus, Turbos, Bluefin, Aftermath AMM, FlowX, DeepBook, and Momentum. This field enables protocol-specific analysis, performance comparison, and market share calculations across different DeFi platforms. Essential for filtering and grouping swap data by protocol.
{% enddocs %}
{% docs referral_amount_raw %}
The raw amount of referral rewards or commissions generated from this swap. Used by Cetus for their referral program to track referral program payouts. May be 0 for protocols without referral programs or when no referral was used. Important for referral program analytics and partner performance tracking. Essential for understanding the economic incentives and reward structures within DeFi protocols.
{% enddocs %}
{% docs _invocation_id %}
A 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.
{% enddocs %}
{% docs platform_name %}
The 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.
{% enddocs %}
{% docs platform_project_name %}
The project or company name associated with the DEX platform, extracted from address labeling data. This field provides organizational context for the platform, enabling corporate-level analysis and relationship mapping. May be NULL for platforms without established project labels. Useful for understanding platform ownership, partnerships, and ecosystem relationships.
{% enddocs %}
{% docs pool_name %}
The 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.
{% enddocs %}
{% docs pool_project_name %}
The project or protocol name associated with the liquidity pool, extracted from address labeling data. This field provides organizational context for the pool, enabling analysis of which protocols are providing liquidity for specific token pairs. May be NULL for pools without established project labels. Useful for understanding liquidity provider relationships and protocol partnerships.
{% enddocs %}
{% docs amount_in %}
The 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.
{% enddocs %}
{% docs amount_out %}
The 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.
{% enddocs %}
{% docs fee_amount %}
The 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.
{% enddocs %}
{% docs token_in_address %}
The 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.
{% enddocs %}
{% docs token_in_symbol %}
The 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.
{% enddocs %}
{% docs token_in_name %}
The 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.
{% enddocs %}
{% docs token_out_address %}
The 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.
{% enddocs %}
{% docs token_out_symbol %}
The 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.
{% enddocs %}
{% docs token_out_name %}
The 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.
{% enddocs %}
{% docs token_in_price %}
The 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.
{% enddocs %}
{% docs token_out_price %}
The 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.
{% enddocs %}
{% docs token_in_decimals %}
The 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.
{% enddocs %}
{% docs token_out_decimals %}
The 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.
{% enddocs %}
{% docs amount_in_usd %}
The 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.
{% enddocs %}
{% docs amount_out_usd %}
The 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.
{% enddocs %}
{% docs swap_volume_usd %}
The 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.
{% enddocs %}
{% docs trader_name %}
The human-readable name of the trader, derived from address labeling or defaulting to the trader address if no label exists. This field provides user-friendly trader identification for analytics and reporting. May include wallet names, exchange addresses, or other labeled entities. Essential for trader behavior analysis and wallet tracking.
{% enddocs %}
{% docs trader_project_name %}
The project or organization name associated with the trader address, extracted from address labeling data. This field provides organizational context for the trader, enabling analysis of institutional vs. retail trading patterns. May be NULL for individual traders without established project labels. Useful for understanding trading behavior by entity type.
{% enddocs %}

View File

@ -1,118 +0,0 @@
{% docs defi__ez_dex_swaps %}
## 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.
## 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
{% enddocs %}
{% docs platform_name %}
The 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.
{% enddocs %}
{% docs platform_project_name %}
The project or company name associated with the DEX platform, extracted from address labeling data. This field provides organizational context for the platform, enabling corporate-level analysis and relationship mapping. May be NULL for platforms without established project labels. Useful for understanding platform ownership, partnerships, and ecosystem relationships.
{% enddocs %}
{% docs pool_name %}
The 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.
{% enddocs %}
{% docs pool_project_name %}
The project or protocol name associated with the liquidity pool, extracted from address labeling data. This field provides organizational context for the pool, enabling analysis of which protocols are providing liquidity for specific token pairs. May be NULL for pools without established project labels. Useful for understanding liquidity provider relationships and protocol partnerships.
{% enddocs %}
{% docs amount_in %}
The 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.
{% enddocs %}
{% docs amount_out %}
The 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.
{% enddocs %}
{% docs fee_amount %}
The 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.
{% enddocs %}
{% docs token_in_address %}
The 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.
{% enddocs %}
{% docs token_in_symbol %}
The 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.
{% enddocs %}
{% docs token_in_name %}
The 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.
{% enddocs %}
{% docs token_out_address %}
The 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.
{% enddocs %}
{% docs token_out_symbol %}
The 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.
{% enddocs %}
{% docs token_out_name %}
The 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.
{% enddocs %}
{% docs token_in_price %}
The 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.
{% enddocs %}
{% docs token_out_price %}
The 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.
{% enddocs %}
{% docs token_in_decimals %}
The 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.
{% enddocs %}
{% docs token_out_decimals %}
The 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.
{% enddocs %}
{% docs amount_in_usd %}
The 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.
{% enddocs %}
{% docs amount_out_usd %}
The 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.
{% enddocs %}
{% docs swap_volume_usd %}
The 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.
{% enddocs %}
{% docs trader_name %}
The human-readable name of the trader, derived from address labeling or defaulting to the trader address if no label exists. This field provides user-friendly trader identification for analytics and reporting. May include wallet names, exchange addresses, or other labeled entities. Essential for trader behavior analysis and wallet tracking.
{% enddocs %}
{% docs trader_project_name %}
The project or organization name associated with the trader address, extracted from address labeling data. This field provides organizational context for the trader, enabling analysis of institutional vs. retail trading patterns. May be NULL for individual traders without established project labels. Useful for understanding trading behavior by entity type.
{% enddocs %}

View File

@ -1,93 +0,0 @@
{% docs silver__dex_swaps %}
## Description
This table consolidates decentralized exchange (DEX) swap events from multiple Sui blockchain protocols into a standardized format. It captures token swaps across seven major DEX platforms: Cetus, Turbos, Bluefin, Aftermath AMM, FlowX, DeepBook, and Momentum. The model extracts swap events from blockchain events, normalizes the data structure across different protocols, and provides consistent fields for DeFi analytics. Each swap event includes token amounts, fees, pool information, and trader details where available.
## Key Use Cases
- Cross-protocol DeFi volume analysis and comparison
- Token flow tracking and liquidity analysis
- DEX performance benchmarking and market share analysis
- Trader behavior analysis and wallet tracking
- Fee revenue analysis across different protocols
- Token pair popularity and trading volume trends
- Protocol-specific analytics and optimization insights
## Important Relationships
- Sources events from `gold.core.fact_events` filtered by specific DEX event types
- Enriches data with transaction details from `gold.core.fact_transactions`
- Can be joined with `gold.core.dim_tokens` for token metadata and pricing
- Supports downstream analytics in DeFi-specific curated models
- Provides foundation for cross-protocol DeFi dashboards and reports
## Commonly-used Fields
- `platform`: Essential for protocol-specific analysis and filtering
- `amount_in_raw` and `amount_out_raw`: Core fields for volume calculations and swap analysis
- `token_in_type` and `token_out_type`: Critical for token pair analysis and pricing
- `tx_digest` and `event_index`: Primary keys for linking to transaction details
- `block_timestamp`: Key field for time-series analysis and trend detection
- `pool_address`: Important for liquidity pool analysis and pool-specific metrics
- `trader_address`: Essential for wallet tracking and user behavior analysis
{% enddocs %}
{% docs platform %}
The name of the decentralized exchange platform where the swap occurred. Currently supports seven major Sui DEX protocols: Cetus, Turbos, Bluefin, Aftermath AMM, FlowX, DeepBook, and Momentum. This field enables protocol-specific analysis, performance comparison, and market share calculations across different DeFi platforms.
{% enddocs %}
{% docs platform_address %}
The 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. Useful for contract verification, security analysis, and linking to platform-specific metadata and configurations.
{% enddocs %}
{% docs pool_address %}
The 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 and liquidity analysis.
{% enddocs %}
{% docs amount_in_raw %}
The 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.
{% enddocs %}
{% docs amount_out_raw %}
The 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.
{% enddocs %}
{% docs a_to_b %}
A 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.
{% enddocs %}
{% docs fee_amount_raw %}
The 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.
{% enddocs %}
{% docs partner_address %}
The 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. Useful for tracking partner performance and affiliate program analytics.
{% enddocs %}
{% docs referral_amount_raw %}
The raw amount of referral rewards or commissions generated from this swap. Used by Cetus to track referral program payouts. May be 0 for protocols without referral programs or when no referral was used. Important for referral program analytics and partner performance tracking.
{% enddocs %}
{% docs steps %}
The 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.
{% enddocs %}
{% docs token_in_type %}
The 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.
{% enddocs %}
{% docs token_out_type %}
The 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.
{% enddocs %}
{% docs trader_address %}
The 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.
{% enddocs %}
{% docs dex_swaps_id %}
A unique surrogate key generated from the combination of tx_digest and event_index. 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.
{% enddocs %}
{% docs _invocation_id %}
A 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.
{% enddocs %}

View File

@ -41,4 +41,35 @@ Fact table decomposing every transaction on the Sui blockchain into its constitu
{% docs defi__ez_bridge_activity %}
Enhanced fact table providing comprehensive cross-chain bridge analytics by consolidating bridge-related events from multiple protocols (Sui Bridge, Wormhole) into a unified dataset. Each row represents a single cross-chain asset movement event enriched with protocol metadata, token information, and USD pricing. Serves as the primary table for cross-chain DeFi analysis, bridge protocol comparison, and capital flow tracking by normalizing bridge events across different protocols into a consistent format. The table automatically applies decimal precision adjustments and USD conversions, enabling direct comparison of bridge volumes and user activity across different chains and token types. Includes complete transaction context, source/destination chain mapping, and protocol identification to support comprehensive cross-chain analytics, security monitoring, and risk assessment. Essential for DeFi dashboards, bridge protocol analysis, and multi-chain ecosystem studies that require unified cross-chain data and standardized bridge event tracking.
{% enddocs %}
{% docs defi__ez_dex_swaps %}
## 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.
## 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
{% enddocs %}

View File

@ -0,0 +1,272 @@
version: 2
models:
- name: silver__aftermath_dex_swaps
config:
contract:
enforced: true
columns:
- name: CHECKPOINT_NUMBER
data_type: NUMBER(18,0)
description: "{{ doc('checkpoint_number') }}"
tests:
- not_null
- name: BLOCK_TIMESTAMP
data_type: TIMESTAMP_NTZ
description: "{{ doc('block_timestamp') }}"
tests:
- not_null
- name: TX_DIGEST
data_type: VARCHAR
description: "{{ doc('tx_digest') }}"
tests:
- not_null
- name: EVENT_INDEX
data_type: NUMBER(18,0)
description: "{{ doc('event_index') }}"
tests:
- not_null
- name: TYPE
data_type: VARCHAR
description: "{{ doc('type') }}"
- name: EVENT_MODULE
data_type: VARCHAR
description: "{{ doc('event_module') }}"
tests:
- not_null
- name: EVENT_RESOURCE
data_type: VARCHAR
description: "{{ doc('event_resource') }}"
- name: TRANSACTION_MODULE
data_type: VARCHAR
description: "{{ doc('transaction_module') }}"
- name: PLATFORM_ADDRESS
data_type: VARCHAR
description: "{{ doc('platform_address') }}"
tests:
- not_null
- name: POOL_ADDRESS
data_type: VARCHAR
description: "{{ doc('pool_address') }}"
- name: AMOUNT_IN_RAW
data_type: NUMBER(38,0)
description: "{{ doc('amount_in_raw') }}"
tests:
- not_null
- dbt_utils.expression_is_true:
expression: ">= 0"
- name: AMOUNT_OUT_RAW
data_type: NUMBER(38,0)
description: "{{ doc('amount_out_raw') }}"
tests:
- not_null
- dbt_utils.expression_is_true:
expression: ">= 0"
- name: A_TO_B
data_type: BOOLEAN
description: "{{ doc('a_to_b') }}"
- name: FEE_AMOUNT_RAW
data_type: NUMBER(38,0)
description: "{{ doc('fee_amount_raw') }}"
- name: PARTNER_ADDRESS
data_type: VARCHAR
description: "{{ doc('partner_address') }}"
- name: STEPS
data_type: NUMBER(18,0)
description: "{{ doc('steps') }}"
tests:
- not_null
- dbt_utils.expression_is_true:
expression: "> 0"
- name: TOKEN_IN_TYPE
data_type: VARCHAR
description: "{{ doc('token_in_type') }}"
tests:
- not_null
- name: TOKEN_OUT_TYPE
data_type: VARCHAR
description: "{{ doc('token_out_type') }}"
tests:
- not_null
- name: TRADER_ADDRESS
data_type: VARCHAR
description: "{{ doc('trader_address') }}"
tests:
- not_null
- name: DEX_SWAPS_ID
data_type: VARCHAR
description: "{{ doc('dex_swaps_id') }}"
tests:
- not_null
- unique
- name: INSERTED_TIMESTAMP
data_type: TIMESTAMP_NTZ
description: "{{ doc('inserted_timestamp') }}"
- name: MODIFIED_TIMESTAMP
data_type: TIMESTAMP_NTZ
description: "{{ doc('modified_timestamp') }}"
- name: _INVOCATION_ID
data_type: TEXT
description: "{{ doc('_invocation_id') }}"
tests:
- dbt_utils.recency:
datepart: hour
interval: 6
field: block_timestamp
- name: silver__dex_swaps
config:
contract:
enforced: true
columns:
- name: CHECKPOINT_NUMBER
data_type: NUMBER(18,0)
description: "{{ doc('checkpoint_number') }}"
tests:
- not_null
- name: BLOCK_TIMESTAMP
data_type: TIMESTAMP_NTZ
description: "{{ doc('block_timestamp') }}"
tests:
- not_null
- name: TX_DIGEST
data_type: VARCHAR
description: "{{ doc('tx_digest') }}"
tests:
- not_null
- name: EVENT_INDEX
data_type: NUMBER(18,0)
description: "{{ doc('event_index') }}"
tests:
- not_null
- name: TYPE
data_type: VARCHAR
description: "{{ doc('type') }}"
- name: EVENT_MODULE
data_type: VARCHAR
description: "{{ doc('event_module') }}"
tests:
- not_null
- name: EVENT_RESOURCE
data_type: VARCHAR
description: "{{ doc('event_resource') }}"
- name: TRANSACTION_MODULE
data_type: VARCHAR
description: "{{ doc('transaction_module') }}"
- name: PLATFORM_ADDRESS
data_type: VARCHAR
description: "{{ doc('platform_address') }}"
tests:
- not_null
- name: POOL_ADDRESS
data_type: VARCHAR
description: "{{ doc('pool_address') }}"
- name: AMOUNT_IN_RAW
data_type: NUMBER(38,0)
description: "{{ doc('amount_in_raw') }}"
tests:
- not_null
- dbt_utils.expression_is_true:
expression: ">= 0"
- name: AMOUNT_OUT_RAW
data_type: NUMBER(38,0)
description: "{{ doc('amount_out_raw') }}"
tests:
- not_null
- dbt_utils.expression_is_true:
expression: ">= 0"
- name: A_TO_B
data_type: BOOLEAN
description: "{{ doc('a_to_b') }}"
- name: FEE_AMOUNT_RAW
data_type: NUMBER(38,0)
description: "{{ doc('fee_amount_raw') }}"
- name: PARTNER_ADDRESS
data_type: VARCHAR
description: "{{ doc('partner_address') }}"
- name: STEPS
data_type: NUMBER(18,0)
description: "{{ doc('steps') }}"
tests:
- not_null
- dbt_utils.expression_is_true:
expression: "> 0"
- name: TOKEN_IN_TYPE
data_type: VARCHAR
description: "{{ doc('token_in_type') }}"
tests:
- not_null
- name: TOKEN_OUT_TYPE
data_type: VARCHAR
description: "{{ doc('token_out_type') }}"
tests:
- not_null
- name: TRADER_ADDRESS
data_type: VARCHAR
description: "{{ doc('trader_address') }}"
tests:
- not_null
- name: DEX_SWAPS_ID
data_type: VARCHAR
description: "{{ doc('dex_swaps_id') }}"
tests:
- not_null
- unique
- name: INSERTED_TIMESTAMP
data_type: TIMESTAMP_NTZ
description: "{{ doc('inserted_timestamp') }}"
- name: MODIFIED_TIMESTAMP
data_type: TIMESTAMP_NTZ
description: "{{ doc('modified_timestamp') }}"
- name: _INVOCATION_ID
data_type: TEXT
description: "{{ doc('_invocation_id') }}"
tests:
- dbt_utils.recency:
datepart: hour
interval: 6
field: block_timestamp

View File

@ -1,113 +0,0 @@
version: 2
models:
- name: silver__dex_swaps
description: "{{ doc('silver__dex_swaps') }}"
tests:
- dbt_utils.recency:
datepart: hour
interval: 6
field: block_timestamp
columns:
- name: CHECKPOINT_NUMBER
description: "{{ doc('checkpoint_number') }}"
tests:
- not_null
- name: BLOCK_TIMESTAMP
description: "{{ doc('block_timestamp') }}"
tests:
- not_null
- name: TX_DIGEST
description: "{{ doc('tx_digest') }}"
tests:
- not_null
- name: EVENT_INDEX
description: "{{ doc('event_index') }}"
tests:
- not_null
- name: TYPE
description: "{{ doc('type') }}"
- name: EVENT_MODULE
description: "{{ doc('event_module') }}"
tests:
- not_null
- name: EVENT_RESOURCE
description: "{{ doc('event_resource') }}"
- name: TRANSACTION_MODULE
description: "{{ doc('transaction_module') }}"
- name: PLATFORM_ADDRESS
description: "{{ doc('platform_address') }}"
tests:
- not_null
- name: POOL_ADDRESS
description: "{{ doc('pool_address') }}"
- name: AMOUNT_IN_RAW
description: "{{ doc('amount_in_raw') }}"
tests:
- not_null
- dbt_utils.expression_is_true:
expression: ">= 0"
- name: AMOUNT_OUT_RAW
description: "{{ doc('amount_out_raw') }}"
tests:
- not_null
- dbt_utils.expression_is_true:
expression: ">= 0"
- name: A_TO_B
description: "{{ doc('a_to_b') }}"
- name: FEE_AMOUNT_RAW
description: "{{ doc('fee_amount_raw') }}"
- name: PARTNER_ADDRESS
description: "{{ doc('partner_address') }}"
- name: STEPS
description: "{{ doc('steps') }}"
tests:
- not_null
- dbt_utils.expression_is_true:
expression: "> 0"
- name: TOKEN_IN_TYPE
description: "{{ doc('token_in_type') }}"
tests:
- not_null
- name: TOKEN_OUT_TYPE
description: "{{ doc('token_out_type') }}"
tests:
- not_null
- name: TRADER_ADDRESS
description: "{{ doc('trader_address') }}"
tests:
- not_null
- name: DEX_SWAPS_ID
description: "{{ doc('dex_swaps_id') }}"
tests:
- not_null
- unique
- name: INSERTED_TIMESTAMP
description: "{{ doc('inserted_timestamp') }}"
- name: MODIFIED_TIMESTAMP
description: "{{ doc('modified_timestamp') }}"
- name: _INVOCATION_ID
description: "{{ doc('_invocation_id') }}"