sepehrmhz8Untitled Query
    Updated 2022-11-28
    select 'Ethereum' as Net,
    date_trunc('week',block_timestamp) as date,
    tx_status,
    count (distinct tx_hash) as Swap_Count,
    count (distinct Origin_from_address) as Swappers_Count,
    count (distinct contract_address) as Pools_Count,
    sum(Swap_Count) over (order by date) as cumulative_Swap_Count,
    sum(Swappers_Count) over (order by date) as cumulative_Swappers_Count
    from ethereum.core.fact_event_logs
    where origin_to_address = '0xdef171fe48cf0115b1d80b88dc8eab59176fee57'
    and event_name = 'Swap'
    and block_timestamp::date >= '2022-07-10'
    group by 1,2,3

    union all

    select 'Optimism' as Net,
    date_trunc('week',block_timestamp) as date,
    count (distinct tx_hash) as Swap_Count,
    count (distinct Origin_from_address) as Swappers_Count,
    count (distinct contract_address) as Pools_Count,
    count (case when tx_status != 'SUCCESS' then 1 end) as Failed_TX,
    count (case when tx_status = 'SUCCESS' then 1 end) as Success_TX,
    (Success_TX / (Success_TX + Failed_TX)) * 100 as Success_Rate,
    sum(Swap_Count) over (order by date) as cumulative_Swap_Count,
    sum(Swappers_Count) over (order by date) as cumulative_Swappers_Count
    from optimism.core.fact_event_logs
    where origin_to_address = '0xdef171fe48cf0115b1d80b88dc8eab59176fee57'
    and event_name = 'Swap'
    and block_timestamp::date >= '2022-07-10'
    group by 1,2

    union all

    select 'Arbitrum' as Net,
    date_trunc('week',block_timestamp) as date,