hessTop Pairs Based on Volume
    Updated 2023-03-30
    -- forked from f1e154ac-2b63-45b6-add3-2c3bee5282b0

    with swap as ( select tx_hash
    from arbitrum.core.fact_event_logs
    where event_name ilike '%swap%')

    ,
    from_1 as ( select date(block_timestamp) as date, tx_hash, origin_from_address, contract_address, 'ARB' as symbol_in, raw_amount/pow(10,18)*1.2 as amount
    from arbitrum.core.fact_token_transfers a join arbitrum.core.dim_labels b on a.to_address = b.address
    where tx_hash in (select tx_hash from swap)
    and label_type = 'dex'
    and contract_address = lower('0x912CE59144191C1204E64559FE8253a0e49E6548')
    and block_timestamp >= '2023-03-23'
    and project_name not ilike '%sushiswap%')
    ,
    to_2 as ( select tx_hash, origin_from_address, contract_address, symbol as symbol_out, raw_amount/pow(10,18)*1.2 as amount
    from arbitrum.core.fact_token_transfers a join arbitrum.core.dim_labels b on a.to_address = b.address
    join arbitrum.core.dim_contracts c on a.contract_address = c.address
    where tx_hash in (select tx_hash from swap)
    and label_type = 'dex'
    and contract_address != lower('0x912CE59144191C1204E64559FE8253a0e49E6548')
    and block_timestamp >= '2023-03-23'
    and project_name not ilike '%sushiswap%')
    ,
    final_1 as ( select date, concat(symbol_in,'/',symbol_out) as pair,a.tx_hash , a.amount as volume
    from from_1 a join to_2 b on a.tx_hash = b.tx_hash
    where symbol_in is not null
    and symbol_out is not null
    UNION
    select date(block_timestamp) as date, concat(symbol_in,'/',symbol_out) as pair,tx_hash , amount_in_usd as volume
    from arbitrum.sushi.ez_swaps
    where block_timestamp >= '2023-03-10')


    select case when date < '2023-03-23' then 'Before Airdrop' else 'After Airdrop' end as type,
    pair, count(DISTINCT(tx_hash)) as total_tx, sum(volume) as total_volume,
    Run a query to Download Data