StangFAST02 - lenght [ ext ]
Updated 2023-08-16
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
›
⌄
-- forked from 02 - lenght @ https://flipsidecrypto.xyz/edit/queries/f2f48b60-c2c7-49b4-94b0-8a0b8a1874ff
with
ext AS
(
SELECT
a.signers[0] AS users
, case
when a.log_messages[2] LIKE 'Program log: Buying or extending renewable domain %' then initcap( split( a.log_messages[2] , ' ' ) [7] )
when a.log_messages[3] LIKE 'Program log: Buying or extending renewable domain %' then initcap( split( a.log_messages[3] , ' ' ) [7] )
when a.log_messages[4] LIKE 'Program log: Buying or extending renewable domain %' then initcap( split( a.log_messages[4] , ' ' ) [7] )
when a.log_messages[5] LIKE 'Program log: Buying or extending renewable domain %' then initcap( split( a.log_messages[5] , ' ' ) [7] )
when a.log_messages[6] LIKE 'Program log: Buying or extending renewable domain %' then initcap( split( a.log_messages[6] , ' ' ) [7] )
end
AS domain
, left( domain , charindex( '.' , domain ) - 1) AS firstname
, right( domain , charindex( '.' , ( reverse( domain ))) - 1) AS lastname
, length( firstname ) AS charactor
FROM
solana.core.fact_transactions a
JOIN lateral flatten ( input => a.instructions ) b
JOIN lateral flatten ( input => a.log_messages ) c
WHERE
a.block_timestamp::date >= dateadd( 'month' , -{{number_of_month}} , current_date )
AND a.block_timestamp::date <= dateadd( 'day' , -1 , current_date )
AND b.value:programId = 'TLDHkysf5pCnKsVA4gXpNvmy7psXLPEu4LAdDJthT9S'
AND c.value = 'Program log: Instruction: BuyOrExtendRenewable'
AND a.succeeded = 'true'
GROUP BY 1 , 2 , 3 , 4 , 5
)
-- ,
-- buy AS
-- (
-- SELECT
-- a.signers[0] AS users
Run a query to Download Data