HosseinOvertime
    Updated 2024-05-30
    with

    t as (
    select
    hour::date as date,
    avg(price) as price_usd
    from ethereum.price.ez_hourly_token_prices
    where symbol = 'WETH'
    group by 1
    ),

    t2 as (
    select
    tx_hash,
    block_timestamp,
    amount_in_usd as amount_usd,
    origin_from_address as swapper,
    tx_fee * price_usd as tx_fee_usd,
    case platform
    when 'pancakeswap-v2' then 'pancakeswap'
    when 'kyberswap-v2' then 'kyberswap'
    when 'pancakeswap-v3' then 'pancakeswap'
    when 'hashflow-v3' then 'hashflow'
    when 'kyberswap-v1' then 'kyberswap'
    when 'dodo-v1' then 'dodo'
    when 'uniswap-v2' then 'uniswap'
    when 'trader-joe-v2' then 'trader-joe'
    when 'uniswap-v3' then 'uniswap'
    when 'dodo-v2' then 'dodo'
    else platform
    end as platform
    from ethereum.defi.ez_dex_swaps
    join ethereum.core.fact_transactions
    using(tx_hash, block_timestamp)
    join t on block_timestamp::date = date
    where platform != 'balancer'
    QueryRunArchived: QueryRun has been archived