Flipside Team2024-08-27 02:26 AM
    Updated 2024-11-04
    -- -- select
    -- -- distinct PROGRAM_NAME
    -- -- from crosschain.olas.ez_service_staking

    with tb1 as (select
    BLOCK_TIMESTAMP,
    tx_hash,
    concat('0x',substring(topics[3], 26+1, 40)) AS multisig,
    concat('0x',substring(topics[2], 26+1, 40)) AS owner,
    ethereum.public.udf_hex_to_int(TOPICS[1])::float as serviceId,
    row_number() OVER (partition BY serviceId order by BLOCK_TIMESTAMP desc) as r_no
    from gnosis.core.fact_event_logs
    where (CONTRACT_ADDRESS = lower('0xeF44Fb0842DDeF59D37f85D61A1eF492bbA6135d')
    OR
    contract_address = lower('0x1c2F82413666d2a3fD8bC337b0268e62dDF67434')
    OR
    contract_address = lower('0xDaF34eC46298b53a3d24CBCb431E84eBd23927dA')
    )
    and TOPICS[0] = '0xaa6b005b4958114a0c90492461c24af6525ae0178db7fbf44125ae9217c69ccb'
    --and tx_hash = '0x7d266cd159f1ca06c9b5087d51e3669c8a3b0b9dd8a699eaee025dff38fea72b'
    ),

    tb2 as (select
    *
    from tb1
    where r_no = 1)

    select
    count(*) as participants
    from tb2


    QueryRunArchived: QueryRun has been archived