pouya_22True Freeze - 4. My Next Purchase - Over time
    Updated 2022-08-05
    with events as (select
    event_name,
    count(distinct tx_hash) as number_of_txs
    from ethereum.core.fact_event_logs
    where origin_from_address in (select distinct origin_from_address from ethereum.core.fact_event_logs where contract_address = '0xb4bd4628e6efb0cb521d9ec35050c75840320374')
    and origin_to_address != '0xb4bd4628e6efb0cb521d9ec35050c75840320374'
    and block_timestamp::date = (select min(block_timestamp)::date from ethereum.core.fact_event_logs where contract_address = '0xb4bd4628e6efb0cb521d9ec35050c75840320374')
    group by 1
    having event_name is not null
    order by 2 desc
    limit 10)

    -- select
    -- t.block_timestamp::date as date,
    -- event_name,
    -- count(distinct t.tx_hash) as number_of_txs,
    -- count(distinct origin_from_address) as number_of_users,
    -- sum(eth_value) as volume
    -- from ethereum.core.fact_event_logs e
    -- join ethereum.core.fact_transactions t on e.tx_hash = t.tx_hash
    -- where origin_from_address in (select distinct origin_from_address from ethereum.core.fact_event_logs where contract_address = '0xb4bd4628e6efb0cb521d9ec35050c75840320374')
    -- and origin_to_address != '0xb4bd4628e6efb0cb521d9ec35050c75840320374'
    -- and event_name in (select event_name from events)
    -- and contract_address = '0xb4bd4628e6efb0cb521d9ec35050c75840320374'
    -- group by 1,2

    select
    e.block_timestamp::date as date,
    event_name,
    count(distinct e.tx_hash) as number_of_txs,
    count(distinct origin_from_address) as number_of_users,
    sum(eth_value) as volume
    from ethereum.core.fact_event_logs e
    join ethereum.core.fact_transactions t on e.tx_hash = t.tx_hash
    where contract_address = '0xb4bd4628e6efb0cb521d9ec35050c75840320374'
    and event_name in (select event_name from events)
    Run a query to Download Data