kiacryptodaily fee info - sushiswap
    Updated 2022-10-16
    with token_price as (
    select
    date_trunc('day', hour) as day,
    case when token_address is null then 'ETH' else 'Matic' end as token,
    avg(price) as price
    from ethereum.core.fact_hourly_token_prices
    where token_address is null or token_address = '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0'
    group by 1, 2
    )
    select
    date_trunc('week', s.block_timestamp) as date,
    sum(tx_fee * price) as fee_usd,
    avg(tx_fee * price) as avg_fee_usd,
    sum(fee_usd) over (order by date) as cum_fee_usd,
    'Arbitrum' as blockchain
    from arbitrum.sushi.ez_swaps s join arbitrum.core.fact_transactions t on s.tx_hash = t.tx_hash join token_price on s.block_timestamp::date = day
    where token = 'ETH' and platform = 'sushiswap' and event_name = 'Swap' and tx_fee is not null
    group by 1
    union all
    select
    date_trunc('week', s.block_timestamp) as date,
    sum(tx_fee * price) as fee_usd,
    avg(tx_fee * price) as avg_fee_usd,
    sum(fee_usd) over (order by date) as cum_fee_usd,
    'Optimism' as blockchain
    from optimism.sushi.ez_swaps s join optimism.core.fact_transactions t on s.tx_hash = t.tx_hash join token_price on s.block_timestamp::date = day
    where token = 'ETH' and platform = 'sushiswap' and tx_fee is not null
    group by 1
    union all
    select
    Run a query to Download Data