cloudr3nTotal transactions per service multisig on polygon
    Updated 2024-05-31
    -- forked from Total transactions per service multisig on gnosis @ https://flipsidecrypto.xyz/edit/queries/a1c9be02-da15-4e7b-bef1-2ad35691fe23

    with

    polygon as (
    select
    decoded_log:multisig as multisig,
    decoded_log:serviceId as serviceId
    from
    polygon.core.ez_decoded_event_logs
    where
    1=1
    and event_name='CreateMultisigWithAgents'
    and contract_address='0xe3607b00e75f6405248323a9417ff6b39b244b50' -- Service Registry L2 (AUTONOLAS-SERVICE-L2-V1)
    group by
    multisig,
    serviceId
    ),

    total_transactions as (
    select
    to_address as service_multisig_address,
    count(*) as transaction_number
    from
    polygon.core.fact_transactions
    where
    to_address in (select distinct multisig from polygon)
    group by
    to_address
    )

    select
    multisig,
    serviceId,
    coalesce(transaction_number, 0) as cumulative_transaction_number
    from
    Auto-refreshes every 24 hours
    QueryRunArchived: QueryRun has been archived