with main as (
select
swaps.BLOCK_TIMESTAMP as date,
swaps.TX_HASH as tx_id,
ORIGIN_TO_ADDRESS as contract,
tx.FEE_USD as fee
from ethereum.core.ez_dex_swaps swaps
join flipside_prod_db.ethereum.transactions tx
on swaps.TX_HASH=tx.TX_ID
)
select
date_trunc('day', date) as date,
case when contract ='0x881d40237659c251811cec9c364ef91dc08d300c' then 'metamask'
else 'others' end as category,
sum(fee) as fee
from main
where date>='2021-01-01'
group by 1,2