adriaparcerisasMetamask vs. Other Platforms 4
    Updated 2022-06-23
    -- How many users are swapping via MetaMask vs other platforms?
    -- How much volume have these users done?
    -- Chart a comparison between the two, and show the following metrics over a time period of your choosing:
    -- transaction volume, average amount swapped, and a comparison of fees

    WITH
    metamask_wallets as (
    SELECT
    distinct origin_from_address as metamask_wallets
    from ethereum.core.fact_event_logs
    where contract_address=lower('0x881D40237659C251811CEC9c364ef91dC08D300C')
    ),
    swaps as (
    select
    trunc(block_timestamp,'day') as date,
    case when origin_from_address in (select * from metamask_wallets) then 'Metamask'
    else 'Others' end as platform,
    count(distinct tx_hash) as n_swaps,
    avg(amount_in_usd) as avg_inflow_swapped,
    avg(amount_out_usd) as avg_outflow_swapped
    from ethereum.core.ez_dex_swaps where block_timestamp>='2022-01-01' and amount_in_usd <1e9 and amount_out_usd <1e9
    group by 1,2
    ),
    transactions as (
    select
    trunc(block_timestamp,'day') as date,
    case when from_address in (select * from metamask_wallets) then 'Metamask'
    else 'Others' end as platform,
    count(distinct tx_hash) as n_transactions,
    sum(tx_fee) as daily_fees,
    avg(tx_fee) as avg_tx_fees
    from ethereum.core.fact_transactions where block_timestamp>='2022-01-01'
    group by 1,2
    )
    SELECT
    x.date,
    Run a query to Download Data