boomer77top 10 depositor basset
Updated 2021-12-20
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 raw as (select msg_value:sender::string as users, count(distinct tx_id) as tx_count, sum(msg_value:coins[0]:amount/1e6) as amount, ROW_NUMBER() OVER (ORDER BY tx_count desc) as rank
from terra.msgs
where msg_module = 'wasm'
and msg_value:contract = 'terra1sepfj7s0aeg5967uxnfk4thzlerrsktkpelm5s'
and msg_value:coins[0]:denom = 'uusd'
and msg_value:execute_msg:deposit_stable::string is not null
and tx_status = 'SUCCEEDED'
and date(block_timestamp) >= CURRENT_DATE - 30
group by 1),
top as (select users, tx_count, amount, rank
from raw
where rank < 11),
bluna_p as (
SELECT
msg_value:sender::string as users,
sum(msg_value:execute_msg:send:amount /POW(10,6)) as collateral_provide,
'bLUNA' as basset
FROM terra.msgs
WHERE msg_value:execute_msg:send:msg:deposit_collateral IS NOT NULL
and msg_value:contract::string = 'terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp'
and tx_status = 'SUCCEEDED' and users in (select users from top)
group by 1,3),
bluna_w as (select msg_value:sender::string as users,
sum(msg_value:execute_msg:withdraw_collateral:amount/1e6) as amount_withdraw,
'bLUNA' as basset
from terra.msgs
where msg_value:execute_msg:withdraw_collateral is not null
and msg_value:contract::string = 'terra1ptjp2vfjrwh0j0faj9r6katm640kgjxnwwq9kn'
and tx_status = 'SUCCEEDED' and users in (select users from top)
group by 1,3),
beth_p as (
SELECT