staderwhSD
Updated 2022-07-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
36
›
⌄
with claim as (
select
msg_value:sender::string as user,
sum(msg_value:execute_msg:claim:amount::float/pow(10,8)) as SD_claimed
from terra.msgs
where
msg_value:contract::string in ('terra127679wwl2glzc4cv7zu6rsp7062xuw5dnlt993')
and tx_status = 'SUCCEEDED'
and msg_value:execute_msg:claim is not null
group by 1
),
stake as (
select
msg_value:sender::string as user,
sum(msg_value:execute_msg:send:amount::float/pow(10,8)) as SD_staked
from terra.msgs
where
msg_value:contract::string in ('terra1ustvnmngueq0p4jd7gfnutgvdc6ujpsjhsjd02')
and tx_status = 'SUCCEEDED'
and user in (select user from claim)
and msg_value:execute_msg:send is not null
and msg_value:execute_msg:send:contract::string in ('terra1tcgehea9034fne4g237rh45hcema89z3k58syt')
and msg_value:execute_msg:send:msg::string in ('eyJkZXBvc2l0Ijp7fX0=')
--and msg_value:execute_msg:send:amount::float/pow(10,8)>0
group by 1
),
consolidated as (
select
claim.user as user,
SD_claimed,
coalesce(SD_staked,0) as SD_staked
from claim
left join stake
on claim.user = stake.user
Run a query to Download Data