cloudr3nsilver_dex_pharaoh_exchange_pools_v2
    Updated 2024-07-18
    with
    pool_creation as (
    select
    concat('0x',substr(topics[1]::string, 27, 40)) as token0,
    concat('0x',substr(topics[2]::string, 27, 40)) as token1,
    utils.udf_hex_to_int(topics[3]) as fee,
    regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
    segmented_data[0] as tickSpacing,
    concat('0x',substr(segmented_data[1]::string, 27, 40)) as pool
    from
    avalanche.core.fact_event_logs
    where
    contract_address in ('0xaaa32926fce6be95ea2c51cb4fcb60836d320c42')
    and topics[0] in (
    '0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118' -- poolcreated
    )
    and tx_status = 'SUCCESS'
    )

    select * from pool_creation
    QueryRunArchived: QueryRun has been archived