MLDZMNcontri3
Updated 2023-07-26
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 t1 as(select
distinct signers[0] as contributor
from solana.core.fact_transactions s
join (select distinct block_timestamp, tx_id
from solana.core.fact_events where succeeded = True
and program_id = 'BVo5TquTYMAASZhfX392BcjFUxda6DKzHStNapJE6Wyz') events
using(tx_id, block_timestamp)
join lateral flatten (input => log_messages) logs
join (select tx_id, block_timestamp,amount
from solana.core.fact_transfers where mint='So11111111111111111111111111111111111111112') transfer
using(tx_id, block_timestamp)
where BLOCK_TIMESTAMP>='2023-06-15' --between '2023-06-23' and '2023-07-03'
and logs.value in ('Program log: Instruction: CreateContributionSol','Program log: Instruction: UpdateContributionSol')
group by 1
),
t2 as(
select
SIGNERS[0] as users,
Count(distinct tx_id) as no_txn,
count (Distinct block_timestamp::Date) as active_days,
min (block_timestamp) as first_transaction,
datediff(day,first_transaction,CURRENT_DATE) as wallet_age
from solana.core.fact_transactions
where SUCCEEDED='TRUE'
and SIGNERS[0] in (select contributor from t1)
and BLOCK_TIMESTAMP>=current_date-120
group by 1
)
select
case
when wallet_age<=20 then 'under 20 Days'
when wallet_age > 20 and wallet_age <= 50 then '20- 50 Days'
when wallet_age > 50 and wallet_age <= 100 then '50- 100 Days'
when wallet_age > 100 then 'over 100 Days'
Run a query to Download Data