legomanmaker weth vault balances
Updated 2022-10-26
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
›
⌄
-- select * from ethereum.maker.ez_vault_creation limit 5
-- block_number, block_timestamp, tx_hash, tx_status, creator, vault, vault_number
-- tx_status == 'SUCCESS'
-- select * from ethereum.maker.ez_deposits limit 5
-- block_number, block_timestamp, tx_hash, tx_status, event_index, depositor, vault, token)deposited, symbol, amount_deposited
-- select * from ethereum.maker.ez_withdrawals limit 5
-- block_number, block_timestamp, tx_hash, tx_status, event_index, withdrawer, vault, token_withdrawn, symbol, amount_withdrawn
-- WETH Vault balances
with deposits as (
select vault, sum(amount_deposited) as weth
from ethereum.maker.ez_deposits
where tx_status = 'SUCCESS'
and token_deposited = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
group by 1
),
withdraws as (
select vault, sum(amount_withdrawn) * (-1) as weth
from ethereum.maker.ez_withdrawals
where tx_status = 'SUCCESS'
and token_withdrawn = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
group by 1
),
all_data as (
select vault, weth from deposits
union ALL
select vault, weth from withdraws
)
select vault, sum(weth) as weth_balance
from all_data
group by 1 order by 2 DESC
limit 10
Run a query to Download Data