vegardGMX Protocol
    Updated 2022-11-05
    with
    gmx_protocol as (
    select date_trunc('day', block_timestamp)::date as day,
    tx_hash,
    origin_from_address,
    origin_to_address,
    event_inputs:value as volume,
    case contract_address
    when '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8' then 'USDC'
    when '0xda10009cbd5d07dd0cecc66161fc93d7c9000da1' then 'DAI'
    when '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9' then 'USDT'
    else contract_address end as token_symbol
    from arbitrum.core.fact_event_logs
    where 1 = 1
    and (
    contract_address = '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8' or
    contract_address = '0xda10009cbd5d07dd0cecc66161fc93d7c9000da1' or
    contract_address = '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9'
    )
    and tx_status = 'SUCCESS'
    and event_name = 'Transfer'
    and (
    origin_to_address = '0xb87a436b93ffe9d75c5cfa7bacfff96430b09868' or
    origin_to_address = '0x3d6ba331e3d9702c5e8a8d254e5d8a285f223aba'
    )
    and event_inputs:value is not null
    ),

    price_list as (
    select date_trunc('day', hour)::date as day,
    symbol,
    decimals,
    avg(price) as price_avg
    from ethereum.core.fact_hourly_token_prices
    where (
    symbol = 'USDC' or
    Run a query to Download Data