Afonso_DiazOvertime
    Updated 2024-12-13
    with

    pricet as (
    select
    hour::date as date,
    token_address,
    avg(price) as price_usd
    from aptos.price.ez_prices_hourly
    group by 1, 2
    ),

    panora_swaps as (
    select
    block_number,
    tx_hash,
    block_timestamp,
    sender,
    event_index,
    c.event_data:x_type_info::string as token_in_contract,
    c.event_data:y_type_info::string as token_out_contract,
    event_data:input_amount::int as amount_in_unadj,
    event_data:output_amount::int as amount_out_unadj
    from aptos.core.fact_transactions b
    join aptos.core.fact_events c
    using(tx_hash, block_timestamp)
    where
    c.event_module = 'panora_swap_aggregator'
    and c.event_resource = 'SwapStepEvent'
    and payload_function like '0x1c3206329806286fd2223647c9f9b130e66baeb6d7224a18c1f642ffe48f3b4c%'
    and success = 'TRUE'
    and tx_type = 'user_transaction'
    ),

    fungibles as (
    select
    block_number,
    QueryRunArchived: QueryRun has been archived