MoeBD- METRICs 3
Updated 2022-09-07
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
›
⌄
select * from (
select
date_trunc(week,BLOCK_TIMESTAMP)::date as weeks,
count (distinct TX_HASH) as tx_count,
count(distinct ORIGIN_FROM_ADDRESS) as users,
sum( AMOUNT) as volume_eth,
sum( AMOUNT_USD) as volume_usd,
'Repay ETH' as type
from ethereum.core.ez_eth_transfers
where tx_hash in (select tx_hash
from ethereum.core.fact_event_logs
where contract_address='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' and
ORIGIN_FUNCTION_SIGNATURE = '0x89cbe656' and
ORIGIN_TO_ADDRESS = '0x3b968d2d299b895a5fcf3bba7a64ad0f566e6f88')
group by 1
union all
select
date_trunc(week,BLOCK_TIMESTAMP)::date as weeks,
-1*count (distinct TX_HASH) as tx_count,
-1*count(distinct ORIGIN_FROM_ADDRESS) as users,
-1*sum( AMOUNT) as volume_eth,
-1*sum( AMOUNT_USD) as volume_usd,
'Borrow ETH' as type
from ethereum.core.ez_eth_transfers
where tx_hash in
(select tx_hash
from ethereum.core.fact_event_logs
where contract_address='0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
and ORIGIN_FUNCTION_SIGNATURE = '0x35611f7e'
and ORIGIN_TO_ADDRESS = '0x3b968d2d299b895a5fcf3bba7a64ad0f566e6f88')
group by 1
)
where weeks >= current_date - {{days_back}}
Run a query to Download Data