zirobtc commited on
Commit
281bada
·
1 Parent(s): 658537a

Upload onchain.sql with huggingface_hub

Browse files
Files changed (1) hide show
  1. onchain.sql +20 -20
onchain.sql CHANGED
@@ -1,4 +1,4 @@
1
- CREATE TABLE trades
2
  (
3
  timestamp DateTime('UTC'),
4
  signature String,
@@ -53,7 +53,7 @@ ENGINE = MergeTree()
53
  ORDER BY (base_address, timestamp, maker, signature);
54
 
55
  --- mint
56
- CREATE TABLE mints
57
  (
58
  -- === Transaction Details ===
59
  -- Solana signature is usually 88 characters, but we use String for flexibility.
@@ -95,7 +95,7 @@ CREATE TABLE mints
95
  ENGINE = MergeTree()
96
  ORDER BY (timestamp, creator_address, mint_address);
97
 
98
- CREATE TABLE migrations
99
  (
100
  -- Transaction Details
101
  timestamp DateTime('UTC'),
@@ -121,7 +121,7 @@ CREATE TABLE migrations
121
  ENGINE = MergeTree()
122
  ORDER BY (mint_address, virtual_pool_address, pool_address, timestamp);
123
 
124
- CREATE TABLE fee_collections
125
  (
126
  -- Transaction Details
127
  timestamp DateTime('UTC'),
@@ -148,7 +148,7 @@ CREATE TABLE fee_collections
148
  ENGINE = MergeTree()
149
  ORDER BY (vault_address, recipient_address, timestamp);
150
 
151
- CREATE TABLE liquidity
152
  (
153
  -- Transaction Details --
154
  signature String,
@@ -173,7 +173,7 @@ CREATE TABLE liquidity
173
  ENGINE = MergeTree()
174
  ORDER BY (timestamp, pool_address, lp_provider);
175
 
176
- CREATE TABLE pool_creations (
177
  -- Transaction Details --
178
  signature String,
179
  timestamp Datetime('UTC'),
@@ -201,7 +201,7 @@ CREATE TABLE pool_creations (
201
  ENGINE = MergeTree()
202
  ORDER BY (base_address, creator_address);
203
 
204
- CREATE TABLE transfers
205
  (
206
  -- Transaction Details
207
  timestamp DateTime('UTC'),
@@ -227,7 +227,7 @@ CREATE TABLE transfers
227
  ENGINE = MergeTree()
228
  ORDER BY (source, destination, mint_address, timestamp);
229
 
230
- CREATE TABLE supply_locks
231
  (
232
  -- === Transaction Details ===
233
  timestamp DateTime('UTC'),
@@ -252,7 +252,7 @@ CREATE TABLE supply_locks
252
  ENGINE = MergeTree()
253
  ORDER BY (timestamp, mint_address, sender, recipient);
254
 
255
- CREATE TABLE supply_lock_actions
256
  (
257
  -- === Transaction Details ===
258
 
@@ -276,7 +276,7 @@ CREATE TABLE supply_lock_actions
276
  ENGINE = MergeTree()
277
  ORDER BY (timestamp, mint_address, user);
278
 
279
- CREATE TABLE burns
280
  (
281
  -- Transaction Details
282
  timestamp DateTime('UTC'),
@@ -299,7 +299,7 @@ ORDER BY (mint_address, source, timestamp);
299
 
300
  -------- Wallet schema
301
 
302
- CREATE TABLE wallet_profiles
303
  (
304
  updated_at DateTime('UTC'),
305
  first_seen_ts DateTime('UTC'),
@@ -318,7 +318,7 @@ ENGINE = ReplacingMergeTree(updated_at)
318
  PRIMARY KEY (wallet_address)
319
  ORDER BY (wallet_address);
320
 
321
- CREATE TABLE wallet_profile_metrics
322
  (
323
  updated_at DateTime('UTC'),
324
  wallet_address String,
@@ -384,7 +384,7 @@ CREATE TABLE wallet_profile_metrics
384
  ENGINE = MergeTree
385
  ORDER BY (wallet_address, updated_at);
386
 
387
- CREATE TABLE wallet_holdings
388
  (
389
  updated_at DateTime('UTC'),
390
  start_holding_at DateTime('UTC'),
@@ -408,7 +408,7 @@ CREATE TABLE wallet_holdings
408
  ENGINE = MergeTree
409
  ORDER BY (wallet_address, mint_address, updated_at);
410
 
411
- CREATE TABLE tokens (
412
  updated_at DateTime('UTC'),
413
  created_at DateTime('UTC'),
414
 
@@ -439,7 +439,7 @@ PRIMARY KEY (token_address)
439
  ORDER BY (token_address, updated_at);
440
 
441
  -- Latest tokens (one row per token_address)
442
- CREATE TABLE tokens_latest
443
  (
444
  updated_at DateTime('UTC'),
445
  created_at DateTime('UTC'),
@@ -465,7 +465,7 @@ CREATE TABLE tokens_latest
465
  ENGINE = ReplacingMergeTree(updated_at)
466
  ORDER BY (token_address);
467
 
468
- CREATE TABLE token_metrics (
469
  updated_at DateTime('UTC'),
470
  token_address String,
471
  total_volume_usd Float64,
@@ -483,7 +483,7 @@ ORDER BY (token_address, updated_at);
483
  -- Keep full history in the base tables above, but read fast from these ReplacingMergeTree snapshots.
484
 
485
  -- Latest wallet profile metrics (one row per wallet_address)
486
- CREATE TABLE wallet_profile_metrics_latest
487
  (
488
  updated_at DateTime('UTC'),
489
  wallet_address String,
@@ -550,7 +550,7 @@ ENGINE = ReplacingMergeTree(updated_at)
550
  ORDER BY (wallet_address);
551
 
552
  -- Latest wallet holdings (one row per wallet_address + mint_address)
553
- CREATE TABLE wallet_holdings_latest
554
  (
555
  updated_at DateTime('UTC'),
556
  start_holding_at DateTime('UTC'),
@@ -575,7 +575,7 @@ ENGINE = ReplacingMergeTree(updated_at)
575
  ORDER BY (wallet_address, mint_address);
576
 
577
  -- Latest token metrics (one row per token_address)
578
- CREATE TABLE token_metrics_latest
579
  (
580
  updated_at DateTime('UTC'),
581
  token_address String,
@@ -589,7 +589,7 @@ ENGINE = ReplacingMergeTree(updated_at)
589
  ORDER BY (token_address);
590
 
591
 
592
- CREATE TABLE known_wallets
593
  (
594
  `wallet_address` String,
595
  `name` String, -- e.g., "Pump.fun Fee Vault", "Raydium CPMM Authority V4", "KOL - Ansem"
 
1
+ CREATE TABLE IF NOT EXISTS trades
2
  (
3
  timestamp DateTime('UTC'),
4
  signature String,
 
53
  ORDER BY (base_address, timestamp, maker, signature);
54
 
55
  --- mint
56
+ CREATE TABLE IF NOT EXISTS mints
57
  (
58
  -- === Transaction Details ===
59
  -- Solana signature is usually 88 characters, but we use String for flexibility.
 
95
  ENGINE = MergeTree()
96
  ORDER BY (timestamp, creator_address, mint_address);
97
 
98
+ CREATE TABLE IF NOT EXISTS migrations
99
  (
100
  -- Transaction Details
101
  timestamp DateTime('UTC'),
 
121
  ENGINE = MergeTree()
122
  ORDER BY (mint_address, virtual_pool_address, pool_address, timestamp);
123
 
124
+ CREATE TABLE IF NOT EXISTS fee_collections
125
  (
126
  -- Transaction Details
127
  timestamp DateTime('UTC'),
 
148
  ENGINE = MergeTree()
149
  ORDER BY (vault_address, recipient_address, timestamp);
150
 
151
+ CREATE TABLE IF NOT EXISTS liquidity
152
  (
153
  -- Transaction Details --
154
  signature String,
 
173
  ENGINE = MergeTree()
174
  ORDER BY (timestamp, pool_address, lp_provider);
175
 
176
+ CREATE TABLE IF NOT EXISTS pool_creations (
177
  -- Transaction Details --
178
  signature String,
179
  timestamp Datetime('UTC'),
 
201
  ENGINE = MergeTree()
202
  ORDER BY (base_address, creator_address);
203
 
204
+ CREATE TABLE IF NOT EXISTS transfers
205
  (
206
  -- Transaction Details
207
  timestamp DateTime('UTC'),
 
227
  ENGINE = MergeTree()
228
  ORDER BY (source, destination, mint_address, timestamp);
229
 
230
+ CREATE TABLE IF NOT EXISTS supply_locks
231
  (
232
  -- === Transaction Details ===
233
  timestamp DateTime('UTC'),
 
252
  ENGINE = MergeTree()
253
  ORDER BY (timestamp, mint_address, sender, recipient);
254
 
255
+ CREATE TABLE IF NOT EXISTS supply_lock_actions
256
  (
257
  -- === Transaction Details ===
258
 
 
276
  ENGINE = MergeTree()
277
  ORDER BY (timestamp, mint_address, user);
278
 
279
+ CREATE TABLE IF NOT EXISTS burns
280
  (
281
  -- Transaction Details
282
  timestamp DateTime('UTC'),
 
299
 
300
  -------- Wallet schema
301
 
302
+ CREATE TABLE IF NOT EXISTS wallet_profiles
303
  (
304
  updated_at DateTime('UTC'),
305
  first_seen_ts DateTime('UTC'),
 
318
  PRIMARY KEY (wallet_address)
319
  ORDER BY (wallet_address);
320
 
321
+ CREATE TABLE IF NOT EXISTS wallet_profile_metrics
322
  (
323
  updated_at DateTime('UTC'),
324
  wallet_address String,
 
384
  ENGINE = MergeTree
385
  ORDER BY (wallet_address, updated_at);
386
 
387
+ CREATE TABLE IF NOT EXISTS wallet_holdings
388
  (
389
  updated_at DateTime('UTC'),
390
  start_holding_at DateTime('UTC'),
 
408
  ENGINE = MergeTree
409
  ORDER BY (wallet_address, mint_address, updated_at);
410
 
411
+ CREATE TABLE IF NOT EXISTS tokens (
412
  updated_at DateTime('UTC'),
413
  created_at DateTime('UTC'),
414
 
 
439
  ORDER BY (token_address, updated_at);
440
 
441
  -- Latest tokens (one row per token_address)
442
+ CREATE TABLE IF NOT EXISTS tokens_latest
443
  (
444
  updated_at DateTime('UTC'),
445
  created_at DateTime('UTC'),
 
465
  ENGINE = ReplacingMergeTree(updated_at)
466
  ORDER BY (token_address);
467
 
468
+ CREATE TABLE IF NOT EXISTS token_metrics (
469
  updated_at DateTime('UTC'),
470
  token_address String,
471
  total_volume_usd Float64,
 
483
  -- Keep full history in the base tables above, but read fast from these ReplacingMergeTree snapshots.
484
 
485
  -- Latest wallet profile metrics (one row per wallet_address)
486
+ CREATE TABLE IF NOT EXISTS wallet_profile_metrics_latest
487
  (
488
  updated_at DateTime('UTC'),
489
  wallet_address String,
 
550
  ORDER BY (wallet_address);
551
 
552
  -- Latest wallet holdings (one row per wallet_address + mint_address)
553
+ CREATE TABLE IF NOT EXISTS wallet_holdings_latest
554
  (
555
  updated_at DateTime('UTC'),
556
  start_holding_at DateTime('UTC'),
 
575
  ORDER BY (wallet_address, mint_address);
576
 
577
  -- Latest token metrics (one row per token_address)
578
+ CREATE TABLE IF NOT EXISTS token_metrics_latest
579
  (
580
  updated_at DateTime('UTC'),
581
  token_address String,
 
589
  ORDER BY (token_address);
590
 
591
 
592
+ CREATE TABLE IF NOT EXISTS known_wallets
593
  (
594
  `wallet_address` String,
595
  `name` String, -- e.g., "Pump.fun Fee Vault", "Raydium CPMM Authority V4", "KOL - Ansem"