Afonso_Diazmetamask-1
    Updated 2023-03-08
    with t as (
    select
    count(distinct tx_hash) as swaps,
    count(distinct origin_from_address) as active_swappers,
    sum(tx_fee) as total_fee_eth,
    sum(amount_in_usd) as volume_usd,
    avg(amount_in_usd) as average_volume_usd,
    median(amount_in_usd) as median_volume_usd
    from ethereum.core.fact_event_logs
    join ethereum.core.fact_transactions
    using(tx_hash)
    join ethereum.core.ez_dex_swaps a
    using(tx_hash)
    where contract_address = '0x881d40237659c251811cec9c364ef91dc08d300c' --metamask
    and block_timestamp > current_date - interval '6 months'
    ),

    t2 as (
    select
    block_timestamp::date as day,
    count(distinct tx_hash) as swaps,
    count(distinct origin_from_address) as active_swappers,
    sum(tx_fee) as total_fee_eth
    from ethereum.core.fact_event_logs
    join ethereum.core.fact_transactions
    using(tx_hash)
    where contract_address = '0x881d40237659c251811cec9c364ef91dc08d300c' --metamask
    and block_timestamp > current_date - interval '6 months'
    group by 1
    ),

    t3 as (
    select
    avg(swaps) as daily_average_swaps,
    avg(active_swappers) as daily_average_active_swappers
    from t2
    Run a query to Download Data