hessShare of Swaps
    Updated 2022-12-21
    with swap_tx as ( select tx_hash
    from ethereum.core.fact_event_logs
    where event_name ilike '%swap%'
    and block_timestamp::date >= '2022-01-01')
    ,
    dex_name as (select address , label
    from ethereum.core.dim_labels
    where label_type = 'dex')
    ,
    swap_platform as ( select date(block_timestamp) as date, LABEL, tx_hash , amount_usd, origin_from_address
    from ethereum.core.ez_token_transfers a join dex_name b on a.origin_to_address = b.address
    where tx_hash in (select tx_hash from swap_tx)
    and amount_usd > 0 and amount_usd < 1e10
    and block_timestamp::date >= '2022-01-01'
    and symbol is not null
    and label != 'dex'
    UNION
    select date(block_timestamp) as date, platform as label, tx_hash, amount_in_usd as amount_usd , origin_from_address
    from ethereum.core.ez_dex_swaps
    where amount_in_usd < 60000000
    and amount_in_usd is not null
    and platform in ('synthetix','curve','balancer')
    and date >= '2022-01-01'
    )


    select case when label ilike '%zapper%' then 'Zapper' else label end as platforms,
    count(tx_hash) as total_swap
    from swap_platform
    where label in ('uniswap','1inch','sushiswap','Zapper','balancer','0x','kybernetwork','kyberswap','metamask','curve','synthetix')
    group by 1


    Run a query to Download Data