liqproof 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +536 -2
  3. package/bugs/README.md +144 -0
  4. package/bugs/coin-gecko-liquidity-report.md +283 -0
  5. package/bugs/collect-ds-aggregate.mjs +213 -0
  6. package/bugs/collect-evidence.mjs +458 -0
  7. package/bugs/collect-gt-aggregate.mjs +215 -0
  8. package/bugs/collect-raw-rpc.mjs +165 -0
  9. package/bugs/collect-sweep-context.mjs +162 -0
  10. package/bugs/dexscreener-fake-liquidity-report.md +310 -0
  11. package/bugs/evidence/aggregator-liquidity-claims.json +648 -0
  12. package/bugs/evidence/aggregator-liquidity-claims.md +103 -0
  13. package/bugs/evidence/bat-native-pool-drained.json +136 -0
  14. package/bugs/evidence/bat-native-pool-drained.md +51 -0
  15. package/bugs/evidence/chz-impersonator-pool-drained.json +136 -0
  16. package/bugs/evidence/chz-impersonator-pool-drained.md +51 -0
  17. package/bugs/evidence/gt-stale-reserve-after-drain.json +141 -0
  18. package/bugs/evidence/gt-stale-reserve-after-drain.md +31 -0
  19. package/bugs/evidence/raw-rpc-transcript.json +683 -0
  20. package/bugs/evidence/raw-rpc-transcript.md +308 -0
  21. package/bugs/evidence/sweep-context.json +325 -0
  22. package/bugs/evidence/sweep-context.md +55 -0
  23. package/bugs/evidence/verified-aggregate.json +526 -0
  24. package/bugs/evidence/verified-aggregate.md +24 -0
  25. package/bugs/evidence/verified-ds-liquidity-usd.json +1197 -0
  26. package/bugs/evidence/verified-ds-liquidity-usd.md +250 -0
  27. package/bugs/evidence/verified-gt-reserve-in-usd.json +1002 -0
  28. package/bugs/evidence/verified-gt-reserve-in-usd.md +218 -0
  29. package/bugs/fix-bundle-titles.mjs +72 -0
  30. package/bugs/geckoterminal-stale-reserve-after-drain.md +137 -0
  31. package/data/dataset-summary.md +103 -0
  32. package/data/impersonators.json +12888 -0
  33. package/data/verified-impersonators.json +725 -0
  34. package/data/wallets.json +23 -0
  35. package/dist/base58.js +70 -0
  36. package/dist/base58.js.map +1 -0
  37. package/dist/canonical.js +372 -0
  38. package/dist/canonical.js.map +1 -0
  39. package/dist/cli.js +830 -0
  40. package/dist/cli.js.map +1 -0
  41. package/dist/curve.js +255 -0
  42. package/dist/curve.js.map +1 -0
  43. package/dist/dashboard.js +485 -0
  44. package/dist/dashboard.js.map +1 -0
  45. package/dist/keccak.js +197 -0
  46. package/dist/keccak.js.map +1 -0
  47. package/dist/mcp.js +604 -0
  48. package/dist/mcp.js.map +1 -0
  49. package/dist/operator.js +180 -0
  50. package/dist/operator.js.map +1 -0
  51. package/dist/pda.js +86 -0
  52. package/dist/pda.js.map +1 -0
  53. package/dist/receipt.js +897 -0
  54. package/dist/receipt.js.map +1 -0
  55. package/dist/render.js +335 -0
  56. package/dist/render.js.map +1 -0
  57. package/dist/rpc.js +377 -0
  58. package/dist/rpc.js.map +1 -0
  59. package/dist/sources.js +599 -0
  60. package/dist/sources.js.map +1 -0
  61. package/dist/store.js +330 -0
  62. package/dist/store.js.map +1 -0
  63. package/dist/tokenmeta.js +424 -0
  64. package/dist/tokenmeta.js.map +1 -0
  65. package/dist/util.js +273 -0
  66. package/dist/util.js.map +1 -0
  67. package/dist/vaults.js +510 -0
  68. package/dist/vaults.js.map +1 -0
  69. package/dist/wallet.js +404 -0
  70. package/dist/wallet.js.map +1 -0
  71. package/dist/warnings.js +41 -0
  72. package/dist/warnings.js.map +1 -0
  73. package/dist/worker.js +857 -0
  74. package/dist/worker.js.map +1 -0
  75. package/dist/x402.js +549 -0
  76. package/dist/x402.js.map +1 -0
  77. package/docs/HACKATHON-SUBMISSION.md +264 -0
  78. package/docs/liqproof-plan.md +221 -0
  79. package/docs/llms.txt +32 -0
  80. package/docs/mcp-registry.md +165 -0
  81. package/docs/screenshots/01-dashboard.png +0 -0
  82. package/docs/screenshots/02-receipt-drained.png +0 -0
  83. package/docs/screenshots/03-receipt-impersonator.png +0 -0
  84. package/docs/screenshots/04-receipt-canonical.png +0 -0
  85. package/docs/x402-pricing.md +171 -0
  86. package/docs/zero-xyz.md +250 -0
  87. package/out/6eftxVbSAunVEoxUWdGhPdxg5UdsJ8Wkwy5w5YFuxouw.json +1171 -0
  88. package/out/6eftxVbSAunVEoxUWdGhPdxg5UdsJ8Wkwy5w5YFuxouw.md +52 -0
  89. package/out/6eftxVbSAunVEoxUWdGhPdxg5UdsJ8Wkwy5w5YFuxouw.svg +25 -0
  90. package/out/BTNiaZb6HaEFWeEtND4SXtZ7T6mgtDwSryHTAj6PuPyp.json +3975 -0
  91. package/out/BTNiaZb6HaEFWeEtND4SXtZ7T6mgtDwSryHTAj6PuPyp.md +90 -0
  92. package/out/BTNiaZb6HaEFWeEtND4SXtZ7T6mgtDwSryHTAj6PuPyp.svg +25 -0
  93. package/out/ENGkoidj2jNs73A7GZuseVmnkRg6EVF9tDtViwPz8o85.json +1446 -0
  94. package/out/ENGkoidj2jNs73A7GZuseVmnkRg6EVF9tDtViwPz8o85.md +66 -0
  95. package/out/ENGkoidj2jNs73A7GZuseVmnkRg6EVF9tDtViwPz8o85.svg +25 -0
  96. package/out/dataset.csv +67 -0
  97. package/out/impersonation-table.md +156 -0
  98. package/out/index.html +1179 -0
  99. package/package.json +78 -4
  100. package/scripts/assert-no-canonical-accusations.mjs +193 -0
  101. package/scripts/backfill.mjs +1063 -0
  102. package/scripts/bundle-evidence.mjs +237 -0
  103. package/scripts/bundle-stale-claim.mjs +417 -0
  104. package/scripts/capture-bch-evidence.mjs +58 -0
  105. package/scripts/check-orientation-fix.mjs +40 -0
  106. package/scripts/check-wallet.mjs +54 -0
  107. package/scripts/daily-refresh.mjs +451 -0
  108. package/scripts/decode-clmm-vaults.mjs +180 -0
  109. package/scripts/falsifiability.mjs +263 -0
  110. package/scripts/impersonator-mining.mjs +156 -0
  111. package/scripts/inspect-matches.mjs +73 -0
  112. package/scripts/operator-sweep.mjs +252 -0
  113. package/scripts/publish-release.mjs +248 -0
  114. package/scripts/refresh-store.mjs +78 -0
  115. package/scripts/survival-miner.mjs +951 -0
  116. package/scripts/test-keccak.mjs +103 -0
  117. package/scripts/verify-bch-1p95b.mjs +124 -0
  118. package/scripts/verify-clmm-1p95b.mjs +127 -0
  119. package/scripts/verify-clmm-control.mjs +84 -0
  120. package/scripts/verify-impersonators.mjs +138 -0
  121. package/scripts/verify-raw.mjs +110 -0
  122. package/scripts/verify-raw2.mjs +99 -0
  123. package/server.json +34 -0
  124. package/src/base58.ts +68 -0
  125. package/src/canonical.ts +447 -0
  126. package/src/cli.ts +941 -0
  127. package/src/curve.ts +349 -0
  128. package/src/dashboard.ts +504 -0
  129. package/src/keccak.ts +228 -0
  130. package/src/mcp.ts +735 -0
  131. package/src/operator.ts +219 -0
  132. package/src/receipt.ts +1219 -0
  133. package/src/render.ts +396 -0
  134. package/src/rpc.ts +435 -0
  135. package/src/sources.ts +714 -0
  136. package/src/store.ts +428 -0
  137. package/src/tokenmeta.ts +460 -0
  138. package/src/util.ts +276 -0
  139. package/src/vaults.ts +574 -0
  140. package/src/wallet.ts +459 -0
  141. package/src/warnings.ts +40 -0
  142. package/src/worker.ts +1086 -0
  143. package/src/x402.ts +717 -0
