hbd199405 - swpr sts
    Updated 2024-12-04
    ----------------------------------------------------- Adding Tokens and Symbols -----------------------------------------------------

    WITH tokens AS (
    select
    token_address as token,
    name,
    symbol,
    uri
    FROM $query('b227b22d-94d7-49d7-951a-309cb1755c73')),

    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')),

    pools as (
    select
    distinct a.TX_ID,
    a.BLOCK_TIMESTAMP,
    b.action,
    a.INSTRUCTION:accounts[5] as tokenA,
    coalesce(c.symbol, tokenA) as tokenMintA_symbol,
    a.INSTRUCTION:accounts[6] as tokenb,
    coalesce(d.symbol, tokenB) as tokenMintB_symbol,
    tokenMintA_symbol || ' - ' || tokenMintB_symbol as pool_name,
    a.INSTRUCTION:accounts[7] as pool_address,
    QueryRunArchived: QueryRun has been archived