theericstonebig_fee_binance_spenders
    Updated 2020-11-12
    WITH feetx AS (
    select
    etx.tx_id
    from gold.ethereum_transactions etx
    where
    etx.to_label_subtype = 'distributor_cex_satellite'
    --AND LOWER(etx.to_label) = 'binance'
    AND etx.from_label_type NOT IN ('distributor','project')
    AND etx.fee_usd > 0
    --AND ee.block_timestamp > getdate() - interval '1 week'
    AND etx.block_timestamp > getdate() - interval '2 months'
    ),
    deposits AS (
    select
    ee.from_address as from_address,
    ee.from_address_name as account_name_if_applicable,
    ee.to_label,
    ee.symbol,
    sum(ee.amount_usd) as transferred_usd
    from gold.ethereum_events ee
    JOIN feetx on feetx.tx_id = ee.tx_id
    where ee.block_timestamp > getdate() - interval '2 months'
    group by 1,2,3,4
    ),
    feespaid AS (
    select
    et.from_address as from_address,
    et.from_address_name as account_name_if_applicable,
    et.to_label,
    count(et.tx_id) as n_transactions,
    count(distinct(to_address)) as n_to_addresses,
    sum(et.fee_usd) as fees_paid_usd
    from gold.ethereum_transactions et
    join feetx on feetx.tx_id = et.tx_id
    group by from_address, account_name_if_applicable, et.to_label
    )
    Run a query to Download Data