mz0111Untitled Query
Updated 2022-08-24Copy Reference Fork
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
›
⌄
SELECT
SUM(TOTAL_AMOUNT)
FROM
(
with tab1 as
(select
event_inputs:value::float/pow(10,18) as SUSD_amount
from optimism.core.fact_event_logs
where origin_to_address = '0x170a5714112daeff20e798b6e92e25b86ea603c1'
and contract_address = '0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9' --for sUSD 1700 rows
and event_name = 'Transfer'
and block_timestamp::date >= current_date - 14
and event_inputs:to = '0x170a5714112daeff20e798b6e92e25b86ea603c1'
and event_inputs:from = origin_from_address
and tx_status = 'SUCCESS'),
tab2 as
(select
event_inputs:value::float/pow(10,6) as USDT_amount
from optimism.core.fact_event_logs
where origin_to_address = '0x170a5714112daeff20e798b6e92e25b86ea603c1'
and contract_address = '0x94b008aa00579c1307b0ef2c499ad98a8ce58e58' --for USDT only 22rows
and event_name = 'Transfer'
and block_timestamp::date >= current_date - 14
and event_inputs:to = '0x170a5714112daeff20e798b6e92e25b86ea603c1'
and event_inputs:from = origin_from_address
and tx_status = 'SUCCESS'
GROUP BY 1),
tab3 as
(select
block_timestamp,
event_inputs:value::float/pow(10,6) as USDC_amount
from optimism.core.fact_event_logs
where origin_to_address = '0x170a5714112daeff20e798b6e92e25b86ea603c1'
and contract_address = '0x7f5c764cbc14f9669b88837ca1490cca17c31607' --for USDC 282 ROWS
and event_name = 'Transfer'
Run a query to Download Data