h4wkavalanche 3
    Updated 2024-09-16
    with price as (
    select hour::date as price_date,
    token_address,
    symbol,
    decimals,
    avg(price) as price
    from avalanche.price.ez_prices_hourly
    group by 1,2,3,4
    )
    , avax_price as (
    select hour::date as price_date,
    token_address,
    symbol,
    decimals,
    avg(price) as avax_price
    from avalanche.price.ez_prices_hourly
    where symbol = 'WAVAX'
    group by 1,2,3,4
    )
    , base_from_avalanche as (
    select distinct tx_hash
    from avalanche.core.fact_token_transfers t
    where 1 = 1
    and block_timestamp >= '2023-04-01' and block_timestamp < CURRENT_DATE
    and to_address = '0xef4fb24ad0916217251f553c0596f8edc630eb66'
    )
    , from_avalanche as (
    select block_timestamp::date as date,
    'From Avalanche' as type,
    p.symbol,
    raw_amount/pow(10,p.decimals) as amount,
    amount*price as volume_usd,
    origin_from_address as user_address,
    tx_hash
    from avalanche.core.fact_token_transfers t
    join price p ON (contract_address = token_address and block_timestamp::date = p.price_date)
    Auto-refreshes every 24 hours
    QueryRunArchived: QueryRun has been archived