with sushi as (
select *
from ethereum.dex_swaps
where --block_timestamp::date >= getdate() - interval '1 year' and
platform = 'sushiswap'
)
, txn_fees as (
select *
from ethereum.transactions
where block_timestamp::date >= getdate() - interval '1 year' and
success = TRUE
)
select
date_trunc('week',y.block_timestamp)::Date as Week, sum(y.fee_usd) as transaction_fees
from sushi as x, txn_fees as y
where x.tx_id = y.tx_id
and y.block_timestamp::date >= getdate() - interval '1 year'
group by 1
order by 1