maybeyonaseth2_total_bals
Updated 2022-03-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
›
⌄
with
bals as (
select
balance_date,
balance
from ethereum.erc20_balances
-- where tx_hash = '0xa30e61128ac12ccaf294b7b5d72b7bd8f0fd77a28cbf767136bf9dddec71bbd4'
where user_address = lower('0x00000000219ab540356cBB839Cbe05303d7705Fa')
and symbol = 'ETH'
and balance_date >= current_date - interval '90 days'
),
usage as (
select
date(block_timestamp) as date,
count(distinct tx_id) as txs,
count(distinct origin_address) as users,
sum(amount) as eth_deposited
from ethereum.udm_events
where
to_address = lower('0x00000000219ab540356cBB839Cbe05303d7705Fa')
and event_type = 'native_eth'
and symbol = 'ETH'
and block_timestamp >= current_date - interval '90 days'
group by 1
)
select * ,
avg(eth_deposited) over (order by date rows between 10 preceding and 10 following) as eth_dep_ma
from bals join usage on balance_date=date