with pyth as (SELECT DISTINCT tx_hash as tx, 'Pyth' as "related contract"
from aptos.core.fact_events
where EVENT_RESOURCE = 'PriceFeedUpdate'),
txs as (SELECT
DISTINCT tx_hash ,
BLOCK_TIMESTAMP::date as date,
SENDER
from aptos.core.fact_transactions join pyth on tx_hash = tx
where
BLOCK_TIMESTAMP::date >= '{{Starting_date}}'
and BLOCK_TIMESTAMP::date <= '{{Ending_date}}')
SELECT
SENDER as ADDRESS,
TO_VARCHAR(count(DISTINCT tx_hash) , '999,999,999,999') as "Total requests"
from txs
GROUP by all
order by count(DISTINCT tx_hash) desc