potmoVELO hourly Price
    Updated 2023-02-06
    with price_per_swap as (
    select block_timestamp,
    flipside_prod_db.tokenflow_eth.hextoint(substring(data,1,66)) /1e18 as token0,
    flipside_prod_db.tokenflow_eth.hextoint(substring(data,67,130)) /1e6 as token1,
    token1 / token0 as velo_price
    from optimism.core.fact_event_logs
    where 1
    --and tx_hash ilike '0x0e7c77137eff40da43e88a4ea6e16f7cd924a8e7dd0ffb1f04ee35bfc3522aa4'
    and contract_address ilike '0xe8537b6ff1039cb9ed0b71713f697ddbadbb717d'
    -- and origin_to_address ilike '0x287f9681af590354d6722ac51e6935beef631941'
    and origin_function_signature ilike ('0xfdb5a03e')
    and topics[0] ilike '0xcf2aa%'
    --and block_timestamp = (select block_timestamp, max(1) from optimism.core.fact_event_logs group by 1)
    and block_timestamp::timestamp >= '2022-06-15'
    )

    select date_trunc('h', block_timestamp) as datetime,
    avg(velo_price) as avg_VELO_price,
    min(velo_price) as low,
    max(velo_price) as high
    from price_per_swap
    group by 1
    order by 1





    Run a query to Download Data