--darvishi
with base as (select tx_hash
from
avalanche.core.fact_event_logs
where
event_name = 'Swap'
and block_timestamp >= '2022-07-29'),
base2 as (select tx_hash,
sum(event_inputs:value/1e6) as swap_size
from avalanche.core.fact_event_logs
where
contract_address = '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e'
and event_name = 'Transfer'
and tx_hash in (select tx_hash from base)
group by 1),
base3 as (select tx_hash,
sum(event_inputs:value/1e6) as transfer_size
from avalanche.core.fact_event_logs
where
contract_address = '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e'
and event_name = 'Transfer'
and tx_hash not in (select tx_hash from base)
and
block_timestamp >= '2022-07-29'
group by 1)
select
avg(swap_size),
'Swaps'
from base2
union
select