Hemin1.1 swap vs transfer total data
    Updated 2022-12-04
    with allswaps as (select *
    from avalanche.core.fact_event_logs
    where BLOCK_TIMESTAMP::date >= '202-07-01' and tx_status = 'SUCCESS' and EVENT_NAME = 'Swap'),
    transfer as (
    select *, event_inputs:value/1e6 as usd_volume from avalanche.core.fact_event_logs
    where BLOCK_TIMESTAMP::date >= '202-07-01' and CONTRACT_ADDRESS ='0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e'and tx_status = 'SUCCESS' and EVENT_NAME = 'Transfer' and tx_hash not in (select tx_hash from allswaps ))
    , usd_swaps as (
    select *, event_inputs:value/1e6 as usd_volume from avalanche.core.fact_event_logs
    where BLOCK_TIMESTAMP::date >= '202-07-01' and CONTRACT_ADDRESS ='0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e'and tx_status = 'SUCCESS' and EVENT_NAME = 'Transfer' and tx_hash in (select tx_hash from allswaps ))
    , burn as (
    select * from avalanche.core.fact_event_logs
    where BLOCK_TIMESTAMP::date >= '202-07-01' and CONTRACT_ADDRESS ='0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e'and tx_status = 'SUCCESS' and EVENT_NAME = 'Burn' )
    , mint as (
    select * from avalanche.core.fact_event_logs
    where BLOCK_TIMESTAMP::date >= '202-07-01' and CONTRACT_ADDRESS ='0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e'and tx_status = 'SUCCESS' and EVENT_NAME = 'Mint' )

    select
    'Transfer' as type ,
    count(tx_hash ) as num_transfer ,
    count(DISTINCT tx_hash ) as num_uniqe_tx,
    count(DISTINCT ORIGIN_FROM_ADDRESS ) as num_sender ,
    count(DISTINCT ORIGIN_TO_ADDRESS ) as num_reciver ,
    sum(usd_volume) as total_usd ,
    avg(usd_volume) as avg_usd ,
    median(usd_volume) as median_usd
    from transfer
    UNION
    select
    'Swaps' as type ,
    count(tx_hash ) as num_transfer ,
    count(DISTINCT tx_hash ) as num_uniqe_tx,
    count(DISTINCT ORIGIN_FROM_ADDRESS ) as num_sender ,
    count(DISTINCT ORIGIN_TO_ADDRESS ) as num_reciver ,
    sum(usd_volume) as total_usd ,
    avg(usd_volume) as avg_usd ,
    Run a query to Download Data