boomer77In n out
Updated 2021-08-25
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
34
35
36
›
⌄
with usdc_in as
(select date_trunc('day',block_timestamp) as block_day, sum(event_inputs:amount/1e6) as USDC_deposit
from ethereum.events_emitted
where contract_address in ('0x40ec5b33f54e0e8a33a975908c5ba1c14e5bbbdf') --polygon bridge
and event_inputs:rootToken::string = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' --usdc token
and block_day <= CURRENT_DATE - 1
group by 1
order by 1 desc
limit 1000),
eth_in as
(select date_trunc('day', block_timestamp) as block_day, sum(event_inputs:amount/1e18) as ETH_deposit
from ethereum.events_emitted
where event_name = 'LockedEther' and contract_address = '0x8484ef722627bf18ca5ae6bcf031c23e6e922b30' --polygon bridge
group by 1
order by 1 desc),
usdc_out as
(select date_trunc('day', block_timestamp) as block_day, sum(amount) as USDC_withdraw
from ethereum.udm_events
where symbol = 'USDC' and from_address = '0x40ec5b33f54e0e8a33a975908c5ba1c14e5bbbdf'
group by 1
order by 1 desc),
eth_out as
(select date_trunc('day', block_timestamp) as block_day, sum(event_inputs:amount/1e18) as ETH_withdraw
from ethereum.events_emitted
where event_name = 'ExitedEther' and contract_address = '0x8484ef722627bf18ca5ae6bcf031c23e6e922b30' --polygon bridge
group by 1
order by 1 desc)
select A.block_day, A.USDC_deposit, B.ETH_deposit, C.USDC_withdraw, D.ETH_withdraw
from usdc_in A
join eth_in B on A.block_day = B.block_day
join usdc_out C on A.block_day = C.block_day
join eth_out D on A.block_day = D.block_day
Run a query to Download Data