mlhBendDAO Balance Sheet.utilization rates
Updated 2022-09-08
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 withdrawals as (SELECT date_trunc('day', t1.block_timestamp) as days,
count(DISTINCT t1.tx_hash) as withdraw_trxs,
count(DISTINCT t1.origin_from_address) as withdrawer,
sum(amount) as withdraw_volume
from ethereum.core.fact_event_logs t1
join ethereum.core.ez_eth_transfers t2 on t1.tx_hash= t2.tx_hash
where t1.origin_to_address = '0x3b968d2d299b895a5fcf3bba7a64ad0f566e6f88'
and t1.contract_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
and t1.event_name in ('Withdrawal')
and t1.tx_status = 'SUCCESS'
group by 1
),
deposits as (SELECT date_trunc('day', t1.block_timestamp) as days,
count(DISTINCT t1.tx_hash) as deposit_trxs,
count(DISTINCT t1.origin_from_address) as depositor,
sum(amount) as deposit_volume
from ethereum.core.fact_event_logs t1
join ethereum.core.ez_eth_transfers t2 on t1.tx_hash = t2.tx_hash
where t1.origin_to_address = '0x3b968d2d299b895a5fcf3bba7a64ad0f566e6f88'
and t1.contract_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
and t1.event_name in ('Deposit')
and t1.tx_status = 'SUCCESS'
group by 1
)
SELECT t1.days,
withdraw_trxs,
withdrawer,
withdraw_volume,
deposit_trxs,
depositor,
deposit_volume,
deposit_volume - withdraw_volume as reserve_volume,
sum(reserve_volume) over (order by t1.days) as cum_reserve_volume
from deposits t1
join withdrawals t2 on t1.days = t2.days
Run a query to Download Data