John_GaltWorking on pLuna sales - this is a copy
Updated 2022-03-13
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 table1 as (select -- this is for simple swaps where pluna is buying prism
block_timestamp as date,
event_attributes:receiver::string as user_address,
event_attributes:"offer_amount" / pow(10, 6) as pluna_spent,
event_attributes:"return_amount" / pow(10,6) as prism_received
from terra.msg_events
where event_attributes:"0_to" = 'terra1persuahr6f8fm6nyup0xjc7aveaur89nwgs5vs'
and event_attributes:"1_action" = 'swap'
and event_index = 3
and event_attributes:"ask_asset" = 'cw20:terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw' --prism
and event_attributes:"offer_asset" = 'cw20:terra1tlgelulz9pdkhls6uglfn5lmxarx7f2gxtdzh2' --pluna
limit 50
),
table2 as (select -- this is for simple swaps where prism is buying pluna
block_timestamp as date,
event_attributes:receiver::string as user_address,
event_attributes:"offer_amount" / pow(10, 6) as prism_spent,
event_attributes:"return_amount" / pow(10,6) as pluna_received
from terra.msg_events
where event_attributes:"0_to" = 'terra1persuahr6f8fm6nyup0xjc7aveaur89nwgs5vs'
and event_attributes:"1_action" = 'swap'
and event_index = 3
and event_attributes:"ask_asset" = 'cw20:terra1tlgelulz9pdkhls6uglfn5lmxarx7f2gxtdzh2' --pluna
and event_attributes:"offer_asset" = 'cw20:terra1dh9478k2qvqhqeajhn75a2a7dsnf74y5ukregw' --prism
limit 50
),
table3 as (select
block_timestamp as date, -- this is for a routed transaction where pluna is buying prism
event_attributes:"1_receiver"::string as user_address,
event_attributes:"0_offer_amount" / pow(10, 6) as pluna_spent,
event_attributes:"0_return_amount" / pow(10,6) as prism_received
from terra.msg_events
where event_attributes:"1_to" = 'terra1persuahr6f8fm6nyup0xjc7aveaur89nwgs5vs'
and event_index = 3