@@ -0,0 +1,23 @@
1
+ {
2
+ "_comment": "Public receiving addresses for LIQPROOF payouts. These are PUBLIC by design — a receiving address is not a secret. Never put a seed phrase or a private key anywhere in this repository.",
3
+ "updated": "2026-12-05",
4
+ "solana": {
5
+ "address": "8oApra2ycYtmuC9DDhwX3YFti5GY21H8GndF2FnRgHhe",
6
+ "usdcAta": "GnMgfGMBEPpxsbTGKdCiV3sZh2mvd8JmgQS7GMU4oo5R",
7
+ "asset": "USDC (SPL)",
8
+ "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
9
+ "role": "primary — bug-bounty prizes, hackathon prizes, on-chain receipts",
10
+ "note": "Receiving is free: the sender pays the associated-token-account rent. The wallet was verified with `liqproof wallet` (base58, 32 bytes, on the ed25519 curve, ATA derived)."
11
+ },
12
+ "base": {
13
+ "address": "0xe17907369DA8733DBc84b3Cfc13651977e700b7D",
14
+ "asset": "USDC (ERC-20)",
15
+ "contract": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
16
+ "role": "secondary — x402 pay-per-call settlement (Coinbase CDP / Dexter facilitator settles on Base)",
17
+ "note": "EIP-55 checksum verified: the mixed-case spelling matches the Keccak-256 hash of the address, so it was copied correctly."
18
+ },
19
+ "offRamp": {
20
+ "note": "USDC is converted to EGP over P2P (Bybit or Binance) at roughly 0.5–1%. The exchange address is deliberately NOT recorded here — it is a custodial account, not a payout destination, and it does not belong in a public repository.",
21
+ "keep": "the exchange account holds nothing long-term; move USDC out after each cash-out"
22
+ }
23
+ }
package/dist/base58.js ADDED
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Minimal base58 (Bitcoin alphabet) codec.
3
+ * Zero-dependency: we only need it to turn raw 32-byte pubkeys found inside
4
+ * on-chain account data into the base58 addresses the RPC expects.
5
+ */
6
+ const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
7
+ const BASE = 58;
8
+ const INDEX = {};
9
+ for (let i = 0; i < ALPHABET.length; i++)
10
+ INDEX[ALPHABET[i]] = i;
11
+ export function encodeBase58(input) {
12
+ if (input.length === 0)
13
+ return '';
14
+ const digits = [0];
15
+ for (let i = 0; i < input.length; i++) {
16
+ let carry = input[i];
17
+ for (let j = 0; j < digits.length; j++) {
18
+ carry += digits[j] << 8;
19
+ digits[j] = carry % BASE;
20
+ carry = (carry / BASE) | 0;
21
+ }
22
+ while (carry > 0) {
23
+ digits.push(carry % BASE);
24
+ carry = (carry / BASE) | 0;
25
+ }
26
+ }
27
+ let out = '';
28
+ // leading zero bytes -> '1'
29
+ for (let i = 0; i < input.length && input[i] === 0; i++)
30
+ out += ALPHABET[0];
31
+ for (let i = digits.length - 1; i >= 0; i--)
32
+ out += ALPHABET[digits[i]];
33
+ return out;
34
+ }
35
+ export function decodeBase58(str) {
36
+ if (str.length === 0)
37
+ return new Uint8Array(0);
38
+ const bytes = [0];
39
+ for (let i = 0; i < str.length; i++) {
40
+ const value = INDEX[str[i]];
41
+ if (value === undefined)
42
+ throw new Error(`invalid base58 character: ${str[i]}`);
43
+ let carry = value;
44
+ for (let j = 0; j < bytes.length; j++) {
45
+ carry += bytes[j] * BASE;
46
+ bytes[j] = carry & 0xff;
47
+ carry >>= 8;
48
+ }
49
+ while (carry > 0) {
50
+ bytes.push(carry & 0xff);
51
+ carry >>= 8;
52
+ }
53
+ }
54
+ let leading = 0;
55
+ for (let i = 0; i < str.length && str[i] === ALPHABET[0]; i++)
56
+ leading++;
57
+ const out = new Uint8Array(leading + bytes.length);
58
+ for (let i = 0; i < bytes.length; i++)
59
+ out[leading + i] = bytes[bytes.length - 1 - i];
60
+ return out;
61
+ }
62
+ export function bytesEqual(a, b) {
63
+ if (a.length !== b.length)
64
+ return false;
65
+ for (let i = 0; i < a.length; i++)
66
+ if (a[i] !== b[i])
67
+ return false;
68
+ return true;
69
+ }
70
+ //# sourceMappingURL=base58.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base58.js","sourceRoot":"","sources":["../src/base58.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,QAAQ,GAAG,4DAA4D,CAAC;AAC9E,MAAM,IAAI,GAAG,EAAE,CAAC;AAEhB,MAAM,KAAK,GAA2B,EAAE,CAAC;AACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE;IAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAEjE,MAAM,UAAU,YAAY,CAAC,KAAiB;IAC5C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAElC,MAAM,MAAM,GAAa,CAAC,C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AC,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAE,CAAC;IACvF,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,CAAa,EAAE,CAAa;IACrD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IACnE,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,372 @@
1
+ /**
2
+ * canonical.ts — resolve the REAL token behind a name or ticker.
3
+ *
4
+ * ── WHY THIS FILE EXISTS ────────────────────────────────────────────────────
5
+ *
6
+ * LIQPROOF makes accusations. On 2026-12-04 we nearly shipped one of the
7
+ * worst kinds: our falsifiability harness labelled
8
+ *
9
+ * 6eftxVbSAunVEoxUWdGhPdxg5UdsJ8Wkwy5w5YFuxouw "CHZ copycat trap"
10
+ *
11
+ * and the very next probe proved that mint is the OFFICIAL Chiliz:
12
+ *
13
+ * • Chiliz's own documentation lists it as the Solana $CHZ contract
14
+ * https://docs.chiliz.com/quick-start/token-contract-addresses
15
+ * • CoinGecko's platform map for `chiliz` points at it
16
+ * • Jupiter prices it at $0.0109 — a real, live market price
17
+ * • its mint AND freeze authority are still active, under one custodial
18
+ * key (ER5dRbG8FA…) — exactly what a real project's own mint looks like
19
+ * • every impersonator we found has the OPPOSITE fingerprint: supply
20
+ * rounded to exactly 1,000,000,000, mint authority revoked, and a
21
+ * creator address from one shared vanity-key family
22
+ *
23
+ * One wrong accusation against a top-30 project destroys LIQPROOF's entire
24
+ * credibility — and, worse, a scanner that cries wolf is worthless even when
25
+ * it is right. So before this tool is allowed to call ANYTHING fake, it has
26
+ * to know who the genuine article is.
27
+ *
28
+ * ── THE RULE ────────────────────────────────────────────────────────────────
29
+ *
30
+ * A ticker is not an identity. Two mints can both be called "CHZ". Only the
31
+ * canonical mint identifies the project. Everything in this file exists to
32
+ * answer one question per mint:
33
+ *
34
+ * "is this mint the canonical one, or is it wearing its name?"
35
+ *
36
+ * and, when the answer is "wearing its name", to produce the RECEIPT for
37
+ * that claim: the canonical mint, who says so, and a URL a reader can open.
38
+ *
39
+ * ── WHERE THE TRUTH COMES FROM ───────────────────────────────────────────────
40
+ *
41
+ * Two tiers, both keyless and free:
42
+ *
43
+ * 1. first-party — the project's OWN documentation. Highest trust.
44
+ * 2. coingecko-platform — CoinGecko's coin→Solana-mint mapping, which is
45
+ * the industry reference and the thing every
46
+ * other aggregator in the room already agrees on.
47
+ *
48
+ * When the tiers disagree we do NOT guess: we report the disagreement. We
49
+ * also never infer canonicality from our own heuristics — that would be the
50
+ * tool marking its own homework.
51
+ */
52
+ import { DiskCache, fetchJson } from './util.js';
53
+ import { coingeckoTarget } from './sources.js';
54
+ // ── first-party registry ─────────────────────────────────────────────────────
55
+ /**
56
+ * Canonical mints confirmed against the project's OWN documentation.
57
+ *
58
+ * Each entry carries the URL we actually opened to verify it. A first-party
59
+ * claim is the only kind we are willing to publish as "this is the real one"
60
+ * without a second source agreeing.
61
+ */
62
+ export const FIRST_PARTY_CANONICAL = [
63
+ {
64
+ mint: '6eftxVbSAunVEoxUWdGhPdxg5UdsJ8Wkwy5w5YFuxouw',
65
+ name: 'Chiliz',
66
+ symbol: 'CHZ',
67
+ source: 'first-party',
68
+ proof: 'https://docs.chiliz.com/quick-start/token-contract-addresses',
69
+ proofLabel: "Chiliz official docs — Token Contract Addresses",
70
+ },
71
+ ];
72
+ // ── normalisation ────────────────────────────────────────────────────────────
73
+ /**
74
+ * Words that carry no identity when comparing a token's on-chain name to a
75
+ * registry name. "Basic Attention Token" and "Basic Attention" are the same
76
+ * project; "Chiliz" and "Chiliz Token" are the same project. Without this,
77
+ * the registry would miss the most obvious impersonation of all.
78
+ *
79
+ * ── WHAT IS *NOT* IN HERE, AND WHY ──────────────────────────────────────────
80
+ *
81
+ * This list is a loaded gun, and every word in it creates name collisions
82
+ * that are not collisions at all. We removed four words after measuring the
83
+ * damage on the live 9,053-mint sweep:
84
+ *
85
+ * 'swap' → "Solana Swap" became "solana", so every Solana memecoin named
86
+ * "Solana" looked like an impersonation of it. 14 tokens,
87
+ * $35 BILLION of advertised liquidity, wrongly attributed.
88
+ * 'x' → "Sol X" became "sol", so every token named "SOL" looked like
89
+ * an impersonation of it. 4 tokens, $6.1B, wrongly attributed.
90
+ * 'coin' → "USD Coin" became "usd", so a token named "USD Coin" matched a
91
+ * stablecoin literally called "USD+" instead of the real USDC.
92
+ * 'inu' → "Super Inu" became "super", so any token called "Super"
93
+ * looked like it.
94
+ *
95
+ * A word only belongs here if removing it NEVER changes which project a
96
+ * name refers to. "Token" does: "Chiliz Token" is Chiliz. "Coin" does not:
97
+ * "USD Coin" is USDC, "Useless Coin" is Useless, "a coin" is not "a".
98
+ */
99
+ const NOISE_WORDS = new Set([
100
+ 'token', 'network', 'protocol', 'finance', 'official', 'the', 'io',
101
+ ]);
102
+ /** Lowercase, strip everything but letters and digits. */
103
+ export function normalizeName(s) {
104
+ return (s ?? '')
105
+ .toLowerCase()
106
+ .normalize('NFKD')
107
+ .replace(/[^a-z0-9]+/g, ' ')
108
+ .trim()
109
+ .replace(/\s+/g, ' ');
110
+ }
111
+ /**
112
+ * The "core" of a name: normalised, with identity-free words removed.
113
+ * Used as the registry key so "Basic Attention Token" === "Basic Attention".
114
+ */
115
+ export function coreName(s) {
116
+ const words = normalizeName(s).split(' ').filter(Boolean);
117
+ const kept = words.filter((w) => !NOISE_WORDS.has(w));
118
+ return (kept.length ? kept : words).join('');
119
+ }
120
+ /** Normalised ticker. */
121
+ export function normalizeSymbol(s) {
122
+ return (s ?? '').trim().toUpperCase();
123
+ }
124
+ // ── representations: when a registered name is not an identity ───────────────
125
+ /**
126
+ * Words that mark a registered token as a REPRESENTATION of an asset that
127
+ * lives on another chain, rather than as the project's own identity.
128
+ *
129
+ * This matters because representations are legitimate and MANY. The market
130
+ * contains several different "Wormhole Bridged USDT" mints, several
131
+ * "Wrapped SOL" mints, several bridged TRX mints. If a registry entry can
132
+ * own a name, then every one of those honest bridge mints looks like a
133
+ * counterfeit of the other one — and the loudest victims are the projects
134
+ * whose assets are bridged the most (TRX, LUNC, HYPE, AVAX, DYDX, ZEC).
135
+ *
136
+ * So: a representation owns NOTHING. It cannot be impersonated, and it
137
+ * cannot be the victim of an impersonation. Its mint is still perfectly
138
+ * canonical when you query that mint directly — the distinction only
139
+ * matters for NAME and TICKER ownership.
140
+ */
141
+ const REPRESENTATION_WORDS = new Set([
142
+ 'wormhole', 'bridged', 'wrapped', 'portal', 'bridge', 'omnibridge',
143
+ 'stargate', 'layerzero', 'axlr', 'renbtc', 'wombat', 'allbridge',
144
+ ]);
145
+ /**
146
+ * Is this registered name a bridge/wrapper representation?
147
+ *
148
+ * "Solana Bridged TRX (Solana)", "Terra Classic (Wormhole)",
149
+ * "Wormhole Bridged HYPE", "OKX Wrapped BTC" — all representations.
150
+ */
151
+ export function isRepresentationName(name) {
152
+ const words = normalizeName(name).split(' ').filter(Boolean);
153
+ return words.some((w) => REPRESENTATION_WORDS.has(w));
154
+ }
155
+ function push(map, key, entry) {
156
+ const list = map.get(key);
157
+ if (list) {
158
+ if (!list.some((e) => e.mint === entry.mint))
159
+ list.push(entry);
160
+ }
161
+ else {
162
+ map.set(key, [entry]);
163
+ }
164
+ }
165
+ function indexOf(entries) {
166
+ const byMint = new Map();
167
+ const bySymbol = new Map();
168
+ const byCoreName = new Map();
169
+ const counts = {};
170
+ for (const e of entries) {
171
+ byMint.set(e.mint, e);
172
+ push(bySymbol, normalizeSymbol(e.symbol), e);
173
+ push(byCoreName, coreName(e.name), e);
174
+ counts[e.source] = (counts[e.source] ?? 0) + 1;
175
+ }
176
+ return { entries, byMint, bySymbol, byCoreName, loadedAt: new Date().toISOString(), counts };
177
+ }
178
+ const indexCache = new DiskCache(6 * 60 * 60_000, '.liqproof/cache');
179
+ /**
180
+ * Build the canonical index.
181
+ *
182
+ * CoinGecko's `/coins/list?include_platform=true` returns every coin with
183
+ * its per-chain contract addresses in ONE keyless request (~21,000 coins,
184
+ * ~7,000 of them on Solana, ~1.7 s). That is the whole market's canonical
185
+ * map for the cost of nothing, so the index is always fresh enough.
186
+ */
187
+ export async function loadCanonicalIndex() {
188
+ const key = 'canonical:index:v1';
189
+ const cached = indexCache.get(key);
190
+ if (cached)
191
+ return indexOf(cached);
192
+ const entries = [...FIRST_PARTY_CANONICAL];
193
+ const seen = new Set(entries.map((e) => e.mint));
194
+ try {
195
+ const cg = coingeckoTarget();
196
+ const list = await fetchJson(`${cg.base}/coins/list?include_platform=true`, {
197
+ retries: 4,
198
+ timeoutMs: 60_000,
199
+ headers: cg.headers,
200
+ });
201
+ for (const c of list ?? []) {
202
+ const mint = c?.platforms?.solana;
203
+ if (!mint || typeof mint !== 'string')
204
+ continue;
205
+ if (seen.has(mint))
206
+ continue;
207
+ seen.add(mint);
208
+ entries.push({
209
+ mint,
210
+ name: String(c.name ?? ''),
211
+ symbol: normalizeSymbol(String(c.symbol ?? '')),
212
+ source: 'coingecko-platform',
213
+ proof: `https://www.coingecko.com/en/coins/${c.id}`,
214
+ proofLabel: `CoinGecko — ${c.name} (${c.symbol})`,
215
+ coinId: String(c.id ?? ''),
216
+ });
217
+ }
218
+ }
219
+ catch {
220
+ // CoinGecko is down or rate-limited. We still have the first-party tier,
221
+ // and the receipt will say so rather than pretending the index is whole.
222
+ //
223
+ // IMPORTANT: fall back to the LAST GOOD index. An empty index would make
224
+ // every canonical token look like an impostor, and a receipt that cannot
225
+ // tell a real project from a fake one must not issue accusations at all.
226
+ const stale = indexCache.getStale(key);
227
+ if (stale)
228
+ return indexOf(stale.value);
229
+ }
230
+ if (!entries.length) {
231
+ const stale = indexCache.getStale(key);
232
+ if (stale)
233
+ return indexOf(stale.value);
234
+ }
235
+ indexCache.set(key, entries);
236
+ return indexOf(entries);
237
+ }
238
+ /**
239
+ * Resolve a mint against the canonical index.
240
+ *
241
+ * The decision ladder, ordered so that the SAFEST answer is the default:
242
+ *
243
+ * 1. The mint is in the index → CANONICAL. Stop.
244
+ * 2. A canonical token already owns this NAME → IMPERSONATOR (confirmed).
245
+ * 3. Exactly one canonical token owns this
246
+ * TICKER, and the mint spells that ticker
247
+ * as its own on-chain NAME → IMPERSONATOR (symbol-only).
248
+ * 4. Otherwise → UNRESOLVED. We say nothing.
249
+ *
250
+ * ── WHY STEP 3 IS NOT STEP 2 ────────────────────────────────────────────────
251
+ *
252
+ * A ticker is not an identity. Two mints can both be called "CHZ"; 49
253
+ * CoinGecko coins share the ticker "USDC". A NAME collision says "this mint
254
+ * is wearing another project's name". A TICKER collision says only "this
255
+ * mint spells another project's ticker". The first is an accusation; the
256
+ * second is an observation, and the receipt labels it TICKER_COLLISION
257
+ * rather than IMPERSONATION so nobody can mistake it for the stronger
258
+ * claim.
259
+ *
260
+ * Two extra guards keep the ticker path honest:
261
+ *
262
+ * • The canonical entry must not be a bridge/wrapper REPRESENTATION
263
+ * (see REPRESENTATION_WORDS). Several honest "Wormhole Bridged USDT"
264
+ * mints exist; calling one of them a copycat of another is nonsense.
265
+ *
266
+ * • The ticker must be owned by exactly ONE registered token. "USDC"
267
+ * belongs to one; "DOG" belongs to six; "BP" to three. An ambiguous
268
+ * ticker proves nothing and we publish nothing.
269
+ *
270
+ * Step 4 is the important one. The cost of staying quiet is one missed
271
+ * headline. The cost of guessing is a false accusation against a real
272
+ * project, which costs the product.
273
+ */
274
+ export function resolveCanonical(mint, identity, index) {
275
+ const symbol = normalizeSymbol(identity?.symbol ?? '');
276
+ const name = (identity?.name ?? '').trim();
277
+ const direct = index.byMint.get(mint);
278
+ if (direct) {
279
+ return {
280
+ mint,
281
+ status: 'canonical',
282
+ isCanonical: true,
283
+ confidence: 'confirmed',
284
+ method: `mint is the canonical ${direct.name} (${direct.source})`,
285
+ symbolMatches: index.bySymbol.get(symbol) ?? [],
286
+ nameMatches: index.byCoreName.get(coreName(name)) ?? [],
287
+ };
288
+ }
289
+ const symbolMatches = index.bySymbol.get(symbol) ?? [];
290
+ const nameMatches = index.byCoreName.get(coreName(name)) ?? [];
291
+ // ── 2. a canonical token already owns this NAME ──────────────────────────
292
+ //
293
+ // A canonical NAME is strong evidence: two mints cannot both be "Chiliz".
294
+ // We require the core names to be equal, so "Chiliz" matches "Chiliz
295
+ // Token" but "XRP" does NOT match "XRP (Wormhole)" — two bridge
296
+ // representations of one asset are both legitimate, and we must never
297
+ // call the second one a counterfeit of the first.
298
+ const nameOwners = nameMatches.filter((e) => !isRepresentationName(e.name));
299
+ if (nameOwners.length === 1) {
300
+ const c = nameOwners[0];
301
+ return {
302
+ mint,
303
+ status: 'impersonator',
304
+ isCanonical: false,
305
+ impersonates: c,
306
+ confidence: 'confirmed',
307
+ method: `on-chain name "${name}" is the registered name of ${c.name} (${c.source}); different mint`,
308
+ symbolMatches,
309
+ nameMatches,
310
+ };
311
+ }
312
+ // ── 3. a unique canonical token owns this TICKER ─────────────────────────
313
+ //
314
+ // We accept this only when the mint spells that ticker as its own
315
+ // on-chain NAME — a token that merely happens to carry the ticker in its
316
+ // symbol field is not claiming the name, so we say nothing. And we
317
+ // require the ticker to be unique among registered tokens that actually
318
+ // own identities (representations are excluded).
319
+ const tickerOwners = symbolMatches.filter((e) => !isRepresentationName(e.name));
320
+ if (tickerOwners.length === 1) {
321
+ const c = tickerOwners[0];
322
+ if (coreName(name) === coreName(c.symbol)) {
323
+ return {
324
+ mint,
325
+ status: 'impersonator',
326
+ isCanonical: false,
327
+ impersonates: c,
328
+ confidence: 'symbol-only',
329
+ method: `on-chain ticker ${symbol} is registered to ${c.name} (${c.source}); this mint spells that ticker as its own name; different mint`,
330
+ symbolMatches,
331
+ nameMatches,
332
+ };
333
+ }
334
+ }
335
+ // ── 4. say nothing ───────────────────────────────────────────────────────
336
+ return {
337
+ mint,
338
+ status: 'unresolved',
339
+ isCanonical: false,
340
+ confidence: 'unresolved',
341
+ method: symbolMatches.length > 1
342
+ ? `ticker ${symbol} is shared by ${symbolMatches.length} registered tokens — not distinguishable`
343
+ : nameMatches.length > 0
344
+ ? `on-chain name "${name}" matches only a bridge/wrapper representation — not an identity claim`
345
+ : 'no registered token claims this name or ticker',
346
+ symbolMatches,
347
+ nameMatches,
348
+ };
349
+ }
350
+ /**
351
+ * Are two names close enough to be the same project?
352
+ *
353
+ * Used for the NAME-ownership comparison, and deliberately strict: after
354
+ * removing identity-free words, the two names must be EQUAL. We do NOT
355
+ * accept substring matches, because "XRP" is a substring of "XRP
356
+ * (Wormhole)" and two different bridge representations of the same asset
357
+ * are both legitimate. Treating a substring as a match would accuse every
358
+ * honest wrapped asset in the market.
359
+ *
360
+ * We also do NOT accept "the canonical's ticker is a prefix of its name"
361
+ * matches, because that is how "Basic Attention" would start matching
362
+ * "BAT" and how "Solana Swap" would start matching "Solana". Equality of
363
+ * the whole core name is the only rule that survived measurement.
364
+ */
365
+ export function namesCompatible(a, b) {
366
+ const ca = coreName(a);
367
+ const cb = coreName(b);
368
+ if (!ca || !cb)
369
+ return false;
370
+ return ca === cb;
371
+ }
372
+ //# sourceMappingURL=canonical.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonical.js","sourceRoot":"","sources":["../src/canonical.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,gFAAgF;AAEhF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACrD;QACE,IAAI,EAAE,8CAA8C;QACpD,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,aAAa;QACrB,KAAK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