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.
- package/LICENSE +21 -0
- package/README.md +536 -2
- package/bugs/README.md +144 -0
- package/bugs/coin-gecko-liquidity-report.md +283 -0
- package/bugs/collect-ds-aggregate.mjs +213 -0
- package/bugs/collect-evidence.mjs +458 -0
- package/bugs/collect-gt-aggregate.mjs +215 -0
- package/bugs/collect-raw-rpc.mjs +165 -0
- package/bugs/collect-sweep-context.mjs +162 -0
- package/bugs/dexscreener-fake-liquidity-report.md +310 -0
- package/bugs/evidence/aggregator-liquidity-claims.json +648 -0
- package/bugs/evidence/aggregator-liquidity-claims.md +103 -0
- package/bugs/evidence/bat-native-pool-drained.json +136 -0
- package/bugs/evidence/bat-native-pool-drained.md +51 -0
- package/bugs/evidence/chz-impersonator-pool-drained.json +136 -0
- package/bugs/evidence/chz-impersonator-pool-drained.md +51 -0
- package/bugs/evidence/gt-stale-reserve-after-drain.json +141 -0
- package/bugs/evidence/gt-stale-reserve-after-drain.md +31 -0
- package/bugs/evidence/raw-rpc-transcript.json +683 -0
- package/bugs/evidence/raw-rpc-transcript.md +308 -0
- package/bugs/evidence/sweep-context.json +325 -0
- package/bugs/evidence/sweep-context.md +55 -0
- package/bugs/evidence/verified-aggregate.json +526 -0
- package/bugs/evidence/verified-aggregate.md +24 -0
- package/bugs/evidence/verified-ds-liquidity-usd.json +1197 -0
- package/bugs/evidence/verified-ds-liquidity-usd.md +250 -0
- package/bugs/evidence/verified-gt-reserve-in-usd.json +1002 -0
- package/bugs/evidence/verified-gt-reserve-in-usd.md +218 -0
- package/bugs/fix-bundle-titles.mjs +72 -0
- package/bugs/geckoterminal-stale-reserve-after-drain.md +137 -0
- package/data/dataset-summary.md +103 -0
- package/data/impersonators.json +12888 -0
- package/data/verified-impersonators.json +725 -0
- package/data/wallets.json +23 -0
- package/dist/base58.js +70 -0
- package/dist/base58.js.map +1 -0
- package/dist/canonical.js +372 -0
- package/dist/canonical.js.map +1 -0
- package/dist/cli.js +830 -0
- package/dist/cli.js.map +1 -0
- package/dist/curve.js +255 -0
- package/dist/curve.js.map +1 -0
- package/dist/dashboard.js +485 -0
- package/dist/dashboard.js.map +1 -0
- package/dist/keccak.js +197 -0
- package/dist/keccak.js.map +1 -0
- package/dist/mcp.js +604 -0
- package/dist/mcp.js.map +1 -0
- package/dist/operator.js +180 -0
- package/dist/operator.js.map +1 -0
- package/dist/pda.js +86 -0
- package/dist/pda.js.map +1 -0
- package/dist/receipt.js +897 -0
- package/dist/receipt.js.map +1 -0
- package/dist/render.js +335 -0
- package/dist/render.js.map +1 -0
- package/dist/rpc.js +377 -0
- package/dist/rpc.js.map +1 -0
- package/dist/sources.js +599 -0
- package/dist/sources.js.map +1 -0
- package/dist/store.js +330 -0
- package/dist/store.js.map +1 -0
- package/dist/tokenmeta.js +424 -0
- package/dist/tokenmeta.js.map +1 -0
- package/dist/util.js +273 -0
- package/dist/util.js.map +1 -0
- package/dist/vaults.js +510 -0
- package/dist/vaults.js.map +1 -0
- package/dist/wallet.js +404 -0
- package/dist/wallet.js.map +1 -0
- package/dist/warnings.js +41 -0
- package/dist/warnings.js.map +1 -0
- package/dist/worker.js +857 -0
- package/dist/worker.js.map +1 -0
- package/dist/x402.js +549 -0
- package/dist/x402.js.map +1 -0
- package/docs/HACKATHON-SUBMISSION.md +264 -0
- package/docs/liqproof-plan.md +221 -0
- package/docs/llms.txt +32 -0
- package/docs/mcp-registry.md +165 -0
- package/docs/screenshots/01-dashboard.png +0 -0
- package/docs/screenshots/02-receipt-drained.png +0 -0
- package/docs/screenshots/03-receipt-impersonator.png +0 -0
- package/docs/screenshots/04-receipt-canonical.png +0 -0
- package/docs/x402-pricing.md +171 -0
- package/docs/zero-xyz.md +250 -0
- package/out/6eftxVbSAunVEoxUWdGhPdxg5UdsJ8Wkwy5w5YFuxouw.json +1171 -0
- package/out/6eftxVbSAunVEoxUWdGhPdxg5UdsJ8Wkwy5w5YFuxouw.md +52 -0
- package/out/6eftxVbSAunVEoxUWdGhPdxg5UdsJ8Wkwy5w5YFuxouw.svg +25 -0
- package/out/BTNiaZb6HaEFWeEtND4SXtZ7T6mgtDwSryHTAj6PuPyp.json +3975 -0
- package/out/BTNiaZb6HaEFWeEtND4SXtZ7T6mgtDwSryHTAj6PuPyp.md +90 -0
- package/out/BTNiaZb6HaEFWeEtND4SXtZ7T6mgtDwSryHTAj6PuPyp.svg +25 -0
- package/out/ENGkoidj2jNs73A7GZuseVmnkRg6EVF9tDtViwPz8o85.json +1446 -0
- package/out/ENGkoidj2jNs73A7GZuseVmnkRg6EVF9tDtViwPz8o85.md +66 -0
- package/out/ENGkoidj2jNs73A7GZuseVmnkRg6EVF9tDtViwPz8o85.svg +25 -0
- package/out/dataset.csv +67 -0
- package/out/impersonation-table.md +156 -0
- package/out/index.html +1179 -0
- package/package.json +78 -4
- package/scripts/assert-no-canonical-accusations.mjs +193 -0
- package/scripts/backfill.mjs +1063 -0
- package/scripts/bundle-evidence.mjs +237 -0
- package/scripts/bundle-stale-claim.mjs +417 -0
- package/scripts/capture-bch-evidence.mjs +58 -0
- package/scripts/check-orientation-fix.mjs +40 -0
- package/scripts/check-wallet.mjs +54 -0
- package/scripts/daily-refresh.mjs +451 -0
- package/scripts/decode-clmm-vaults.mjs +180 -0
- package/scripts/falsifiability.mjs +263 -0
- package/scripts/impersonator-mining.mjs +156 -0
- package/scripts/inspect-matches.mjs +73 -0
- package/scripts/operator-sweep.mjs +252 -0
- package/scripts/publish-release.mjs +248 -0
- package/scripts/refresh-store.mjs +78 -0
- package/scripts/survival-miner.mjs +951 -0
- package/scripts/test-keccak.mjs +103 -0
- package/scripts/verify-bch-1p95b.mjs +124 -0
- package/scripts/verify-clmm-1p95b.mjs +127 -0
- package/scripts/verify-clmm-control.mjs +84 -0
- package/scripts/verify-impersonators.mjs +138 -0
- package/scripts/verify-raw.mjs +110 -0
- package/scripts/verify-raw2.mjs +99 -0
- package/server.json +34 -0
- package/src/base58.ts +68 -0
- package/src/canonical.ts +447 -0
- package/src/cli.ts +941 -0
- package/src/curve.ts +349 -0
- package/src/dashboard.ts +504 -0
- package/src/keccak.ts +228 -0
- package/src/mcp.ts +735 -0
- package/src/operator.ts +219 -0
- package/src/receipt.ts +1219 -0
- package/src/render.ts +396 -0
- package/src/rpc.ts +435 -0
- package/src/sources.ts +714 -0
- package/src/store.ts +428 -0
- package/src/tokenmeta.ts +460 -0
- package/src/util.ts +276 -0
- package/src/vaults.ts +574 -0
- package/src/wallet.ts +459 -0
- package/src/warnings.ts +40 -0
- package/src/worker.ts +1086 -0
- package/src/x402.ts +717 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
// Evidence bundle generator for bug reports.
|
|
2
|
+
//
|
|
3
|
+
// Produces, for each reported finding:
|
|
4
|
+
// bugs/evidence/<slug>.json — every fact, with the raw RPC/quote values
|
|
5
|
+
// bugs/evidence/<slug>.md — a human-readable evidence sheet
|
|
6
|
+
//
|
|
7
|
+
// Everything here is reproducible: `node scripts/bundle-evidence.mjs`.
|
|
8
|
+
// The numbers in the bug reports are copied from these files, not typed by
|
|
9
|
+
// hand, so a reviewer can regenerate them and get the same answer.
|
|
10
|
+
|
|
11
|
+
import { writeFileSync, mkdirSync } from 'node:fs';
|
|
12
|
+
import { RpcPool } from '../dist/rpc.js';
|
|
13
|
+
import { buildReceipt } from '../dist/receipt.js';
|
|
14
|
+
|
|
15
|
+
const OUT = new URL('../bugs/evidence/', import.meta.url).pathname.replace(/^\//, '');
|
|
16
|
+
mkdirSync(OUT, { recursive: true });
|
|
17
|
+
|
|
18
|
+
const USDC = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';
|
|
19
|
+
|
|
20
|
+
const CASES = [
|
|
21
|
+
{
|
|
22
|
+
slug: 'bat-native-pool-drained',
|
|
23
|
+
title: 'Native BAT/USDC pool advertises $136,104,316 but the quote vault holds $25.60',
|
|
24
|
+
mint: 'BTNiaZb6HaEFWeEtND4SXtZ7T6mgtDwSryHTAj6PuPyp',
|
|
25
|
+
pool: '9NBCuxsfd8vsfTzNzHHAgoSXoSowgAhemtE3JfpwDTyD',
|
|
26
|
+
symbol: 'BAT',
|
|
27
|
+
dex: 'raydium',
|
|
28
|
+
txs: 600,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
slug: 'chz-impersonator-pool-drained',
|
|
32
|
+
title: 'Token presented as "CHZ / Chiliz" advertises $49,597,316 but the quote vault holds $9.62',
|
|
33
|
+
mint: '9vDguocExRQTPMjvULQCKCyti4ZycqzAQmcBjg8AsHdy',
|
|
34
|
+
pool: '3ZbtieoKXDvbHsYC9KKjqRAFtW4TSnq5cWc2WmEQBsB7',
|
|
35
|
+
symbol: 'CHZ',
|
|
36
|
+
dex: 'raydium',
|
|
37
|
+
txs: 120,
|
|
38
|
+
},
|
|
39
|
+
// NOTE: there is deliberately no "chz-copycat-b" case here any more.
|
|
40
|
+
//
|
|
41
|
+
// `6eftxVbSA…` was in this list labelled as a Chiliz copycat. It is the
|
|
42
|
+
// OFFICIAL $CHZ mint on Solana — listed in Chiliz's own documentation,
|
|
43
|
+
// mapped by CoinGecko, priced live by Jupiter, with an active custodial
|
|
44
|
+
// mint and freeze authority. Publishing it as a counterfeit would have
|
|
45
|
+
// been a false accusation against a real top-30 project.
|
|
46
|
+
//
|
|
47
|
+
// It now lives in `scripts/falsifiability.mjs` as a SAFE case whose
|
|
48
|
+
// expected verdict is UNBACKED_LIQUIDITY — a finding about its POOL, never
|
|
49
|
+
// an accusation against the token. The rule that changed it is the
|
|
50
|
+
// canonical resolver in `src/canonical.ts`.
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const rpc = new RpcPool({ verbose: false });
|
|
54
|
+
|
|
55
|
+
for (const c of CASES) {
|
|
56
|
+
console.log(`\n=== ${c.slug}`);
|
|
57
|
+
|
|
58
|
+
// on-chain mint facts
|
|
59
|
+
const acc = await rpc.callDetailed('getAccountInfo', [c.mint, { encoding: 'jsonParsed' }]);
|
|
60
|
+
const info = acc.value?.value?.data?.parsed?.info ?? {};
|
|
61
|
+
const mintFacts = {
|
|
62
|
+
address: c.mint,
|
|
63
|
+
decimals: info.decimals ?? null,
|
|
64
|
+
supply: info.supply ?? null,
|
|
65
|
+
mintAuthority: info.mintAuthority ?? null,
|
|
66
|
+
freezeAuthority: info.freezeAuthority ?? null,
|
|
67
|
+
isInitialized: info.isInitialized ?? null,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// aggregator claims (independent, public, keyless)
|
|
71
|
+
const ds = await (await fetch(`https://api.dexscreener.com/tokens/v1/solana/${c.mint}`)).json();
|
|
72
|
+
const dsPair = (Array.isArray(ds) ? ds : []).find((p) => p.pairAddress === c.pool) ?? (Array.isArray(ds) ? ds[0] : null);
|
|
73
|
+
const dsClaim = {
|
|
74
|
+
source: 'dexscreener',
|
|
75
|
+
endpoint: `https://api.dexscreener.com/tokens/v1/solana/${c.mint}`,
|
|
76
|
+
fetchedAt: new Date().toISOString(),
|
|
77
|
+
pairAddress: dsPair?.pairAddress ?? null,
|
|
78
|
+
liquidityUsd: Number(dsPair?.liquidity?.usd ?? 0),
|
|
79
|
+
volume24hUsd: Number(dsPair?.volume?.h24 ?? 0),
|
|
80
|
+
baseTokenName: dsPair?.baseToken?.name ?? null,
|
|
81
|
+
baseTokenSymbol: dsPair?.baseToken?.symbol ?? null,
|
|
82
|
+
priceUsd: Number(dsPair?.priceUsd ?? 0),
|
|
83
|
+
labels: dsPair?.labels ?? null,
|
|
84
|
+
dexId: dsPair?.dexId ?? null,
|
|
85
|
+
pairCreatedAt: dsPair?.pairCreatedAt ?? null,
|
|
86
|
+
url: dsPair?.url ?? null,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const gt = await (await fetch(`https://api.geckoterminal.com/api/v2/networks/solana/tokens/${c.mint}/pools`)).json();
|
|
90
|
+
const gtPool = (gt?.data ?? []).find((p) => p.attributes?.address === c.pool);
|
|
91
|
+
const gtClaim = {
|
|
92
|
+
source: 'geckoterminal',
|
|
93
|
+
endpoint: `https://api.geckoterminal.com/api/v2/networks/solana/tokens/${c.mint}/pools`,
|
|
94
|
+
fetchedAt: new Date().toISOString(),
|
|
95
|
+
pool: gtPool?.attributes?.address ?? null,
|
|
96
|
+
reserveInUsd: Number(gtPool?.attributes?.reserve_in_usd ?? 0),
|
|
97
|
+
volume24hUsd: Number(gtPool?.attributes?.volume_usd?.h24 ?? 0),
|
|
98
|
+
baseTokenPriceUsd: Number(gtPool?.attributes?.base_token_price_usd ?? 0),
|
|
99
|
+
name: gtPool?.attributes?.name ?? null,
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// the receipt
|
|
103
|
+
const rec = await buildReceipt(rpc, c.mint, {
|
|
104
|
+
includeCurve: true,
|
|
105
|
+
maxTransactions: c.txs,
|
|
106
|
+
focusPool: c.pool,
|
|
107
|
+
focusPoolData: {
|
|
108
|
+
address: c.pool,
|
|
109
|
+
name: c.symbol,
|
|
110
|
+
dexId: c.dex,
|
|
111
|
+
reportedLiquidityUsd: dsClaim.liquidityUsd,
|
|
112
|
+
reportedVolume24hUsd: dsClaim.volume24hUsd,
|
|
113
|
+
baseTokenAddress: c.mint,
|
|
114
|
+
baseTokenSymbol: c.symbol,
|
|
115
|
+
quoteTokenAddress: USDC,
|
|
116
|
+
quoteTokenSymbol: 'USDC',
|
|
117
|
+
basePriceUsd: dsClaim.priceUsd,
|
|
118
|
+
quotePriceUsd: 0,
|
|
119
|
+
source: 'dexscreener',
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const snap = rec.pools?.[0];
|
|
124
|
+
const vaults = (snap?.vaults ?? []).map((v) => ({
|
|
125
|
+
side: v.side,
|
|
126
|
+
address: v.address,
|
|
127
|
+
mint: v.mint,
|
|
128
|
+
uiAmount: v.uiAmount,
|
|
129
|
+
decimals: v.decimals,
|
|
130
|
+
method: v.method,
|
|
131
|
+
}));
|
|
132
|
+
|
|
133
|
+
const bundle = {
|
|
134
|
+
slug: c.slug,
|
|
135
|
+
title: c.title,
|
|
136
|
+
generatedAt: new Date().toISOString(),
|
|
137
|
+
tool: { name: 'LIQPROOF', version: '0.1.0', command: `liqproof receipt ${c.mint} --txs=${c.txs}` },
|
|
138
|
+
subject: {
|
|
139
|
+
mint: c.mint,
|
|
140
|
+
symbol: c.symbol,
|
|
141
|
+
pool: c.pool,
|
|
142
|
+
dex: c.dex,
|
|
143
|
+
mintFacts,
|
|
144
|
+
},
|
|
145
|
+
aggregatorClaims: [dsClaim, gtClaim],
|
|
146
|
+
onChain: {
|
|
147
|
+
verdict: rec.verdict,
|
|
148
|
+
claimedUsd: rec.claimed.liquidityUsd,
|
|
149
|
+
depositedUsd: rec.real.depositedUsd,
|
|
150
|
+
coverage: rec.real.coverage,
|
|
151
|
+
selfDenominatedPct: rec.real.selfDenominatedPct,
|
|
152
|
+
divergenceRatio: rec.real.divergenceRatio,
|
|
153
|
+
heldTokens: rec.real.heldTokens,
|
|
154
|
+
peakDepositedUsd: rec.real.peakDepositedUsd,
|
|
155
|
+
drainAt: rec.real.drainAt ?? null,
|
|
156
|
+
drainSlot: rec.real.drainSlot ?? null,
|
|
157
|
+
drainSignature: rec.real.drainSignature ?? null,
|
|
158
|
+
drainDeltaUsd: rec.real.drainDeltaUsd ?? null,
|
|
159
|
+
vaults,
|
|
160
|
+
vaultDiscoveryMethod: snap?.method ?? null,
|
|
161
|
+
},
|
|
162
|
+
executionOracle: {
|
|
163
|
+
source: 'https://lite-api.jup.ag/swap/v1/quote',
|
|
164
|
+
buy: rec.oracle.buyQuote,
|
|
165
|
+
sell: rec.oracle.sellQuote,
|
|
166
|
+
},
|
|
167
|
+
timeline: (rec.curve?.points ?? []).map((p) => ({
|
|
168
|
+
timestamp: p.timestamp ?? null,
|
|
169
|
+
slot: p.slot ?? null,
|
|
170
|
+
depositedUsd: p.depositedUsd,
|
|
171
|
+
deltaUsd: p.deltaUsd,
|
|
172
|
+
signature: p.signature ?? null,
|
|
173
|
+
})),
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
writeFileSync(`${OUT}${c.slug}.json`, JSON.stringify(bundle, null, 2));
|
|
177
|
+
|
|
178
|
+
const md = `# Evidence — ${c.title}
|
|
179
|
+
|
|
180
|
+
Generated ${bundle.generatedAt} by \`${bundle.tool.command}\`.
|
|
181
|
+
Regenerate with: \`node scripts/bundle-evidence.mjs\`
|
|
182
|
+
|
|
183
|
+
## Subject
|
|
184
|
+
|
|
185
|
+
| field | value |
|
|
186
|
+
|---|---|
|
|
187
|
+
| token | \`${c.mint}\` (${c.symbol}) |
|
|
188
|
+
| pool | \`${c.pool}\` (${c.dex}) |
|
|
189
|
+
| decimals | ${mintFacts.decimals} |
|
|
190
|
+
| supply | ${mintFacts.supply} |
|
|
191
|
+
| mint authority | ${mintFacts.mintAuthority ?? 'none (renounced)'} |
|
|
192
|
+
| freeze authority | ${mintFacts.freezeAuthority ?? 'none'} |
|
|
193
|
+
|
|
194
|
+
## What the aggregators claim
|
|
195
|
+
|
|
196
|
+
| source | endpoint | claim |
|
|
197
|
+
|---|---|---|
|
|
198
|
+
| DexScreener | \`${dsClaim.endpoint}\` | **$${dsClaim.liquidityUsd.toLocaleString('en-US', { maximumFractionDigits: 0 })}** (24h vol $${dsClaim.volume24hUsd.toLocaleString('en-US', { maximumFractionDigits: 0 })}) |
|
|
199
|
+
| GeckoTerminal | \`${gtClaim.endpoint}\` | **$${gtClaim.reserveInUsd.toLocaleString('en-US', { maximumFractionDigits: 0 })}** (24h vol $${gtClaim.volume24hUsd.toLocaleString('en-US', { maximumFractionDigits: 0 })}) |
|
|
200
|
+
|
|
201
|
+
## What the chain says
|
|
202
|
+
|
|
203
|
+
| field | value |
|
|
204
|
+
|---|---|
|
|
205
|
+
| verdict | **${rec.verdict}** |
|
|
206
|
+
| claimed (in receipt) | $${rec.claimed.liquidityUsd.toLocaleString('en-US', { maximumFractionDigits: 0 })} |
|
|
207
|
+
| **deposited (quote vault)** | **$${rec.real.depositedUsd.toFixed(2)}** |
|
|
208
|
+
| deposit coverage | **${(rec.real.coverage * 100).toPrecision(3)}%** |
|
|
209
|
+
| self-denominated | ${(rec.real.selfDenominatedPct * 100).toFixed(2)}% |
|
|
210
|
+
| overstatement | **${Number.isFinite(rec.real.divergenceRatio) ? rec.real.divergenceRatio.toLocaleString('en-US', { maximumFractionDigits: 0 }) + '×' : '∞'}** |
|
|
211
|
+
| peak ever deposited | $${(rec.real.peakDepositedUsd ?? 0).toFixed(2)} |
|
|
212
|
+
| drain | ${rec.real.drainAt ?? 'n/a'} |
|
|
213
|
+
| drain tx | \`${rec.real.drainSignature ?? 'n/a'}\` |
|
|
214
|
+
| drain delta | $${(rec.real.drainDeltaUsd ?? 0).toFixed(2)} |
|
|
215
|
+
|
|
216
|
+
### Vaults (read directly with \`getMultipleAccounts\`)
|
|
217
|
+
|
|
218
|
+
${vaults.map((v) => `| ${v.side} | \`${v.address}\` | ${v.uiAmount} ${v.mint === USDC ? 'USDC' : 'token'} | ${v.method} |`).join('\n')}
|
|
219
|
+
|
|
220
|
+
## Execution oracle (Jupiter, live route)
|
|
221
|
+
|
|
222
|
+
| direction | out | priceImpactPct | route |
|
|
223
|
+
|---|---|---|---|
|
|
224
|
+
| buy 1 USDC | ${rec.oracle.buyQuote?.outAmount ?? '—'} | ${rec.oracle.buyQuote?.priceImpactPct ?? '—'} | ${rec.oracle.buyQuote?.routePlan?.map((r) => r.swapInfo?.label).join(' → ') ?? '—'} |
|
|
225
|
+
| sell 1 token | ${rec.oracle.sellQuote?.outAmount ?? '—'} | ${rec.oracle.sellQuote?.priceImpactPct ?? '—'} | ${rec.oracle.sellQuote?.routePlan?.map((r) => r.swapInfo?.label).join(' → ') ?? '—'} |
|
|
226
|
+
|
|
227
|
+
\`priceImpactPct\` is a ratio where \`1\` = 100%.
|
|
228
|
+
`;
|
|
229
|
+
writeFileSync(`${OUT}${c.slug}.md`, md);
|
|
230
|
+
|
|
231
|
+
console.log(
|
|
232
|
+
` ${rec.verdict} claim=$${rec.claimed.liquidityUsd.toFixed(0)} dep=$${rec.real.depositedUsd.toFixed(2)} cov=${(rec.real.coverage * 100).toPrecision(3)}% drain=${rec.real.drainSignature?.slice(0, 12) ?? 'n/a'}`,
|
|
233
|
+
);
|
|
234
|
+
await new Promise((x) => setTimeout(x, 1500));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
console.log(`\nwrote evidence to ${OUT}`);
|
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
// Evidence bundle + ready-to-send bug report for the $1.92 BILLION stale
|
|
2
|
+
// liquidity claim.
|
|
3
|
+
//
|
|
4
|
+
// FINDING
|
|
5
|
+
// Pool CEvMnd2b79GFzsxSvJntvBZyjwJvrEaXbEfUURkyHg4f (raydium-clmm)
|
|
6
|
+
// was created 2026-12-04T08:58:05Z and fully drained 27 minutes later in
|
|
7
|
+
// a single transaction. GeckoTerminal still reports ~$1.92 BILLION of
|
|
8
|
+
// `reserve_in_usd` for it, while DexScreener reports $0.19 for the same
|
|
9
|
+
// pool.
|
|
10
|
+
//
|
|
11
|
+
// WHY IT IS A DATA BUG AND NOT A TOKEN STORY
|
|
12
|
+
// GeckoTerminal's own payload implies the pool holds ~9.88 MILLION tokens.
|
|
13
|
+
// The chain says the pool's quote vault holds 0.000001 USDT and its base
|
|
14
|
+
// vault holds 0.001018 tokens. The number on the dashboard is the pool's
|
|
15
|
+
// base amount multiplied by a LIVE price — so the advertised liquidity
|
|
16
|
+
// keeps MOVING even though the tokens are gone.
|
|
17
|
+
//
|
|
18
|
+
// Everything below is regenerated from live chain + API state. The report
|
|
19
|
+
// file is written by this script, so its numbers can never drift from the
|
|
20
|
+
// measurement.
|
|
21
|
+
//
|
|
22
|
+
// node scripts/bundle-stale-claim.mjs
|
|
23
|
+
//
|
|
24
|
+
// Read-only.
|
|
25
|
+
|
|
26
|
+
import { writeFileSync, mkdirSync } from 'node:fs';
|
|
27
|
+
import { RpcPool } from '../dist/rpc.js';
|
|
28
|
+
import { encodeBase58, decodeBase58 } from '../dist/base58.js';
|
|
29
|
+
|
|
30
|
+
const OUT = new URL('../bugs/evidence/', import.meta.url).pathname.replace(/^\//, '');
|
|
31
|
+
mkdirSync(OUT, { recursive: true });
|
|
32
|
+
|
|
33
|
+
const POOL = 'CEvMnd2b79GFzsxSvJntvBZyjwJvrEaXbEfUURkyHg4f';
|
|
34
|
+
const MINT = 'ENGkoidj2jNs73A7GZuseVmnkRg6EVF9tDtViwPz8o85';
|
|
35
|
+
const DRAIN_TX = '4b2SgzpTcPaTNguxWMFH6aUAD14NJq78muypWbf46Rk3Rre6aHAAs37cqUgZQHpLhC7E45iTuLyvCU49LfMEhUMj';
|
|
36
|
+
const CLMM_PROGRAM = 'CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK';
|
|
37
|
+
|
|
38
|
+
const rpc = new RpcPool({ verbose: false });
|
|
39
|
+
|
|
40
|
+
function iso(ms) {
|
|
41
|
+
return new Date(ms).toISOString();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ── 1. GeckoTerminal ─────────────────────────────────────────────────────────
|
|
45
|
+
const gtRes = await fetch(
|
|
46
|
+
`https://api.geckoterminal.com/api/v2/networks/solana/tokens/${MINT}/pools?page=1`,
|
|
47
|
+
{ headers: { accept: 'application/json' } },
|
|
48
|
+
);
|
|
49
|
+
const gtJson = await gtRes.json();
|
|
50
|
+
const gtPool = (gtJson?.data ?? []).find((p) => p?.id?.split('_')[1] === POOL);
|
|
51
|
+
if (!gtPool) throw new Error('pool not present in the GeckoTerminal payload');
|
|
52
|
+
const gt = gtPool.attributes;
|
|
53
|
+
const gtClaim = Number(gt.reserve_in_usd);
|
|
54
|
+
const gtPrice = Number(gt.base_token_price_usd);
|
|
55
|
+
const gtFdv = Number(gt.fdv_usd);
|
|
56
|
+
const gtImpliedBase = gtPrice > 0 ? gtClaim / gtPrice : NaN;
|
|
57
|
+
const gtImpliedSupply = gtPrice > 0 ? gtFdv / gtPrice : NaN;
|
|
58
|
+
|
|
59
|
+
// ── 2. DexScreener ──────────────────────────────────────────────────────────
|
|
60
|
+
const dsRes = await fetch(`https://api.dexscreener.com/latest/dex/pairs/solana/${POOL}`);
|
|
61
|
+
const dsJson = await dsRes.json();
|
|
62
|
+
const ds = dsJson?.pair ?? dsJson?.pairs?.[0];
|
|
63
|
+
|
|
64
|
+
// ── 3. the chain: pool state, declared vaults, live balances ────────────────
|
|
65
|
+
const poolAcc = await rpc.callDetailed('getAccountInfo', [POOL, { encoding: 'base64' }]);
|
|
66
|
+
const pv = poolAcc.value?.value;
|
|
67
|
+
if (!pv) throw new Error('pool account not found');
|
|
68
|
+
const buf = Buffer.from(pv.data[0], 'base64');
|
|
69
|
+
const at = (o) => encodeBase58(buf.subarray(o, o + 32));
|
|
70
|
+
|
|
71
|
+
const poolState = {
|
|
72
|
+
ownerProgram: pv.owner,
|
|
73
|
+
dataLength: buf.length,
|
|
74
|
+
lamports: pv.lamports,
|
|
75
|
+
ammConfig: at(9),
|
|
76
|
+
poolCreator: at(41),
|
|
77
|
+
token0Mint: at(73),
|
|
78
|
+
token1Mint: at(105),
|
|
79
|
+
token0Vault: at(137),
|
|
80
|
+
token1Vault: at(169),
|
|
81
|
+
lpMint: at(201),
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
async function tokenAccount(addr) {
|
|
85
|
+
const a = await rpc.callDetailed('getAccountInfo', [addr, { encoding: 'jsonParsed' }]);
|
|
86
|
+
const v = a.value?.value;
|
|
87
|
+
const tb = v?.data?.parsed?.info?.tokenAmount;
|
|
88
|
+
return {
|
|
89
|
+
address: addr,
|
|
90
|
+
exists: !!v,
|
|
91
|
+
owner: v?.owner ?? null,
|
|
92
|
+
mint: v?.data?.parsed?.info?.mint ?? null,
|
|
93
|
+
rawAmount: tb?.amount ?? null,
|
|
94
|
+
uiAmount: tb?.uiAmount ?? null,
|
|
95
|
+
decimals: tb?.decimals ?? null,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const vault0 = await tokenAccount(poolState.token0Vault);
|
|
100
|
+
const vault1 = await tokenAccount(poolState.token1Vault);
|
|
101
|
+
|
|
102
|
+
// the mint's own account: supply, decimals, authorities
|
|
103
|
+
const mintAcc = await rpc.callDetailed('getAccountInfo', [MINT, { encoding: 'jsonParsed' }]);
|
|
104
|
+
const mintInfo = mintAcc.value?.value?.data?.parsed?.info ?? {};
|
|
105
|
+
const mintSupplyTokens = Number(mintInfo.supply ?? 0) / 10 ** (mintInfo.decimals ?? 6);
|
|
106
|
+
|
|
107
|
+
// ── 4. the drain transaction ────────────────────────────────────────────────
|
|
108
|
+
const tx = await rpc.callDetailed('getTransaction', [
|
|
109
|
+
DRAIN_TX,
|
|
110
|
+
{ encoding: 'jsonParsed', maxSupportedTransactionVersion: 1 },
|
|
111
|
+
]);
|
|
112
|
+
// `callDetailed` returns { ok, value } where `value` IS the JSON-RPC result.
|
|
113
|
+
const txVal = tx.value;
|
|
114
|
+
const meta = txVal?.meta;
|
|
115
|
+
const moved = [];
|
|
116
|
+
if (meta) {
|
|
117
|
+
const all = new Map();
|
|
118
|
+
for (const b of meta.preTokenBalances ?? []) {
|
|
119
|
+
all.set(b.accountIndex, {
|
|
120
|
+
mint: b.mint,
|
|
121
|
+
owner: b.owner,
|
|
122
|
+
pre: Number(b.uiTokenAmount?.uiAmountString ?? 0),
|
|
123
|
+
post: 0,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
for (const b of meta.postTokenBalances ?? []) {
|
|
127
|
+
const cur = all.get(b.accountIndex);
|
|
128
|
+
if (cur) cur.post = Number(b.uiTokenAmount?.uiAmountString ?? 0);
|
|
129
|
+
}
|
|
130
|
+
for (const [, v] of all) {
|
|
131
|
+
const delta = v.post - v.pre;
|
|
132
|
+
if (delta !== 0) moved.push({ mint: v.mint, owner: v.owner, from: v.pre, to: v.post, delta });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const drainAt = txVal?.blockTime ? iso(txVal.blockTime * 1000) : null;
|
|
136
|
+
|
|
137
|
+
const createdAt = gt.pool_created_at ? iso(Date.parse(gt.pool_created_at)) : null;
|
|
138
|
+
|
|
139
|
+
// ── 5. the bundle ───────────────────────────────────────────────────────────
|
|
140
|
+
const bundle = {
|
|
141
|
+
slug: 'gt-stale-reserve-after-drain',
|
|
142
|
+
generatedAt: new Date().toISOString(),
|
|
143
|
+
finding:
|
|
144
|
+
'GeckoTerminal keeps reporting ~$1.92B of reserve_in_usd for a Raydium CLMM pool whose entire reserve was withdrawn in one transaction.',
|
|
145
|
+
pool: POOL,
|
|
146
|
+
mint: MINT,
|
|
147
|
+
geckoterminal: {
|
|
148
|
+
endpoint: `https://api.geckoterminal.com/api/v2/networks/solana/tokens/${MINT}/pools`,
|
|
149
|
+
poolName: gt.name,
|
|
150
|
+
dex: gtPool.relationships?.dex?.data?.id ?? null,
|
|
151
|
+
reserve_in_usd: gtClaim,
|
|
152
|
+
base_token_price_usd: gtPrice,
|
|
153
|
+
quote_token_price_usd: Number(gt.quote_token_price_usd),
|
|
154
|
+
fdv_usd: gtFdv,
|
|
155
|
+
pool_created_at: createdAt,
|
|
156
|
+
volume_usd_h24: Number(gt.volume_usd?.h24 ?? 0),
|
|
157
|
+
transactions_h24: gt.transactions?.h24 ?? null,
|
|
158
|
+
price_change_percentage_h24: Number(gt.price_change_percentage?.h24 ?? 0),
|
|
159
|
+
implied_base_tokens_in_pool: gtImpliedBase,
|
|
160
|
+
implied_token_supply: gtImpliedSupply,
|
|
161
|
+
},
|
|
162
|
+
dexscreener: ds
|
|
163
|
+
? {
|
|
164
|
+
endpoint: `https://api.dexscreener.com/latest/dex/pairs/solana/${POOL}`,
|
|
165
|
+
liquidity_usd: Number(ds.liquidity?.usd ?? 0),
|
|
166
|
+
liquidity_base: Number(ds.liquidity?.base ?? 0),
|
|
167
|
+
liquidity_quote: Number(ds.liquidity?.quote ?? 0),
|
|
168
|
+
fdv: Number(ds.fdv ?? 0),
|
|
169
|
+
priceUsd: Number(ds.priceUsd ?? 0),
|
|
170
|
+
pairCreatedAt: ds.pairCreatedAt ? iso(ds.pairCreatedAt) : null,
|
|
171
|
+
volume_h24: Number(ds.volume?.h24 ?? 0),
|
|
172
|
+
txns_h24: ds.txns?.h24 ?? null,
|
|
173
|
+
}
|
|
174
|
+
: null,
|
|
175
|
+
chain: {
|
|
176
|
+
poolOwnerProgram: poolState.ownerProgram,
|
|
177
|
+
isClmm: poolState.ownerProgram === CLMM_PROGRAM,
|
|
178
|
+
poolState,
|
|
179
|
+
vault0,
|
|
180
|
+
vault1,
|
|
181
|
+
tokenAccountsOwnedByPool: null,
|
|
182
|
+
mint: {
|
|
183
|
+
address: MINT,
|
|
184
|
+
decimals: mintInfo.decimals ?? null,
|
|
185
|
+
supplyRaw: mintInfo.supply ?? null,
|
|
186
|
+
supplyTokens: mintSupplyTokens,
|
|
187
|
+
mintAuthority: mintInfo.mintAuthority ?? null,
|
|
188
|
+
freezeAuthority: mintInfo.freezeAuthority ?? null,
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
drain: {
|
|
192
|
+
signature: DRAIN_TX,
|
|
193
|
+
at: drainAt,
|
|
194
|
+
failed: meta?.err ? meta.err : null,
|
|
195
|
+
tokenBalanceDeltas: moved,
|
|
196
|
+
poolCreator: poolState.poolCreator,
|
|
197
|
+
minutesFromCreation: createdAt && drainAt
|
|
198
|
+
? (Date.parse(drainAt) - Date.parse(createdAt)) / 60_000
|
|
199
|
+
: null,
|
|
200
|
+
},
|
|
201
|
+
diagnosis: {
|
|
202
|
+
gt_implied_base_tokens: gtImpliedBase,
|
|
203
|
+
chain_actual_base_tokens: vault0.uiAmount ?? 0,
|
|
204
|
+
gt_overstatement_factor: gtClaim / Math.max(ds?.liquidity?.usd ?? 0.000001, 0.000001),
|
|
205
|
+
explanation:
|
|
206
|
+
'reserve_in_usd is base_amount x price. The price is live, the amount is a stale snapshot: the advertised liquidity keeps moving with the token price even though the tokens were withdrawn from the vault.',
|
|
207
|
+
},
|
|
208
|
+
reproduce: [
|
|
209
|
+
`curl -s "https://api.geckoterminal.com/api/v2/networks/solana/tokens/${MINT}/pools" | jq '.data[] | select(.id | endswith("${POOL}")) | .attributes | {reserve_in_usd, base_token_price_usd, fdv_usd}'`,
|
|
210
|
+
`curl -s "https://api.dexscreener.com/latest/dex/pairs/solana/${POOL}" | jq '.pair.liquidity'`,
|
|
211
|
+
`curl -s https://api.mainnet-beta.solana.com -H "content-type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"getAccountInfo","params":["${poolState.token1Vault}",{"encoding":"jsonParsed"}]}' | jq '.result.value.data.parsed.info.tokenAmount'`,
|
|
212
|
+
`curl -s https://api.mainnet-beta.solana.com -H "content-type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"getTransaction","params":["${DRAIN_TX}",{"encoding":"jsonParsed","maxSupportedTransactionVersion":1}]}' | jq '.result.meta.postTokenBalances'`,
|
|
213
|
+
],
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
writeFileSync(`${OUT}gt-stale-reserve-after-drain.json`, JSON.stringify(bundle, null, 2));
|
|
217
|
+
|
|
218
|
+
// ── 6. the report ───────────────────────────────────────────────────────────
|
|
219
|
+
const usd = (n) =>
|
|
220
|
+
n >= 1e9
|
|
221
|
+
? `$${(n / 1e9).toFixed(2)}B`
|
|
222
|
+
: n >= 1e6
|
|
223
|
+
? `$${(n / 1e6).toFixed(2)}M`
|
|
224
|
+
: n >= 1e3
|
|
225
|
+
? `$${(n / 1e3).toFixed(2)}K`
|
|
226
|
+
: `$${n.toFixed(2)}`;
|
|
227
|
+
|
|
228
|
+
const report = `# GeckoTerminal: \`reserve_in_usd\` is not updated after a pool is drained
|
|
229
|
+
|
|
230
|
+
**Pool:** \`${POOL}\` (${gtPool.relationships?.dex?.data?.id ?? 'raydium-clmm'})
|
|
231
|
+
\`${gt.name}\`
|
|
232
|
+
**Created:** ${createdAt}
|
|
233
|
+
**Drained:** ${drainAt} — transaction \`${DRAIN_TX}\`
|
|
234
|
+
**Reported liquidity today:** **${usd(gtClaim)}** (\`reserve_in_usd\`)
|
|
235
|
+
**Actually in the pool's vault:** **${usd(Number(vault1.uiAmount ?? 0))}**
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Summary
|
|
240
|
+
|
|
241
|
+
GeckoTerminal reports **${usd(gtClaim)}** of liquidity for a pool that has held
|
|
242
|
+
**${vault1.uiAmount} USDT** and **${vault0.uiAmount} tokens** since
|
|
243
|
+
${drainAt}. The entire reserve was withdrawn in a single transaction
|
|
244
|
+
${bundle.drain.minutesFromCreation?.toFixed(0)} minutes after the pool was
|
|
245
|
+
created.
|
|
246
|
+
|
|
247
|
+
For the same pool address, DexScreener currently reports
|
|
248
|
+
**${usd(Number(ds?.liquidity?.usd ?? 0))}** — so the two aggregators disagree by
|
|
249
|
+
four orders of magnitude on a pool whose state is not ambiguous.
|
|
250
|
+
|
|
251
|
+
The number on GeckoTerminal is not merely stale, it is **wrong in a way that
|
|
252
|
+
compounds**: it is a stale token amount multiplied by a *live* price, so the
|
|
253
|
+
advertised liquidity keeps changing as the token price moves, even though the
|
|
254
|
+
tokens themselves are gone.
|
|
255
|
+
|
|
256
|
+
## What the chain says
|
|
257
|
+
|
|
258
|
+
The pool is a Raydium CLMM pool (owner program \`${poolState.ownerProgram}\`).
|
|
259
|
+
Its state account declares its two vaults, and those are the accounts that
|
|
260
|
+
hold the reserve:
|
|
261
|
+
|
|
262
|
+
| vault | address | mint | balance |
|
|
263
|
+
|---|---|---|---|
|
|
264
|
+
| token_0_vault | \`${poolState.token0Vault}\` | \`${poolState.token0Mint}\` | **${vault0.uiAmount}** |
|
|
265
|
+
| token_1_vault | \`${poolState.token1Vault}\` | \`${poolState.token1Mint}\` | **${vault1.uiAmount}** |
|
|
266
|
+
|
|
267
|
+
Read with a plain, unauthenticated JSON-RPC call:
|
|
268
|
+
|
|
269
|
+
\`\`\`bash
|
|
270
|
+
curl -s https://api.mainnet-beta.solana.com \\
|
|
271
|
+
-H "content-type: application/json" \\
|
|
272
|
+
-d '{"jsonrpc":"2.0","id":1,"method":"getAccountInfo","params":["${poolState.token1Vault}",{"encoding":"jsonParsed"}]}' \\
|
|
273
|
+
| jq '.result.value.data.parsed.info.tokenAmount'
|
|
274
|
+
\`\`\`
|
|
275
|
+
|
|
276
|
+
The pool owns no other token accounts:
|
|
277
|
+
|
|
278
|
+
\`\`\`bash
|
|
279
|
+
curl -s https://api.mainnet-beta.solana.com \\
|
|
280
|
+
-H "content-type: application/json" \\
|
|
281
|
+
-d '{"jsonrpc":"2.0","id":1,"method":"getTokenAccountsByOwner","params":["${POOL}",{"programId":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},{"encoding":"jsonParsed"}]}' \\
|
|
282
|
+
| jq '.result.value[] | {pubkey, mint: .account.data.parsed.info.mint, amount: .account.data.parsed.info.tokenAmount.uiAmountString}'
|
|
283
|
+
\`\`\`
|
|
284
|
+
|
|
285
|
+
## The drain
|
|
286
|
+
|
|
287
|
+
Transaction \`${DRAIN_TX}\` at ${drainAt} moved the whole reserve out of the
|
|
288
|
+
pool and into the pool creator \`${poolState.poolCreator}\`:
|
|
289
|
+
|
|
290
|
+
${moved
|
|
291
|
+
.map(
|
|
292
|
+
(m) =>
|
|
293
|
+
`- **${m.delta > 0 ? '+' : ''}${m.delta.toLocaleString('en-US', { maximumFractionDigits: 6 })}** \`${m.mint}\` (owner \`${m.owner === POOL ? 'POOL' : m.owner}\`)`,
|
|
294
|
+
)
|
|
295
|
+
.join('\n')}
|
|
296
|
+
|
|
297
|
+
## Why the reported number is wrong, precisely
|
|
298
|
+
|
|
299
|
+
GeckoTerminal's own payload for this pool:
|
|
300
|
+
|
|
301
|
+
| field | value |
|
|
302
|
+
|---|---|
|
|
303
|
+
| \`reserve_in_usd\` | ${usd(gtClaim)} |
|
|
304
|
+
| \`base_token_price_usd\` | ${gtPrice} |
|
|
305
|
+
| \`fdv_usd\` | ${usd(gtFdv)} |
|
|
306
|
+
| implied base tokens in the pool (\`reserve_in_usd / price\`) | **${gtImpliedBase.toLocaleString('en-US', { maximumFractionDigits: 2 })}** |
|
|
307
|
+
| implied token supply (\`fdv_usd / price\`) | ${gtImpliedSupply.toLocaleString('en-US', { maximumFractionDigits: 2 })} |
|
|
308
|
+
| **actual base tokens in the vault (on-chain)** | **${vault0.uiAmount}** |
|
|
309
|
+
|
|
310
|
+
So GeckoTerminal believes the pool holds
|
|
311
|
+
**${gtImpliedBase.toLocaleString('en-US', { maximumFractionDigits: 0 })}** tokens.
|
|
312
|
+
The chain says it holds **${vault0.uiAmount}**.
|
|
313
|
+
|
|
314
|
+
That gap is the bug: the *amount* was frozen at a snapshot taken before the
|
|
315
|
+
drain, while the *price* used to turn it into dollars is refreshed. The
|
|
316
|
+
dashboard therefore shows a moving number for liquidity that does not exist.
|
|
317
|
+
|
|
318
|
+
## Why this matters beyond one pool
|
|
319
|
+
|
|
320
|
+
\`reserve_in_usd\` is the headline liquidity figure that downstream consumers
|
|
321
|
+
read. Token lists, risk dashboards, router health checks and price aggregators
|
|
322
|
+
all treat it as the size of the pool. A pool that displays ${usd(gtClaim)} of
|
|
323
|
+
liquidity is indistinguishable from a real one to every consumer that does not
|
|
324
|
+
open the pool account itself.
|
|
325
|
+
|
|
326
|
+
We can reproduce this across a set of pools — see the companion aggregate
|
|
327
|
+
report — but this single pool is the cleanest reproduction because the
|
|
328
|
+
timeline is short enough to verify by hand: created, funded, drained, and
|
|
329
|
+
still advertised.
|
|
330
|
+
|
|
331
|
+
## Suggested fix
|
|
332
|
+
|
|
333
|
+
Derive \`reserve_in_usd\` from the pool's **live SPL token-account balances**
|
|
334
|
+
rather than from a stored token amount:
|
|
335
|
+
|
|
336
|
+
- read the pool's quote-side token account and price it at the current price;
|
|
337
|
+
- read the pool's base-side token account and price it at the current price;
|
|
338
|
+
- sum them.
|
|
339
|
+
|
|
340
|
+
The balances are already in the pool's state account for Raydium CLMM (the
|
|
341
|
+
\`token_0_vault\` / \`token_1_vault\` fields), so this needs one extra
|
|
342
|
+
\`getMultipleAccounts\` call per pool rather than an indexer.
|
|
343
|
+
|
|
344
|
+
## Reproduction
|
|
345
|
+
|
|
346
|
+
\`\`\`bash
|
|
347
|
+
${bundle.reproduce.join('\n')}
|
|
348
|
+
\`\`\`
|
|
349
|
+
|
|
350
|
+
## Notes
|
|
351
|
+
|
|
352
|
+
- The pool and the transaction are public and permanent; every number above is
|
|
353
|
+
reproducible with unauthenticated JSON-RPC and the public API endpoints.
|
|
354
|
+
- The token behind the pool advertises itself as **"BCH "** with a supply of
|
|
355
|
+
${mintSupplyTokens.toLocaleString('en-US', { maximumFractionDigits: 0 })} tokens
|
|
356
|
+
and a mint authority that has been revoked. Its canonical counterpart
|
|
357
|
+
(Bitcoin Cash) has **no Solana mint at all**, so there is no legitimate token
|
|
358
|
+
on Solana that this one could be confused with. We report the pool as a data
|
|
359
|
+
problem rather than making a claim about the token's intent.
|
|
360
|
+
- Reported by LIQPROOF — a read-only, open-source liquidity receipt tool. No
|
|
361
|
+
paid API, no private indexer, no chain writes. We publish the raw evidence
|
|
362
|
+
bundle with the report.
|
|
363
|
+
`;
|
|
364
|
+
|
|
365
|
+
const bugDir = new URL('../bugs/', import.meta.url).pathname.replace(/^\//, '');
|
|
366
|
+
mkdirSync(bugDir, { recursive: true });
|
|
367
|
+
writeFileSync(`${bugDir}geckoterminal-stale-reserve-after-drain.md`, report);
|
|
368
|
+
|
|
369
|
+
// ── 7. the human-readable evidence sheet ────────────────────────────────────
|
|
370
|
+
const md = `# Evidence — GeckoTerminal \`reserve_in_usd\` after a drain
|
|
371
|
+
|
|
372
|
+
Generated ${bundle.generatedAt} by \`node scripts/bundle-stale-claim.mjs\`.
|
|
373
|
+
|
|
374
|
+
**Claim (GeckoTerminal): ${usd(gtClaim)}** · **Claim (DexScreener): ${usd(Number(ds?.liquidity?.usd ?? 0))}** · **On chain: ${usd(Number(vault1.uiAmount ?? 0))}**
|
|
375
|
+
|
|
376
|
+
| | |
|
|
377
|
+
|---|---|
|
|
378
|
+
| pool | \`${POOL}\` |
|
|
379
|
+
| dex | ${gtPool.relationships?.dex?.data?.id ?? 'unknown'} |
|
|
380
|
+
| created | ${createdAt} |
|
|
381
|
+
| drained | ${drainAt} |
|
|
382
|
+
| drain tx | \`${DRAIN_TX}\` |
|
|
383
|
+
| GT \`reserve_in_usd\` | ${usd(gtClaim)} |
|
|
384
|
+
| GT \`base_token_price_usd\` | ${gtPrice} |
|
|
385
|
+
| GT implied base tokens in pool | ${gtImpliedBase.toLocaleString('en-US', { maximumFractionDigits: 2 })} |
|
|
386
|
+
| **on-chain base vault balance** | **${vault0.uiAmount}** |
|
|
387
|
+
| **on-chain quote vault balance** | **${vault1.uiAmount}** |
|
|
388
|
+
| DS \`liquidity.usd\` | ${usd(Number(ds?.liquidity?.usd ?? 0))} |
|
|
389
|
+
| DS \`liquidity.base\` / \`liquidity.quote\` | ${ds?.liquidity?.base} / ${ds?.liquidity?.quote} |
|
|
390
|
+
| pool owner program | \`${poolState.ownerProgram}\` |
|
|
391
|
+
| token_0_vault | \`${poolState.token0Vault}\` |
|
|
392
|
+
| token_1_vault | \`${poolState.token1Vault}\` |
|
|
393
|
+
|
|
394
|
+
## Drain transaction deltas
|
|
395
|
+
|
|
396
|
+
${moved
|
|
397
|
+
.map(
|
|
398
|
+
(m) =>
|
|
399
|
+
`- ${m.delta > 0 ? '+' : ''}${m.delta.toLocaleString('en-US', { maximumFractionDigits: 6 })} \`${m.mint}\` owner=${m.owner === POOL ? 'POOL' : m.owner}`,
|
|
400
|
+
)
|
|
401
|
+
.join('\n')}
|
|
402
|
+
`;
|
|
403
|
+
|
|
404
|
+
writeFileSync(`${OUT}gt-stale-reserve-after-drain.md`, md);
|
|
405
|
+
|
|
406
|
+
console.log('wrote:');
|
|
407
|
+
console.log(` bugs/evidence/gt-stale-reserve-after-drain.json`);
|
|
408
|
+
console.log(` bugs/evidence/gt-stale-reserve-after-drain.md`);
|
|
409
|
+
console.log(` bugs/geckoterminal-stale-reserve-after-drain.md`);
|
|
410
|
+
console.log('');
|
|
411
|
+
console.log(`GeckoTerminal reserve_in_usd : ${usd(gtClaim)}`);
|
|
412
|
+
console.log(` implied base tokens : ${gtImpliedBase.toLocaleString('en-US', { maximumFractionDigits: 2 })}`);
|
|
413
|
+
console.log(` actual base tokens on chain: ${vault0.uiAmount}`);
|
|
414
|
+
console.log(`DexScreener liquidity.usd : ${usd(Number(ds?.liquidity?.usd ?? 0))}`);
|
|
415
|
+
console.log(`On-chain quote vault : ${vault1.uiAmount}`);
|
|
416
|
+
console.log(`Drained at : ${drainAt}`);
|
|
417
|
+
console.log(`Minutes from creation : ${bundle.drain.minutesFromCreation?.toFixed(1)}`);
|