ArioAvalanche Swaps vs Transfers (Redux) - swap vs transfer Daily
    Updated 2022-12-08
    select
    'Swap' as Status,
    date_trunc('day', block_timestamp) as date,
    count(distinct tx_hash) as "# TXs",
    count(distinct origin_from_address) as "# Wallets",
    sum(event_inputs:value/pow(10,6)) as VOLUME,
    avg(event_inputs:value/pow(10,6)) as "Avg Volume"
    from
    avalanche.core.fact_event_logs
    where 1=1
    and
    tx_hash in (select distinct tx_hash from avalanche.core.fact_event_logs where event_name = 'Swap')
    and
    block_timestamp >= '2022-07-01'
    and
    contract_address = '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e'
    and
    tx_status = 'SUCCESS'
    and
    event_inputs:value/pow(10,6) < pow(10,9)
    group by 1,2

    union ALL

    select
    'Transfer' as Status,
    date_trunc('day', block_timestamp) as date,
    count(distinct tx_hash) as "# TXs",
    count(distinct origin_from_address) as "# Wallets",
    sum(event_inputs:value/pow(10,6)) as VOLUME,
    avg(event_inputs:value/pow(10,6)) as "Avg Volume"
    from
    avalanche.core.fact_event_logs
    where 1=1
    and
    tx_hash not in (select distinct tx_hash from avalanche.core.fact_event_logs where event_name = 'Swap')
    Run a query to Download Data