John_GaltThe yLuna Deficit by Address
Updated 2022-03-15
999
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 table1 as (select -- this is for simple swaps where prism is buying yluna
distinct event_attributes:receiver::string as user_address,
sum(event_attributes:return_amount) / pow(10,6) as yluna_received
from terra.msg_events
where date(block_timestamp) > '2022-02-10'
and event_attributes:"0_to" = 'terra1kqc65n5060rtvcgcktsxycdt2a4r67q2zlvhce'
and event_attributes:"1_action" = 'swap'
and event_index = 3
and event_attributes:"ask_asset" = 'cw20:terra17wkadg0tah554r35x6wvff0y5s7ve8npcjfuhz' --yluna
and event_attributes:"offer_asset" = 'cw20:terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw' --prism
group by user_address
union all
select
distinct event_attributes:"1_receiver"::string as user_address, -- routed transaction where prism is buying yluna, looks like it always started with ust or luna
sum(event_attributes:"1_return_amount") / pow(10,6) as yluna_received
from terra.msg_events
where date(block_timestamp) > '2022-02-10'
and event_attributes:"2_to" = 'terra1kqc65n5060rtvcgcktsxycdt2a4r67q2zlvhce'
and event_index = 3
and event_attributes:"4_action" = 'swap'
and event_attributes:"1_offer_asset" = 'cw20:terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw' --prism
and event_attributes:"1_ask_asset" = 'cw20:terra17wkadg0tah554r35x6wvff0y5s7ve8npcjfuhz' --yluna
group by user_address
union all
select
distinct event_attributes:"1_receiver"::string as user_address, -- routed transaction where prism is buying yluna, but comes from yluna originally
sum(event_attributes:"1_return_amount") / pow(10,6) as yluna_received
from terra.msg_events
where date(block_timestamp) > '2022-02-10'
and event_attributes:"4_to" = 'terra1kqc65n5060rtvcgcktsxycdt2a4r67q2zlvhce'
and event_index = 3
and event_attributes:"6_action" = 'swap'
Run a query to Download Data