khanhDaily unstake transaction
Updated 2022-09-23
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
list1 as (
select hour::date month,
avg(price) as price
from ethereum.core.fact_hourly_token_prices
where token_address = '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9'
group by month
),
list2 as (
select block_timestamp::date month,
sum(event_inputs:amount / pow(10, 18)) as total_amount,
count(distinct (tx_hash)) as tx_num
from ethereum.core.fact_event_logs
where contract_address = origin_to_address
and origin_to_address = '0x4da27a545c0c5b758a6ba100e3a049001de870f5'
and event_name = 'Redeem'
group by month
),
list3 as (
select month,
total_amount,
total_amount * price as amount_usd,
tx_num,
price
from list2
left join list1
using(month)
)
select
month,
sum(total_amount) as total_amount,
sum(total_amount * price) as total_amount_usd,
Run a query to Download Data