adambalaGetting Your Feet Wet, Part 2
Updated 2022-03-14
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
new as (
select tx_from[0] as user
,min(block_timestamp)::date as min_time
from terra.transactions
group by 1 having min_time>=CURRENT_DATE-90),
tx_new as (
select DISTINCT tx_id from terra.transactions
where tx_from[0] in(select user from new)) ,
A AS (
select
date(block_timestamp) as date ,
tx_id ,
msg_value:sender as user
from terra.msgs inner join terra.labels on lower(address)=lower(msg_value:contract::string)
where tx_status = 'SUCCEEDED' and label='anchor'
and msg_value:execute_msg:send:amount/1e6>0
and tx_id in(select tx_id from tx_new)
group by 1,2,3
),
b as (
select s.tx_id,date,user,
EVENT_ATTRIBUTES:action as action
from terra.msg_events as s inner join a
on s.tx_id=a.tx_id
where event_type='from_contract'
and TX_STATUS='SUCCEEDED'
group by 1,2,3,4
having action is not null)
select count(distinct tx_id) as txnumber,
date,
count(distinct user) as txuser,
action
Run a query to Download Data