Afonso_Diaz2023-11-11 10:03 PM
    Updated 2023-11-11
    with
    t0 as (
    select
    hour::date as date,
    symbol,
    avg(price) as price_usd
    from ethereum.price.ez_hourly_token_prices
    where symbol in ('WETH', 'WAVAX', 'MATIC')
    group by 1, 2
    ),

    t as (
    select
    tx_hash,
    block_timestamp,
    'Ethereum' as chain,
    amount_in_usd,
    amount_out_usd,
    origin_from_address as swapper,
    symbol_in,
    symbol_out,
    token_in,
    token_out,
    tx_fee * price_usd as tx_fee_usd
    from ethereum.defi.ez_dex_swaps
    join ethereum.core.fact_transactions
    using(tx_hash)
    join t0 on block_timestamp::date = date and t0.symbol = 'WETH'
    where platform = 'curve'

    union all

    select
    tx_hash,
    block_timestamp,
    'Polygon' as chain,
    Run a query to Download Data