0xHaM-dHeatmap || DEXALOT Time based Cohort Wide
    Updated 2024-12-17
    -- forked from TFM Swapper Time based Cohort Wide @ https://flipsidecrypto.xyz/edit/queries/98de3481-59c3-469a-9c05-1d99ee0a8d78
    with SimpleSwap as (
    SELECT
    block_timestamp,
    tx_hash,
    decoded_log:maker as maker,
    decoded_log:makerAsset as makerAsset,
    decoded_log:makerAmountReceived as makerAmountReceived,
    decoded_log:taker as taker,
    decoded_log:takerAsset as takerAsset,
    decoded_log:takerAmountReceived as takerAmountReceived,
    decoded_log
    FROM
    avalanche.core.ez_decoded_event_logs
    WHERE
    contract_address='0xeed3c159f3a96ab8d41c8b9ca49ee1e5071a7cdd' and event_name='SwapExecuted'
    ),
    new_simpleswap as (
    select
    block_timestamp,
    tx_hash,
    regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') as segmented_data,
    segmented_data[0] as taker,
    segmented_data[1] as user2,
    segmented_data[2] as chainID,
    '0x' || substr(segmented_data[3],25,40) as token_in,
    '0x' || substr(segmented_data[4],25,40) as token_out,
    utils.udf_hex_to_int(segmented_data[5]) as amount_in,
    utils.udf_hex_to_int(segmented_data[6]) as amount_out
    from
    avalanche.core.fact_event_logs
    where
    contract_address='0xeed3c159f3a96ab8d41c8b9ca49ee1e5071a7cdd'
    and topics[0] = '0x68eb6d948c037c94e470f9a5b288dd93debbcd9342635408e66cb0211686f7f7'
    order by
    block_timestamp desc
    QueryRunArchived: QueryRun has been archived