hbd199401 - ltzck-plscrishn
    Updated 2024-12-04
    with base as (
    select
    BLOCK_TIMESTAMP,
    TX_ID,
    SIGNERS,
    case
    when b.value = 'Program log: in perform_swap, getting accounts' then 'Swap'
    when b.value = 'Program log: in update_liquidity' then 'LP Actions'
    when b.value = 'Program log: in instant_launch' then 'Pool Creation'
    end as action
    from eclipse.core.fact_transactions, TABLE(FLATTEN(input => LOG_MESSAGES)) as b
    where tx_id in (select distinct tx_id from eclipse.core.fact_events where program_id = 'Cook7kyoaKaiG57VBDUjE2KuPXrWdLEu7d3FdDgsijHU' and SUCCEEDED = 'TRUE')
    --and tx_id = '2xLWr4kkKKXDpekBD6zVmH4Lt3RYWMyAaJRp15kdAmhSWAgD5HsR6j6vtwh7SVS1a55CeqvBXuYs4BRJGTFDWoGV'
    and b.value in ('Program log: in perform_swap, getting accounts','Program log: in update_liquidity','Program log: in instant_launch')),

    tokens AS (
    select
    token_address as token,
    symbol
    FROM $query('b227b22d-94d7-49d7-951a-309cb1755c73')
    union all
    select
    'So11111111111111111111111111111111111111112' as token,
    'ETH' as symbol)

    select
    distinct a.TX_ID as "Transaction Hash",
    a.BLOCK_TIMESTAMP as "Date and Time",
    b.action as "Action",
    a.INSTRUCTION:accounts[5] as "Quote Token",
    coalesce(c.symbol, "Quote Token") as "Quote Token Symbol",
    a.INSTRUCTION:accounts[6] as "Base Token",
    coalesce(d.symbol, "Base Token") as "Base Token Symbol",
    "Quote Token Symbol" || ' - ' || "Base Token Symbol" as "Pool Name",
    a.INSTRUCTION:accounts[7] as "Pool Address",
    a.INSTRUCTION:accounts[8] as "Sub Pool Address",
    QueryRunArchived: QueryRun has been archived