solana-risk-engine 0.7.2 → 0.8.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/README.es.md +1 -1
- package/README.md +2 -2
- package/package.json +1 -1
- package/src/index.js +1 -1
- package/src/perfil.js +13 -5
- package/src/risk.js +1 -0
- package/src/tokens.js +2 -1
package/README.es.md
CHANGED
|
@@ -32,7 +32,7 @@ Las alertas se cuentan una a una y «nuevo» (`MKT_NEW`) no cuenta: la edad va p
|
|
|
32
32
|
|
|
33
33
|
## Puntos por apartado (0.7.0)
|
|
34
34
|
|
|
35
|
-
Una meme, una acción tokenizada y un token DeFi no se miden igual. `scoreProfile(res, perfil)` (o `analyzeToken(client, mint, { perfil })`, que añade `res.perfil`) pone el token en uno de siete apartados — `meme`, `rwa`, `defi`, `juegos`, `ia`, `apps`, `otros` — y lo puntúa sobre una base de 50 con las reglas de su apartado: quién está detrás y sus reservas en los activos tokenizados; comisiones, ingresos, auditorías y hackeos en DeFi; actividad real en los juegos; código público en la IA; si el token gana con el negocio (recompras, quemas) en las apps. Es una función pura: lo que no está en la cadena llega en `perfil`, una entrada de un archivo diario (SolFlag lo hace con DefiLlama, Jupiter, GitHub y Streamflow). Sin él, un emisor conocido es `rwa` y lo demás se puntúa con las reglas de meme, que solo usan la cadena.
|
|
35
|
+
Una meme, una acción tokenizada y un token DeFi no se miden igual. `scoreProfile(res, perfil)` (o `analyzeToken(client, mint, { perfil })`, que añade `res.perfil`) pone el token en uno de siete apartados — `meme`, `rwa`, `defi`, `juegos`, `ia`, `apps`, `otros` — y lo puntúa sobre una base de 50 con las reglas de su apartado: quién está detrás y sus reservas en los activos tokenizados; comisiones, ingresos, auditorías y hackeos en DeFi; actividad real en los juegos; código público en la IA; si el token gana con el negocio (recompras, quemas) en las apps. Es una función pura: lo que no está en la cadena llega en `perfil`, una entrada de un archivo diario (SolFlag lo hace con DefiLlama, Jupiter, GitHub y Streamflow). Sin él, un emisor conocido es `rwa` y lo demás se puntúa con las reglas de meme, que solo usan la cadena. Con las reglas de meme una wallet grande resta poco a poco (un punto por cada punto por encima del 15 %, hasta −40), y si una wallet de persona tiene `WALLET_CAP` (40 %) o más, el token sale como mucho NARANJA (`capWallet: true`). En la concentración, `w1a` es la dirección de esa wallet mayor.
|
|
36
36
|
|
|
37
37
|
Devuelve `{ap, pts, tier, cap, floor, trap, checks}`: `pts` llena una barra hasta 110 y `checks` da el color de cada chequeo (`suma`, `resta`, `grave`, `neutro`, `falta` = aún no lo sabemos, nunca cuenta). Reglas fijas: una trampa es rojo; diamante solo para la lista revisada a mano con 90 puntos o más, y la lista es como mínimo verde; lo nacido en una lanzadera se puntúa como meme (como mucho verde) y con menos de 7 días como mucho amarillo. `lvl` y `tier` no cambian.
|
|
38
38
|
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ for (const l of r.lights) // the four traffic lights
|
|
|
25
25
|
| Check | How |
|
|
26
26
|
|---|---|
|
|
27
27
|
| **Creator control** | Mint/freeze authority still active, and whether it sits in a person's wallet or a program (bridge, protocol, staking pool). A key off the ed25519 curve is always a program (PDA), even when the System Program owns its account. Risky Token-2022 extensions: permanent delegate, transfer hook, transfer fee, non-transferable, default-frozen accounts. |
|
|
28
|
-
| **Real concentration** | Largest accounts are traced to their owners. Pools and programs are separated from people, so `w1`/`w10` measure *people*, not AMM vaults. |
|
|
28
|
+
| **Real concentration** | Largest accounts are traced to their owners. Pools and programs are separated from people, so `w1`/`w10` measure *people*, not AMM vaults; `w1a` is the address of that biggest person-wallet. |
|
|
29
29
|
| **Inflated liquidity** | DexScreener values both sides of a pool at the pool's price. A pool with 4B of a token against 2 USDC shows "$4,000M liquidity". The engine recomputes it from the real side (USDC/USDT/SOL). It only flags extreme gaps (real side under 5%), because concentrated-liquidity pools are lopsided by nature. |
|
|
30
30
|
| **Inflated volume** | Volume says nothing about who makes it. For a single token on a market under 90 days, the engine reads the last ~300 trades of its main pool (GeckoTerminal, one request) and flags `MKT_FAKE_VOLUME` when 80% or more of the volume comes from wallets that buy and sell the same amount (amber), red when 25 wallets or fewer make it and the top 3 move 75% or more. Arbitrage bots on veteran tokens are normal and are not checked; a verified issuer is left alone. `noGecko` skips it. |
|
|
31
31
|
| **Unlocked LP** | % of LP locked/burned via RugCheck. It only counts for markets under 90 days old, so veteran tokens don't get false positives, and never while a token is on Pump.fun's bonding curve, where there is no LP to pull. |
|
|
@@ -104,7 +104,7 @@ Red and orange both fail almost always at launch; the difference is the kind of
|
|
|
104
104
|
|
|
105
105
|
### Points by section (0.7.0)
|
|
106
106
|
|
|
107
|
-
A meme, a tokenized stock and a DeFi token are not judged the same way. `scoreProfile(res, perfil)` (or `analyzeToken(client, mint, { perfil })`, which adds `res.perfil`) puts the token in one of seven sections — `meme`, `rwa`, `defi`, `juegos` (games), `ia` (AI), `apps`, `otros` (other) — and scores it on a base of 50 with that section's rules: who is behind it and its reserves for tokenized assets, fees, revenue, audits and hacks for DeFi, real activity for games, public code for AI, whether the token earns from the business (buybacks, burns) for apps. It is a pure function: the data that is not on chain comes in `perfil`, one entry of a daily file (SolFlag builds it from DefiLlama, Jupiter, GitHub and Streamflow). Without it, a known issuer is `rwa` and anything else is scored with the meme rules, which only use the chain.
|
|
107
|
+
A meme, a tokenized stock and a DeFi token are not judged the same way. `scoreProfile(res, perfil)` (or `analyzeToken(client, mint, { perfil })`, which adds `res.perfil`) puts the token in one of seven sections — `meme`, `rwa`, `defi`, `juegos` (games), `ia` (AI), `apps`, `otros` (other) — and scores it on a base of 50 with that section's rules: who is behind it and its reserves for tokenized assets, fees, revenue, audits and hacks for DeFi, real activity for games, public code for AI, whether the token earns from the business (buybacks, burns) for apps. It is a pure function: the data that is not on chain comes in `perfil`, one entry of a daily file (SolFlag builds it from DefiLlama, Jupiter, GitHub and Streamflow). Without it, a known issuer is `rwa` and anything else is scored with the meme rules, which only use the chain. With the meme rules one big wallet subtracts gradually (one point per point above 15 %, up to −40), and if one person-wallet holds `WALLET_CAP` (40 %) or more the token is ORANGE at best (`capWallet: true`).
|
|
108
108
|
|
|
109
109
|
It returns `{ap, pts, tier, cap, floor, trap, checks}`: `pts` fills a bar up to 110, `checks` gives each check its colour (`suma`, `resta`, `grave`, `neutro`, `falta` = not known yet, never counted). Fixed rules: a trap is red; diamond only for the hand-reviewed list with 90 points or more, and the list is green at least; a token born in a launchpad is scored as a meme (green at best) and is yellow at best under 7 days. `lvl` and `tier` stay as they were.
|
|
110
110
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solana-risk-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Explainable risk analysis for Solana tokens and wallets: creator control, real holder concentration, inflated liquidity, impostor tokens, funder clusters and PnL. Zero dependencies, runs in Node and the browser.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
package/src/index.js
CHANGED
|
@@ -54,7 +54,7 @@ export { rugcheckSummary, rugcheckReport, rugcheckGraph, netBalances, creatorLau
|
|
|
54
54
|
export { score, issuerOf, trustedIssuer, issuerKeysChanged, setIssuers, tokenType, buildLights, levelFrom, dataOnly, reasonsFrom, assess, SERIAL_WARN, SERIAL_BAD, HISTORY_MIN, HISTORY_WARN, HISTORY_BAD_MIN, HISTORY_BAD } from "./risk.js";
|
|
55
55
|
export { recentLaunches, chainLaunches } from "./launch.js";
|
|
56
56
|
export { TIERS, NEW_CAP_DAYS, TRAPS, BIG_PROJECTS, tierFrom } from "./tier.js";
|
|
57
|
-
export { PERFILES, BIG_EXTRA, scoreProfile, sectionOf, bornInLaunchpad } from "./perfil.js";
|
|
57
|
+
export { PERFILES, BIG_EXTRA, WALLET_CAP, scoreProfile, sectionOf, bornInLaunchpad } from "./perfil.js";
|
|
58
58
|
export { analyzeToken, analyzeWallet, analyzeAddress, sortResults } from "./wallet.js";
|
|
59
59
|
export { holderBase, markBusy, onlyReceives, PASSIVE_SAMPLE, findFunder, findFunders, clusterByFunder, holderRows, creatorInfo, analyzeHolders,
|
|
60
60
|
perHour, sourceRates, groupList, EXCHANGE_PER_HOUR, RATE_MIN_SIGS, YOUNG_DAYS, HOLD_GROUP_YOUNG, HOLD_GROUP_MATURE } from "./holders.js";
|
package/src/perfil.js
CHANGED
|
@@ -7,11 +7,15 @@
|
|
|
7
7
|
// Sections: meme · rwa (tokenized assets) · defi · juegos (games) · ia (AI) · apps (apps and bots) · otros (other).
|
|
8
8
|
// Fixed rules for all of them: a trap is RED; DIAMOND only for the hand-reviewed list (BIG_PROJECTS, trusted
|
|
9
9
|
// issuers) and then with 90 points or more, and the list is GREEN at least; a token born in a launchpad (Pump.fun…)
|
|
10
|
-
// is scored as a meme (plus code for AI and business for apps/other) and GREEN is its best; under 7 days, YELLOW
|
|
10
|
+
// is scored as a meme (plus code for AI and business for apps/other) and GREEN is its best; under 7 days, YELLOW;
|
|
11
|
+
// in a meme, one person's wallet with 40 % or more of the supply: ORANGE at best (capWallet).
|
|
11
12
|
// What we do not have yet ("falta") never adds or subtracts.
|
|
12
13
|
|
|
13
14
|
import { BIG_PROJECTS, TRAPS, NEW_CAP_DAYS } from "./tier.js";
|
|
14
15
|
|
|
16
|
+
// one person's wallet with this % of the supply or more caps a meme at ORANGE (case $ANSEM, 24/11/2026: 49,2 %)
|
|
17
|
+
export const WALLET_CAP = 40;
|
|
18
|
+
|
|
15
19
|
export const PERFILES = ["meme", "rwa", "defi", "juegos", "ia", "apps", "otros"];
|
|
16
20
|
// Big projects added with the points by section (21/11): Pump.fun — one company (launchpad, PumpSwap, Terminal,
|
|
17
21
|
// mobile app, perps) that buys back its token with part of what it earns
|
|
@@ -56,7 +60,7 @@ export function sectionOf(res, perfil) {
|
|
|
56
60
|
* (% of supply unlocked in 30 days and still locked; null = no Streamflow contracts),
|
|
57
61
|
* desv (price vs the real asset, 0.01 = 1 %), res (reserves: "si" | "parcial"), uso (true: used a lot)
|
|
58
62
|
* @param [o.now] time (ms)
|
|
59
|
-
* @returns {ap, pts, tier, cap, floor, trap, checks:[{k, col, p, d}]} col: suma | resta | grave | neutro | falta
|
|
63
|
+
* @returns {ap, pts, tier, cap, capWallet, floor, trap, checks:[{k, col, p, d}]} col: suma | resta | grave | neutro | falta
|
|
60
64
|
*/
|
|
61
65
|
export function scoreProfile(res, perfil, o) {
|
|
62
66
|
o = o || {};
|
|
@@ -97,8 +101,9 @@ export function scoreProfile(res, perfil, o) {
|
|
|
97
101
|
if (has("CTL_FREEZE_ACTIVE")) add("control", -25);
|
|
98
102
|
else if (has("CTL_TRANSFER_FEE") || has("CTL_TRANSFER_HOOK")) add("control", -10);
|
|
99
103
|
else if (has("CTL_NONE") || has("CTL_ONLY_PROGRAMS")) add("control", 15);
|
|
100
|
-
|
|
101
|
-
if (
|
|
104
|
+
// gradual, no steps: 49 % and 51 % must not score far apart (case $ANSEM, 24/11: 49,2 % only took -15)
|
|
105
|
+
if (w10 != null) add("reparto", w10 < 25 ? 10 : w10 > 40 ? -Math.min(20, Math.max(10, Math.round((w10 - 40) * 2 / 3))) : 0, w10);
|
|
106
|
+
if (w1 != null && w1 > 15) add("wallet", -Math.min(40, Math.max(5, Math.round(w1 - 15))), w1);
|
|
102
107
|
add("liquidez", liq >= 1e5 ? 10 : liq >= 5e4 ? 5 : liq >= 2e4 ? -5 : liq >= 1e4 ? -10 : liq >= 1e3 ? -25 : -40, liq);
|
|
103
108
|
if (liq < 1e3) dead = true;
|
|
104
109
|
if (has("MKT_LP_PARTLY_LOCKED")) add("lp", -10);
|
|
@@ -171,5 +176,8 @@ export function scoreProfile(res, perfil, o) {
|
|
|
171
176
|
}
|
|
172
177
|
if (memeRules && dias != null && dias < NEW_CAP_DAYS && tier === "GREEN") { tier = "YELLOW"; cap = true; }
|
|
173
178
|
}
|
|
174
|
-
|
|
179
|
+
// one person's wallet (pools, programs and exchanges already left out of w1) can sink a meme on its own: ORANGE at best
|
|
180
|
+
let capWallet = false;
|
|
181
|
+
if (!trap && !dead && memeRules && w1 != null && w1 >= WALLET_CAP && (tier === "GREEN" || tier === "YELLOW")) { tier = "ORANGE"; capWallet = true; }
|
|
182
|
+
return { ap: ap, lanz: lanz && memeRules && ap !== "meme", pts: n, tier: tier, cap: cap, capWallet: capWallet, floor: floor, trap: trap, dead: dead, checks: checks };
|
|
175
183
|
}
|
package/src/risk.js
CHANGED
|
@@ -197,6 +197,7 @@ export function buildLights(info, conc, pair, value, type, rc, now, launches) {
|
|
|
197
197
|
if (conc.w1 > 30 || conc.w10 > 70) st = "bad"; else if (conc.w1 > 15 || conc.w10 > 50) st = "warn";
|
|
198
198
|
if (soft && st === "bad") st = "warn";
|
|
199
199
|
const data = { w1: conc.w1, w10: conc.w10, prog: conc.prog, wallets: conc.nW }; // prog >= 20 is worth mentioning
|
|
200
|
+
if (conc.w1a) data.w1a = conc.w1a; // address of the biggest person-wallet (0.8.0)
|
|
200
201
|
if (conc.ex) { data.ex = conc.ex; data.exn = conc.exn; } // named exchanges, shown but not counted
|
|
201
202
|
if (conc.mm) { data.mm = conc.mm; data.mmn = conc.mmn; } // named market makers, shown and counted
|
|
202
203
|
let code = !conc.nW ? (conc.ex ? "CON_EXCHANGES" : "CON_ALL_POOLS") : (st === "ok" ? "CON_OK" : "CON_HIGH");
|
package/src/tokens.js
CHANGED
|
@@ -119,7 +119,7 @@ export async function getConc(client, mint, supply) {
|
|
|
119
119
|
const kind = await accountKinds(client, uniq(owners), true); // emptied wallets (0 SOL) still count
|
|
120
120
|
const agg = {};
|
|
121
121
|
owners.forEach(function (o, i) { agg[o] = (agg[o] || 0) + amts[i]; });
|
|
122
|
-
const ws = [], exs = {}, mms = {};
|
|
122
|
+
const ws = [], wo = [], exs = {}, mms = {};
|
|
123
123
|
let prog = 0, ex = 0, mm = 0;
|
|
124
124
|
Object.keys(agg).forEach(function (o) {
|
|
125
125
|
const k = knownWallet(o);
|
|
@@ -133,6 +133,7 @@ export async function getConc(client, mint, supply) {
|
|
|
133
133
|
ws.sort(function (x, y) { return y - x; });
|
|
134
134
|
out.ok = true; out.nW = ws.length;
|
|
135
135
|
out.w1 = ws.length ? ws[0] / supply * 100 : 0;
|
|
136
|
+
if (wo.length) out.w1a = wo.sort(function (x, y) { return y[1] - x[1]; })[0][0]; // who the biggest person-wallet is (0.8.0)
|
|
136
137
|
out.w10 = ws.slice(0, 10).reduce(function (s, x) { return s + x; }, 0) / supply * 100;
|
|
137
138
|
out.prog = prog / supply * 100;
|
|
138
139
|
if (ex) {
|