alirsBridger Destinations-part-04
Updated 2022-08-01
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
›
⌄
WITH bridge_txns AS (
select
date(block_timestamp) as date,
block_id,
tx_id,
to_address as wallet,
symbol,
amount_usd
from polygon.udm_events
where amount is not null
and symbol is not NULL
and origin_address = '0x0000000000000000000000000000000000000000'
and amount > 0
and block_timestamp >='2022-01-01'
),
daily_bridge AS (
select
date,
symbol,
count(distinct tx_id) as txns,
count(distinct wallet) as wallets,
sum(amount_usd) as amount_usd_sum,
row_number() over(partition by date order by amount_usd_sum desc) as amount_rank,
case when amount_rank < 5 then symbol else 'rest' end as currency_category
from bridge_txns
group by date, symbol
)
SELECT
*
FROM daily_bridge
order by date asc , amount_usd_sum desc
Run a query to Download Data