alexmcculloughEthereum Flow
    Updated 2024-11-14
    -- Adjusted query to track Coinbase flows on the Ethereum blockchain
    -- Includes transfers involving 'hot_wallet' and 'deposit_wallet' addresses
    -- Excludes internal transfers and transfers involving other label_subtypes

    WITH coinbase_transfers AS (
    SELECT
    ent.tx_hash,
    ent.block_timestamp,
    date_trunc('month', ent.block_timestamp) AS date,
    'ETH' AS token_symbol,
    ent.amount AS amount_token, -- Amount in ETH
    ent.amount_usd,
    ent.from_address,
    ent.to_address
    FROM
    ethereum.core.ez_native_transfers AS ent
    WHERE
    ent.block_timestamp >= CURRENT_DATE - INTERVAL '48 months'

    UNION ALL

    SELECT
    ett.tx_hash,
    ett.block_timestamp,
    date_trunc('month', ett.block_timestamp) AS date,
    ett.symbol AS token_symbol,
    ett.amount, -- Amount in tokens
    ett.amount_usd,
    ett.from_address,
    ett.to_address
    FROM
    ethereum.core.ez_token_transfers AS ett
    WHERE
    ett.block_timestamp >= CURRENT_DATE - INTERVAL '48 months'
    AND ett.symbol NOT IN ('BabyGrok', 'XCOM') -- Exclude problematic tokens
    )
    QueryRunArchived: QueryRun has been archived