Skip to main content
Schema: somnia.core Table: dim_contracts Type: Base Table

What

This table provides comprehensive metadata for all smart contracts deployed on EVM blockchains. It includes contract names, symbols, decimals, and deployment details read directly from the blockchain.

Key Use Cases

  • Identifying contracts by name, symbol, or address
  • Understanding token properties (decimals, symbols)
  • Tracking contract deployment patterns and trends
  • Finding contracts deployed by specific factories or deployers
  • Filtering protocol-specific data across other tables

Important Relationships

  • Join with fact_transactions: Use address = to_address for contract interactions
  • Join with fact_event_logs: Use address = contract_address for contract events
  • Join with ez_token_transfers: Use address = contract_address for token movements

Commonly-used Fields

  • address: The deployed contract’s blockchain address (lowercase)
  • name: Human-readable contract name from the name() function
  • symbol: Token/contract symbol from the symbol() function
  • decimals: Number of decimal places for token amounts
  • creator_address: Address that deployed this contract
  • created_block_timestamp: When the contract was created

Sample queries

Find All Uniswap V3 Pool Contracts
SELECT 
    address,
    name,
    created_block_number,
    created_block_timestamp,
    creator_address
FROM <blockchain_name>.core.dim_contracts
WHERE creator_address = LOWER('0x1F98431c8aD98523631AE4a59f267346ea31F984') -- Uniswap V3 Factory
ORDER BY created_block_number DESC
LIMIT 100;
Analyze Contract Deployment Trends
SELECT 
    DATE_TRUNC('week', created_block_timestamp) AS week,
    COUNT(*) AS contracts_deployed,
    COUNT(DISTINCT creator_address) AS unique_deployers
FROM <blockchain_name>.core.dim_contracts
WHERE created_block_timestamp >= CURRENT_DATE - 90
GROUP BY 1, 2
ORDER BY 1 DESC, 3 DESC;

Columns

Column NameData TypeDescription
ADDRESSTEXTUnique identifier - the deployed contract’s blockchain address. Example: ‘0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48’
SYMBOLTEXTToken/contract symbol from the symbol() function. Example: ‘USDC’
NAMETEXTHuman-readable contract name from the name() function. Example: ‘USD Coin’
DECIMALSNUMBERNumber of decimal places for token amounts, read directly from the contract code. Example: 6
CREATED_BLOCK_NUMBERNUMBERBlock number when contract was created. Example: 17500000
CREATED_BLOCK_TIMESTAMPTIMESTAMP_NTZTimestamp when contract was created. Example: 2023-06-15 14:30:00.000
CREATED_TX_HASHTEXTTransaction hash of the contract deployment. Example: ‘0x4f01db1f857e711af502ad6fa8b5b3ccd9e36b5f8c8a7b2c1d3e4f5a6b7c8d9e’
CREATOR_ADDRESSTEXTAddress that deployed this contract (transaction from_address). Example: ‘0x95ba4cf87d6723ad9c0db21737d862be80e93911’
DIM_CONTRACTS_IDTEXTPrimary key - unique identifier for each row ensuring data integrity. Format: Usually VARCHAR containing composite key generated using MD5 hash of the relevant columns. Example: MD5(blocknumber, txhash, trace_index) Usage: Deduplication in incremental loads Join operations for data quality checks Troubleshooting specific records Important: Implementation varies by table - check table-specific documentation.
INSERTED_TIMESTAMPTIMESTAMP_NTZUTC timestamp when the record was first added to the Flipside database. Format: TIMESTAMP_NTZ Use Cases: Data freshness monitoring Incremental processing markers Debugging data pipeline issues SLA tracking Query Example:
MODIFIED_TIMESTAMPTIMESTAMP_NTZUTC timestamp of the most recent update to this record. Format: TIMESTAMP_NTZ Triggers for Updates: Data corrections Enrichment additions Reprocessing for accuracy Schema migrations Monitoring Usage: