File size: 8,103 Bytes
bf92148
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
-- Table for Twitter/X posts with Unix timestamps
CREATE TABLE IF NOT EXISTS default.x_posts
(
    `timestamp` DateTime('UTC'),
    `id` String,
    `type` String,
    `author_handle` String,
    `body_text` String,
    `urls_list` Array(String),
    `mentions_list` Array(String),
    `images` Array(String),
    `is_quote_tweet` UInt8,
    `subtweet_author_handle` Nullable(String),
    `subtweet_text` Nullable(String),
    `subtweet_images` Array(String),
    `raw_data_compressed` String
)
ENGINE = ReplacingMergeTree(timestamp)
ORDER BY (id, timestamp);

-- Table for follows, using handles instead of IDs
CREATE TABLE IF NOT EXISTS default.x_follows
(
    `timestamp` DateTime('UTC'),
    `event_id` String,
    `author_handle` String,
    `followed_author_handle` String,
    `raw_data_compressed` String
)
ENGINE = MergeTree()
ORDER BY (timestamp, author_handle, followed_author_handle);

-- Table for specific profile actions, using handles
CREATE TABLE IF NOT EXISTS default.x_profile_actions
(
    `timestamp` DateTime('UTC'),
    `event_id` String,
    `author_handle` String,
    `action_type` String,
    `raw_data_compressed` String
)
ENGINE = MergeTree()
ORDER BY (timestamp, author_handle);

-- Table for DexScreener trending snapshots with Unix timestamps
CREATE TABLE IF NOT EXISTS default.dextrending_snapshots
(
    `timestamp` DateTime('UTC'),
    `timeframe` String,
    `trending_tokens` Nested(
        -- Core Identifiers
        token_address String,
        token_name String,
        ticker String,
        token_image String,
        protocol String,
        created_at UInt32,

        -- Financial Metrics
        market_cap Float64,
        volume_sol Float64,
        liquidity_sol Float64,

        -- Activity Metrics
        buy_count UInt32,
        sell_count UInt32,
        
        -- Holder & Tokenomics Metrics
        top_10_holders_pct Float32,
        lp_burned_pct Nullable(Float32),
        total_supply Float64,
        
        -- Social Links
        website Nullable(String),
        twitter Nullable(String),
        telegram Nullable(String)
    )
)
ENGINE = MergeTree()
ORDER BY (timestamp, timeframe);

-- Table for Lighthouse protocol stats (wide format) with Unix timestamps
CREATE TABLE IF NOT EXISTS default.protocol_stats_snapshots
(
    `timestamp` DateTime('UTC'),
    `timeframe` String, -- '5m', '1h', '6h', '24h'
    
    -- Protocol Specific Stats
    `protocol_name` String, -- e.g., 'All', 'Pump V1', 'Meteora DLMM'
    `total_volume` Float64,
    `total_transactions` UInt64,
    `total_traders` UInt64,
    `total_tokens_created` UInt32,
    `total_migrations` UInt32,

    -- Percentage Change Metrics
    `volume_pct_change` Float32,
    `transactions_pct_change` Float32,
    `traders_pct_change` Float32,
    `tokens_created_pct_change` Float32,
    `migrations_pct_change` Float32
)
ENGINE = MergeTree()
ORDER BY (timestamp, timeframe, protocol_name);

CREATE TABLE IF NOT EXISTS default.phantomtrending_snapshots
(
    `timestamp` UInt64,
    `timeframe` String,
    `trending_tokens` Nested(
        `token_address` String,
        `token_name` String,
        `ticker` String,
        `token_image` String,
        `market_cap` Float64,
        `volume` Float64,
        `price` Float64,
        `price_change_pct` Float32,
        `volume_change_pct` Float32
    )
)
ENGINE = MergeTree()
ORDER BY (timestamp, timeframe);

-- Table for tokens that have paid for a profile (one-time event per token)
CREATE TABLE IF NOT EXISTS default.dex_paid_tokens
(
    `timestamp` UInt64,
    `token_address` String,
    `chain_id` String,
    `description` Nullable(String),
    `icon_url` Nullable(String),
    `header_url` Nullable(String),
    
    -- Structured Social Links
    `website` Nullable(String),
    `twitter` Nullable(String),
    `telegram` Nullable(String),
    `discord` Nullable(String)
)
ENGINE = ReplacingMergeTree(timestamp)
PRIMARY KEY (token_address)
ORDER BY (token_address);

-- Table to log every boost event over time
CREATE TABLE IF NOT EXISTS default.dex_boost_events
(
    `timestamp` UInt64,
    `token_address` String,
    `chain_id` String,
    `amount` Float64,
    `total_amount` Float64,
    `description` Nullable(String),
    `icon_url` Nullable(String),
    `header_url` Nullable(String),

    -- Structured Social Links
    `website` Nullable(String),
    `twitter` Nullable(String),
    `telegram` Nullable(String),
    `discord` Nullable(String)
)
ENGINE = MergeTree()
ORDER BY (timestamp);

CREATE TABLE IF NOT EXISTS default.dex_top_boost_snapshots
(
    `timestamp` UInt64,
    `top_boosted_tokens` Nested(
        `token_address` String,
        `chain_id` String,
        `total_amount` Float64,
        `description` Nullable(String),
        `icon_url` Nullable(String),
        `header_url` Nullable(String),
        
        -- Structured Social Links
        `website` Nullable(String),
        `twitter` Nullable(String),
        `telegram` Nullable(String),
        `discord` Nullable(String)
    )
)
ENGINE = MergeTree()
ORDER BY timestamp;

CREATE TABLE IF NOT EXISTS default.x_trending_hashtags_snapshots
(
    `timestamp` DateTime('UTC'),
    `country_code` String,
    `trends` Nested(
        `name` String,
        `tweet_count` Nullable(UInt64)
    )
)
ENGINE = MergeTree()
ORDER BY (country_code, timestamp);

CREATE TABLE IF NOT EXISTS default.pump_replies
(
    `timestamp` DateTime('UTC'),
    `id` UInt64,
    `mint` String,
    `user` String,
    `username` Nullable(String),
    `text` String,
    `total_likes` UInt32,
    `file_uri` Nullable(String)
)
ENGINE = MergeTree()
ORDER BY (mint, timestamp);

CREATE TABLE IF NOT EXISTS default.wallet_socials
(
    `wallet_address` String,
    `pumpfun_username` Nullable(String),
    `pumpfun_image` Nullable(String),
    `bio` Nullable(String),
    `pumpfun_followers` Nullable(UInt32),
    `pumpfun_following` Array(String),
    `kolscan_name` Nullable(String),
    `twitter_username` Nullable(String),
    `telegram_channel` Nullable(String),
    `profile_image` Nullable(String),
    `cabalspy_name` Nullable(String),
    `updated_at` DateTime('UTC'),
    `axiom_kol_name` Nullable(String)
)
ENGINE = ReplacingMergeTree(updated_at)
PRIMARY KEY (wallet_address)
ORDER BY (wallet_address);

CREATE TABLE IF NOT EXISTS default.leaderboard_snapshots
(
    `timestamp` DateTime('UTC'),
    `source` String, -- 'kolscan', 'cabalspy', 'axiom_vision'
    `wallets` Array(String) -- An array of wallet addresses, ordered by rank (index 0 = rank 1)
)
ENGINE = MergeTree()
ORDER BY (source, timestamp);

CREATE TABLE IF NOT EXISTS default.alpha_groups
(
    `group_id` String,
    `name` String,
    `short_name` Nullable(String),
    `image_url` Nullable(String),
    `source` Enum8('discord' = 1, 'telegram' = 2, 'telegram_call' = 3),
    `updated_at` DateTime('UTC')
)
ENGINE = MergeTree()
PRIMARY KEY (group_id)
ORDER BY (group_id);

CREATE TABLE IF NOT EXISTS default.alpha_mentions
(
    `timestamp` DateTime('UTC'),
    `group_id` String,
    `channel_id` String,
    `message_id` String,
    `chain` Nullable(String),
    `token_address` String
)
ENGINE = MergeTree()
ORDER BY (message_id, token_address, timestamp);

CREATE TABLE IF NOT EXISTS default.chain_stats_snapshots
(
    `timestamp` DateTime('UTC'),
    `sol_price_usd` Float64,
    `jito_tip_fee` Float64
)
ENGINE = MergeTree()
ORDER BY (timestamp);

CREATE TABLE IF NOT EXISTS default.cex_listings
(
    `timestamp` DateTime('UTC'),
    `exchange_name` String,
    `token_name` String,
    `ticker` Nullable(String),
    `token_address` Nullable(String),
    `chain_id` Nullable(String),
    `source_tweet_id` String
)
ENGINE = MergeTree()
ORDER BY (timestamp, exchange_name);

CREATE TABLE IF NOT EXISTS default.tiktok_trending_hashtags_snapshots
(
    `timestamp` DateTime('UTC'),
    `country_code` String,
    `trends` Nested(
        `hashtag_name` String,
        `rank` UInt16,
        `publish_count` UInt32,
        `video_views` UInt64,
        `creator_nicknames` Array(String)
    )
)
ENGINE = MergeTree()
ORDER BY (country_code, timestamp);