Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

coin-intel model weights in MCP; copier count badge; platform fee doc

nirholasa4f0427940d9
diff --git a/api/pump-fun-mcp.js b/api/pump-fun-mcp.js
index 2585ae8f1..ef0377234 100644
--- a/api/pump-fun-mcp.js
+++ b/api/pump-fun-mcp.js
@@ -838,6 +838,22 @@ async function handleGetCoinIntel({ mint, network = 'mainnet' } = {}) {
}));
} catch { /* wallets absent — fine */ }
+ // Latest model conditional win-rates (so agents see the evidence behind each signal)
+ let model = null;
+ try {
+ const [wrow] = await sql`
+ select weights, conditional_win_rates, sample_size, trained_at
+ from pump_intel_weights
+ where network = ${network}
+ order by trained_at desc limit 1
+ `;
+ if (wrow) model = {
+ sample_size: wrow.sample_size,
+ trained_at: wrow.trained_at,
+ conditional_win_rates: wrow.conditional_win_rates || null,
+ };
+ } catch { /* weights table absent — training hasn't run yet */ }
+
const smartNotable = Array.isArray(row.smart_money_notable) ? row.smart_money_notable : [];
// Build a plain-language summary the agent can read directly
diff --git a/docs/pump-platform-fee.md b/docs/pump-platform-fee.md
new file mode 100644
index 000000000..749afd5f4
--- /dev/null
+++ b/docs/pump-platform-fee.md
@@ -0,0 +1,54 @@
+# Pump.fun platform trade fee
+
+three.ws can charge a platform fee on every pump.fun buy/sell routed through the
+trade modal (`src/game/coin-buy.js` → `/api/pump/buy-prep` · `/api/pump/sell-prep`).
+The fee matches pump.fun's own trade-fee rate and is a **real on-chain transfer
+added to the same transaction the user signs** — native SOL for SOL-paired
+trades, USDC for USDC-paired trades — sent to the platform fee wallet. One
+signature, no custody.
+
+## Status: OFF by default
+
+The fee ships **inert**. It activates only when BOTH are configured:
+
+| Env var | Effect |
+|---|---|
+| `PUMP_PLATFORM_FEE_BPS` | Rate in basis points. **Default `0` (off).** Set `100` for 1% (pump.fun's rate). Hard-capped at 500 (5%). |
+| `PUMP_PLATFORM_FEE_WALLET` | Recipient Solana address. Falls back to the platform treasury keypair (`PLATFORM_TREASURY_KEYPAIR` / `TREASURY_KEYPAIR`) pubkey if unset. |
+
+With either knob missing/zero, `buildPlatformFeeInstructions` returns `null`, no
+fee instruction is added, and the quote/UI report `platform_fee_bps: 0` (no fee
+line shown). This is why local/preview and a fresh deploy charge nothing — and
+why turning it on is a deliberate one-line env change after trading is verified.
+
+## How it's computed
+
+- **Buy:** fee = `bps × quote spent`, charged on top (you pay trade + fee).
+- **Sell:** fee = `bps × expected proceeds`, taken from the proceeds. AMM-sell
+ proceeds are quoted via the pump-swap SDK's `sellBaseInput` (`uiQuote`); if
+ that quote can't be derived the fee is skipped, never the sell.
+
+All four routes are covered: bonding-curve buy/sell and PumpSwap AMM buy/sell,
+for both SOL- and USDC-paired coins (`api/_lib/pump-platform-fee.js`).
+
+## Disclosure (required before enabling)
+
+The fee is **never** charged silently. When `platform_fee_bps > 0`:
+
+1. The trade modal shows a live fee line ("Platform fee 1% · ~0.01 SOL") and the
+ exact amount at the wallet-approval step (`coin-buy.js#_renderFee` / `_feeNote`).
+2. **Before flipping the rate on in production, add a fees clause to the Terms**
+ stating that three.ws charges a trading fee at pump.fun's rate on trades
+ routed through the platform, and add a public changelog entry. Disclosure in
+ the UI is already wired; the Terms + changelog are the remaining steps and
+ must land in the same change that enables the fee.
+
+## Enable checklist
+
+1. Verify SOL + USDC buy/sell end-to-end with the fee at 0.
+2. Set `PUMP_PLATFORM_FEE_WALLET` (or confirm the treasury keypair pubkey is the
+ intended recipient).
+3. Add the Terms fees clause + a changelog entry.
+4. Set `PUMP_PLATFORM_FEE_BPS=100`.
+5. Confirm the modal shows the fee line and a test trade routes the fee to the
+ wallet.
diff --git a/src/trader.css b/src/trader.css
index 527ab4699..0c1d6e799 100644
--- a/src/trader.css
+++ b/src/trader.css
@@ -63,6 +63,7 @@
}
.tp-sub a { color: var(--ink-dim); text-decoration: none; border-bottom: 1px dotted var(--stroke-strong); }
.tp-sub a:hover { color: var(--ink-bright); }
+.tp-copiers { color: var(--success); font-weight: var(--weight-semibold); }
.tp-desc { margin-top: var(--space-sm); color: var(--ink-dim); font-size: var(--text-sm); line-height: var(--leading-normal); max-width: 60ch; }
/* Score gauge */