PierandreaDeposits of CRV on AAVE
Updated 2023-08-30
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 DEPOSITS AS (
SELECT
SYMBOL,
SUM(ISSUED_TOKENS) AS DEPOSITED_TOKENS,
SUM(SUPPLIED_USD) AS DEPOSITED_USD
FROM ethereum.aave.ez_deposits
WHERE DEPOSITOR_ADDRESS = LOWER('0x7a16ff8270133f063aab6c9977183d9e72835428')
GROUP BY 1
),
WITHDRAWALS AS (
SELECT
SYMBOL,
SUM(WITHDRAWN_TOKENS) AS WITHDRAWN_TOKENS,
SUM(WITHDRAWN_USD) AS WITHDRAWN_USD
FROM ethereum.aave.ez_withdraws
WHERE DEPOSITOR_ADDRESS = LOWER('0x7a16ff8270133f063aab6c9977183d9e72835428')
GROUP BY 1
),
X AS (SELECT D.SYMBOL AS TOKEN,
D.DEPOSITED_TOKENS,
W.WITHDRAWN_TOKENS,
(D.DEPOSITED_TOKENS-W.WITHDRAWN_TOKENS) as BALANCE_CRV,
D.DEPOSITED_USD,
W.WITHDRAWN_USD,
(D.DEPOSITED_USD-W.WITHDRAWN_USD) as BALANCE_USD
FROM DEPOSITS D
INNER JOIN WITHDRAWALS W ON D.SYMBOL = W.SYMBOL),
p as (select price
from ethereum.core.fact_hourly_token_prices
where SYMBOL = 'CRV'
order by HOUR DESC
LIMIT 1),
Run a query to Download Data