mohammadhAave-7)AAVE and stAAVE movements
Updated 2022-08-09
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 A as (select
count(distinct TX_HASH) as stake_tx_count,
sum(RAW_AMOUNT/1e18) as stake_volume,
date_trunc('week',block_timestamp) as block_week,
sum (stake_volume) over (order by block_week asc) as cum_stake_volume,
sum (stake_tx_count) over (order by block_week asc) as cum_stake_tx
from ethereum.core.fact_token_transfers
where ORIGIN_TO_ADDRESS =lower('0x4da27a545c0c5B758a6BA100e3a049001de870f5')
and CONTRACT_ADDRESS =lower('0x4da27a545c0c5B758a6BA100e3a049001de870f5')
and ORIGIN_FUNCTION_SIGNATURE='0xadc9772e'
group by block_week),
B as (select
count(distinct TX_HASH) as unstake_tx_count,
sum(RAW_AMOUNT/1e18) as unstake_volume,
date_trunc('week',block_timestamp) as block_week,
sum (unstake_volume) over (order by block_week asc) as cum_unstake_volume,
sum (unstake_tx_count) over (order by block_week asc) as cum_unstake_tx
from ethereum.core.fact_token_transfers
where ORIGIN_TO_ADDRESS =lower('0x4da27a545c0c5B758a6BA100e3a049001de870f5')
and CONTRACT_ADDRESS =lower('0x4da27a545c0c5B758a6BA100e3a049001de870f5')
and ORIGIN_FUNCTION_SIGNATURE='0x1e9a6950'
group by block_week),
C as (select
date_trunc('week' ,BALANCE_DATE) as block_week,
BALANCE
from flipside_prod_db.ethereum.erc20_balances
where USER_ADDRESS=lower('0x4da27a545c0c5B758a6BA100e3a049001de870f5')
and CONTRACT_ADDRESS = '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9')
select A.block_week,
A.stake_volume,
B.unstake_volume ,
(A.stake_volume - B.unstake_volume) as flow ,
C.BALANCE ,
Run a query to Download Data