-- forked from smiz / transaction count distribution of addresses interacting with stargate finance contracts in May @ https://flipsidecrypto.xyz/smiz/q/ircHKxHpzkiN/transaction-count-distribution-of-addresses-interacting-with-stargate-finance-contracts-in-may
with
stargate_interactors as (
select distinct
from_address as interactor_address
from
avalanche.core.fact_transactions
where
date_trunc('month', block_timestamp) = '2023-05-01 00:00:00.000'
and to_address in
-- all stargate labeled addresses
(
select distinct
address
from
avalanche.core.dim_labels
where
project_name = 'stargate finance'
)
),
address_tx_count as (
select
from_address,
count(tx_hash) as tx_count
from
avalanche.core.fact_transactions
where
from_address in (
select
interactor_address
from
stargate_interactors
)
group by
1