WITH raw as (
SELECT block_timestamp::date as date, IFF(contract_address = '0x152b9d0fdc40c096757f570a51e494bd4b943e50', 'BTC.b', 'Other') as type,
tx_hash, ORIGIN_FROM_ADDRESS, RAW_AMOUNT / POW(10, 8) as amount
FROM avalanche.core.fact_token_transfers
)
SELECT date, type, COUNT(DISTINCT tx_hash) as num_tx
FROM raw
WHERE date > '2022-06-20'
GROUP BY 1, 2