mlhBendDAO Metrics2
Updated 2022-09-06Copy 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
›
⌄
with price as (select hour::date as date,
avg (price) as price
from ethereum.core.fact_hourly_token_prices
where symbol ='WETH'
group by 1
)
select date_trunc('day', block_timestamp) as days,
count (distinct tx_hash) as trxs,
count (distinct origin_from_address) as users,
sum (event_inputs:value/1e18) as volume,
sum (event_inputs:value/1e18*price) as usd_Volume,
case when origin_function_signature = '0x58c22be7' then 'Deposit'
when origin_function_signature = '0x36118b52' then 'Withdraw'
else null end as type
from ethereum.core.fact_event_logs t1
join price t2 on t1.block_timestamp::date = t2.date
where origin_to_address = '0x3b968d2d299b895a5fcf3bba7a64ad0f566e6f88'--WETH Gateway
and block_timestamp::date >= CURRENT_DATE - 30
and contract_name = 'WETH9'
and event_name = 'Transfer'
and type is not null
group by 1, 6
Run a query to Download Data