@pawtom/mcp 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.
@@ -0,0 +1,199 @@
1
+ # Out-of-sample test of Pawtom v7: criteria fixed before the data
2
+
3
+ Written on 2026-11-26, before any of the out-of-sample swaps below were fetched or looked at. v7's design and every
4
+ parameter were chosen on one span only: Unichain ETH/USDC, Nov 15–18 2026 (the **dev** span). This file fixes, in
5
+ advance, what the frozen v7 must show on data it has never seen, so the result cannot be tuned after the fact.
6
+
7
+ ## Data
8
+
9
+ | Dataset | Pool | Span | Role |
10
+ |---|---|---|---|
11
+ | `unichain-ethusdc-nov15` | ETH/USDC 5 bps, Unichain | Nov 15–18 | dev (design and parameters chosen here) |
12
+ | `unichain-ethusdc-nov01` | same | Nov 1–7 | out of sample, before |
13
+ | `unichain-ethusdc-nov08` | same | Nov 8–14 | out of sample, before |
14
+ | `unichain-ethusdc-nov19` | same | Nov 19–25 | out of sample, after |
15
+ | `unichain-solusdc-nov19` | SOL/USDC 3 bps, Unichain | Nov 19–25 | second asset and fee tier |
16
+ | `unichain-wbtcusdt0-nov19` | WBTC/USDT0 5 bps, Unichain | Nov 19–25 | third asset, other stablecoin |
17
+
18
+ Pools and datasets are defined in [`flow_data.py`](flow_data.py).
19
+
20
+ ## What is frozen
21
+
22
+ - The mechanism: `PawtomV7` in [`pawtom_model.py`](pawtom_model.py), exactly as deployed.
23
+ - The parameters: `V7_DEFAULTS` (cap 2 bps, k_w 1.1, k_z 0.111, gap 60 s, α, priority floor 0.1 gwei, k_p 300,000,
24
+ priority cap 0.1%). The dead zone's fee is 0.9 × the pool's LP fee (Pawtom's convention of undercutting the pool it
25
+ replaces; 4.5 bps on the 5 bps ETH/USDC pool, as on the dev span).
26
+ - σ0 is 7 bps/minute for ETH/USDC, as on dev. For SOL and WBTC, σ0 is set by a fixed rule from the **seven days of
27
+ Binance prices before** each span (1.4826 × the median absolute one-minute log return), never from the span itself.
28
+ - The judge: [`flow_eval.py`](flow_eval.py)'s labels (markout against Binance's one-second close, shifted by the
29
+ trailing one-hour median basis), metrics and horizons, unchanged from dev.
30
+ - Pools without an ETH side get no priority charge, as in the hook (`ethCurrency = 2`).
31
+
32
+ ## Pass criteria
33
+
34
+ On each out-of-sample ETH/USDC week:
35
+
36
+ 1. **Right side.** Charge per dollar on informed (toxic) flow exceeds the charge on uninformed (benign) flow, at
37
+ 0 s, 10 s and 60 s markouts: ratio > 1.
38
+ 2. **Significant.** Pooling the three out-of-sample weeks, the 90% hour-block bootstrap interval of the 10 s ratio
39
+ lies above 1.
40
+ 3. **Retail spared.** Swaps under $1,000 pay at most 1.5 bps on average.
41
+ 4. **Prices stay fresh.** The charge prices out at most 15% of informed volume at 10 s.
42
+ 5. **Worth having.** It recovers at least 8% of informed profit at 10 s.
43
+
44
+ On SOL/USDC and WBTC/USDT0 (momentum only): criteria 1 at 10 s, 3 and 4.
45
+
46
+ ## Reporting
47
+
48
+ Every number is reported whether it passes or not, with its interval. If a criterion fails, the README says so. A
49
+ failure is fixed only by a change justified on the dev span or on mechanism grounds, then re-tested on a span neither
50
+ change has seen.
51
+
52
+ ## Amendment 1 (2026-11-26, before fetching the pools it adds)
53
+
54
+ **What happened.** The SOL/USDC and WBTC/USDT0 weeks were fetched and judged as above. Both turned out not to be
55
+ markets: over the week, SOL/USDC traded $79k and WBTC/USDT0 $51k, every swap was under $100, and one address sent 88%
56
+ and 83% of their swaps. Frozen v7 passed on SOL/USDC (10 s ratio 1.23, 90% interval [1.20, 1.26]) and failed on
57
+ WBTC/USDT0 (1.01, [0.96, 1.05]). Neither result says anything about arbitrage against retail flow, and both are
58
+ reported as uninformative, not as evidence. This rule should have been written first:
59
+
60
+ **Eligibility.** A pool tests the mechanism only if it trades at least **$1M a week** in the span. A day's scan of
61
+ every active Unichain v4 pool (Nov 25–26) finds three besides ETH/USDC: HYPE/USDC 5 bps ($1.6M a day), ETH/WBTC
62
+ 5 bps ($1.1M a day) and ETH/USDT0 5 bps ($0.2M a day). They are added, for Nov 19–25, before any of their swaps are
63
+ fetched:
64
+
65
+ | Dataset | Pool | Reference (fair value) | Priority charge |
66
+ |---|---|---|---|
67
+ | `unichain-usdchype-nov19` | HYPE/USDC 5 bps | Binance HYPEUSDC | off (no ETH side) |
68
+ | `unichain-ethwbtc-nov19` | ETH/WBTC 5 bps | Binance ETHBTC; WBTC valued at BTCUSDT | on (ETH side) |
69
+ | `unichain-ethusdt0-nov19` | ETH/USDT0 5 bps | Binance ETHUSDT | on (ETH side) |
70
+
71
+ σ0 for each comes from the fixed rule on the seven days before the span. The criteria are the ones above: for the
72
+ two pools with an ETH side, criteria 1, 3, 4 and 5 on their week; for HYPE/USDC, criteria 1 (at 10 s), 3 and 4. If a
73
+ pool falls below $1M in the span itself, it is reported and marked ineligible.
74
+
75
+ ## Amendment 2 (2026-11-26, before running it): walk-forward
76
+
77
+ [`walk_forward.py`](walk_forward.py) tunes v7 on each ETH/USDC span and tests the chosen set on the next one
78
+ (Nov 1–7 → Nov 8–14 → Nov 15–18 → Nov 19–25), next to the frozen defaults. The grid and the selection rule are fixed
79
+ in the script: among sets with ratio ≥ 1 at 0, 10 and 60 s, small swaps ≤ 1.5 bps and ≤ 15% priced out at 10 s, take
80
+ the one that recovers the most at 10 s. **Reading:** if the tuned sets beat the defaults on the following week by more
81
+ than 2 points of recovery while still passing, per-pool tuning belongs in the product; otherwise the defaults stay.
82
+
83
+ ## Amendment 3 (2026-11-26, before judging any out-of-sample ETH week): the v8 candidate
84
+
85
+ On the dev span only, a priority charge set as a **rate of the output per gwei of tip above the floor** beat the
86
+ deployed ETH-priced charge on every metric (10 s ratio 1.43 vs 1.25, recovered 16.0% vs 13.2%, priced out 12.7% vs
87
+ 11.9%, small swaps 1.17 vs 1.16 bps), and it needs no ETH side, so it works on every pool. It applies to every swap
88
+ (no once-per-transaction flag, which a rate would turn into a loophole: a dust swap first, then the real one).
89
+
90
+ **v8 candidate, frozen now:** v7's momentum charge unchanged; priority rate = min(0.1%, 10 bps × (tip − 0.1 gwei) /
91
+ 1 gwei) of the output, on every swap. It is judged with the same criteria, next to frozen v7, on: the three
92
+ out-of-sample ETH/USDC weeks, ETH/WBTC and ETH/USDT0 (Nov 19–25), and HYPE/USDC (Nov 19–25, whose transaction
93
+ metadata is fetched for this). It replaces v7 in the hook only if it passes every criterion v7 passes and beats v7's
94
+ pooled 10 s recovery on the out-of-sample ETH/USDC weeks.
95
+
96
+ ## Results (2026-11-26)
97
+
98
+ Every number below is from [`flow_eval.py`](flow_eval.py) (per dataset, 500 hour-block bootstrap draws) and
99
+ [`pooled.py`](pooled.py). Ratio = charge per dollar on informed flow ÷ on uninformed flow; ✓ = criterion met.
100
+
101
+ ### Frozen v7
102
+
103
+ | Dataset | Volume | Ratio 0 / 10 / 60 s (10 s 90% interval) | Recovered @10 s | Priced out @10 s | Under $1k | Verdict |
104
+ |---|---:|---|---:|---:|---:|---|
105
+ | ETH/USDC Nov 1–7 | $7.2M | 1.29 / 1.21 / 1.14 [1.11, 1.34] ✓ | 11.4% ✓ | 7.9% ✓ | 0.76 bps ✓ | **pass** |
106
+ | ETH/USDC Nov 8–14 | $8.1M | 1.40 / 1.33 / 1.24 [1.25, 1.41] ✓ | 11.6% ✓ | 9.5% ✓ | 1.19 bps ✓ | **pass** |
107
+ | ETH/USDC Nov 19–25 | $12.7M | 1.27 / 1.19 / 1.18 [1.12, 1.28] ✓ | 9.6% ✓ | 8.2% ✓ | 0.96 bps ✓ | **pass** |
108
+ | *Pooled, criterion 2* | $28.0M | 1.32 / **1.24 [1.19, 1.29]** / 1.19 ✓ | 10.6% | 8.5% | 0.97 bps | **pass** |
109
+ | ETH/USDT0 Nov 19–25 | $1.7M | 1.09 / 1.10 / 1.09 [1.01, 1.18] ✓ | 8.7% ✓ | 7.4% ✓ | 1.11 bps ✓ | **pass** |
110
+ | ETH/WBTC Nov 19–25 | $9.7M | 1.17 / 1.03 / **0.94** ✗ [0.84, 1.25] | 9.1% ✓ | 6.5% ✓ | 0.42 bps ✓ | **fail** (criterion 1 at 60 s) |
111
+ | HYPE/USDC Nov 19–25 (momentum only) | $8.8M | 1.09 / 1.10 / 1.03 [1.00, 1.21] ✓ at 10 s | 2.8% | 4.0% ✓ | 0.65 bps ✓ | **pass**, weakly |
112
+ | SOL/USDC Nov 19–25 | $0.08M | 1.34 / 1.23 / 1.11 [1.20, 1.26] | 8.6% | 8.5% | 0.85 bps | ineligible (one bot's dust flow) |
113
+ | WBTC/USDT0 Nov 19–25 | $0.05M | 1.12 / 1.01 / 1.03 [0.96, 1.05] | 8.0% | 8.1% | 1.10 bps | ineligible (one bot's dust flow) |
114
+
115
+ On ETH/WBTC, swaps tipping above 0.5 gwei are uninformed (markout −2 to −4 bps), the opposite of ETH/USDC: on a
116
+ cross pair, high-tip transactions are often legs of multi-pool arbitrage whose leg in this pool is the one that pays.
117
+ The priority signal is pool-dependent, so a pool's priority rate is a per-pool decision (`priorityRate`, 0 = off).
118
+
119
+ ### The v8 candidate (amendment 3)
120
+
121
+ | Dataset | Ratio 0 / 10 / 60 s | Recovered @10 s | Priced out @10 s | Under $1k |
122
+ |---|---|---:|---:|---:|
123
+ | ETH/USDC Nov 1–7 | 1.39 / 1.31 / 1.20 | 12.8% | 8.6% | 0.75 bps |
124
+ | ETH/USDC Nov 8–14 | 1.57 / 1.45 / 1.35 | 13.3% | 10.0% | 1.19 bps |
125
+ | ETH/USDC Nov 19–25 | 1.58 / 1.52 / 1.47 | 13.6% | 9.1% | 0.96 bps |
126
+ | *Pooled* | 1.54 / **1.45 [1.36, 1.56]** / 1.37 | **13.3%** [12.6, 14.3] | 9.2% | 0.97 bps |
127
+ | ETH/USDT0 | 1.13 / 1.15 / 1.16 | 9.7% | 7.3% | 1.09 bps |
128
+ | ETH/WBTC | 1.03 / **0.93** / 0.84 | 11.8% | 8.7% | 0.43 bps |
129
+ | HYPE/USDC | 1.65 / 1.61 / 1.49 | 4.4% | 4.1% | 0.81 bps |
130
+
131
+ **Decision (rule of amendment 3): v8 replaces v7.** v8 passes every criterion v7 passes on every eligible pool (on
132
+ ETH/WBTC both fail criterion 1 and both pass 3, 4 and 5) and beats v7's pooled 10 s recovery, 13.3% to 10.6%. Its
133
+ weak point is the same as v7's, ETH/WBTC, where it is worse (10 s ratio 0.93 against 1.03).
134
+
135
+ ### Walk-forward (amendment 2)
136
+
137
+ | Train → test | Tuned on train, on test: ratio @10 s, recovered, small | Frozen v7 on test | Tuned passes |
138
+ |---|---|---|---|
139
+ | Nov 1–7 → Nov 8–14 | 1.44, 16.1%, 1.70 bps | 1.33, 11.6%, 1.19 bps | no (small swaps) |
140
+ | Nov 8–14 → Nov 15–18 | 1.37, 15.9%, 1.35 bps | 1.25, 13.2%, 1.16 bps | yes |
141
+ | Nov 15–18 → Nov 19–25 | 1.37, 13.3%, 1.19 bps | 1.19, 9.6%, 0.96 bps | yes |
142
+
143
+ **Reading (rule of amendment 2):** in two of three steps the tuned set beats the defaults by more than 2 points of
144
+ recovery while passing, so per-pool calibration belongs in the product. In every step the tuning chose the
145
+ strongest priority charge in the grid, which is what v8 adopts; the momentum parameters it chose did not settle
146
+ (dead zone 0 or 0.5 bps, cap 2 or 3 bps, width 1.1 or 1.6 σ), so v8 keeps the momentum defaults.
147
+
148
+ ## Amendment 4 (2026-11-26, before fetching any of its swaps): Uniswap's VolatilePair on its own flow
149
+
150
+ Uniswap Labs' VolatilePair hook (Uniswap hooklist: `VolatilePairHook`, `0x000022Ec4eBD6b12294396E852E4C3876b253Cc0`)
151
+ runs the Ethereum mainnet ETH/USDC v4 pool `0x98316e84…3eea` (native ETH/USDC, dynamic fee, tick spacing 4). It sets a
152
+ directional LP fee from recent price moves; its formula is not published, but every swap's `Swap` event carries the
153
+ fee it actually paid. Dataset `ethereum-volatilepair-nov19`, Nov 19–25, the same week as Pawtom's last unseen week.
154
+
155
+ **What is compared, on the same swaps and the same judge:**
156
+
157
+ 1. **VolatilePair as deployed**: each swap's actual LP fee, as its charge rate.
158
+ 2. **Its directional part**: the fee minus the lowest fee it charged that week (its floor), which a flat pool would not
159
+ charge.
160
+ 3. **Pawtom v8 on the same flow**: v8's charges (momentum + priority rate, frozen defaults, σ0 from the rule on the
161
+ week before), on top of a flat fee equal to VolatilePair's floor.
162
+
163
+ Reported for each: informed ÷ uninformed at 0, 10 and 60 s with 90% hour-block intervals, AUC, recovered, priced out,
164
+ and the charge on swaps under $1k. **Reading:** the directional parts (2 and 3's charges) are compared at 10 s; one
165
+ "targets better" only if its ratio's interval lies wholly above the other's ratio, otherwise they are reported as
166
+ comparable.
167
+
168
+ **Caveats, fixed now:** the flow was shaped by VolatilePair's own fees (static re-pricing cannot show how it would
169
+ have changed under Pawtom); Ethereum blocks are 12 s and built through MEV-Boost, so the priority fee does not set
170
+ order the way it does on Unichain, and the priority part is also reported separately; VolatilePair is upgradeable,
171
+ so its behaviour may change after this week.
172
+
173
+ **Amendment 4a (2026-11-26, before fetching any of its swaps).** The only Ethereum RPC this environment can reach
174
+ (`ethereum-rpc.publicnode.com`) serves `eth_getLogs` for about the last 10,000 blocks (~33 hours), so Nov 19–25 cannot
175
+ be fetched. The comparison runs instead on what that window covers of the last full day with reference prices
176
+ (Nov 25, from about 02:40 UTC to its end), dataset `ethereum-volatilepair-nov25`. Everything else in amendment 4 is
177
+ unchanged. A day is a small sample; intervals are reported and the result is labelled as one day. The full week needs
178
+ an archive RPC.
179
+
180
+ ### VolatilePair on its own flow (amendments 4 and 4a)
181
+
182
+ Ethereum ETH/USDC VolatilePair pool, Nov 25 02:49–23:58 UTC (the RPC's log window), 1,657 swaps with markouts. The
183
+ lowest fee VolatilePair charged in the span was 0, so its part above its floor is its whole fee (560 distinct fees,
184
+ 0 to 68 bps; most often 8 bps).
185
+
186
+ | 10 s markout | Ratio (90% interval) | AUC | Recovered | Priced out | Under $1k |
187
+ |---|---:|---:|---:|---:|---:|
188
+ | VolatilePair, actual fee (= above its floor) | **1.31 [1.07, 1.60]** | 0.551 | 29.7% | 44.9% | 5.34 bps |
189
+ | Pawtom v8 on the same swaps | 0.46 [0.33, 0.63] | 0.401 | 9.5% | 8.6% | 1.55 bps |
190
+ | Pawtom momentum only on the same swaps | 1.09 [0.94, 1.27] | 0.510 | 9.2% | 7.3% | 0.81 bps |
191
+
192
+ At 0 s and 60 s: VolatilePair 1.36 and 1.27; Pawtom v8 0.38 and 0.65; momentum only 1.19 and 1.08.
193
+
194
+ **Reading (rule of amendment 4):** VolatilePair's interval lies wholly above Pawtom v8's ratio: on this flow,
195
+ **VolatilePair targets better**. Against Pawtom's momentum charge alone the intervals overlap: **comparable**. The
196
+ priority signal fails here, as the caveat expected: Ethereum blocks are built through MEV-Boost, not ordered by
197
+ priority fee, so a high tip does not mark informed flow. VolatilePair's fee is also far larger (it recovers 30% of
198
+ informed profit but prices out 45% of arbitrage and charges small swaps 5.3 bps, against Pawtom's 9%, 9% and under
199
+ 1.6 bps). One day of flow, already shaped by VolatilePair's own fees: suggestive, not conclusive.
package/package.json CHANGED
@@ -1,6 +1,55 @@
1
1
  {
2
2
  "name": "@pawtom/mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "MCP server for Pawtom: pool state, exact quotes with a charge breakdown, explanations of past swaps, unsigned transactions and the real-flow benchmark, for Claude and other agents.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Prakhar-30/Pawtom-Swap.git",
9
+ "directory": "packages/mcp"
10
+ },
11
+ "homepage": "https://github.com/Prakhar-30/Pawtom-Swap/tree/main/packages/mcp#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/Prakhar-30/Pawtom-Swap/issues"
14
+ },
15
+ "keywords": [
16
+ "mcp",
17
+ "model-context-protocol",
18
+ "claude",
19
+ "uniswap",
20
+ "uniswap-v4",
21
+ "unichain",
22
+ "defi"
23
+ ],
24
+ "type": "module",
25
+ "bin": {
26
+ "pawtom-mcp": "dist/index.js"
27
+ },
28
+ "main": "./dist/index.js",
29
+ "files": [
30
+ "dist",
31
+ "docs",
32
+ "README.md"
33
+ ],
34
+ "engines": {
35
+ "node": ">=20"
36
+ },
37
+ "scripts": {
38
+ "docs": "node scripts/copy-docs.mjs",
39
+ "build": "npm run docs && tsc -p tsconfig.json",
40
+ "test": "vitest run",
41
+ "start": "node dist/index.js",
42
+ "prepublishOnly": "npm run build"
43
+ },
44
+ "dependencies": {
45
+ "@modelcontextprotocol/sdk": "^1.17.0",
46
+ "@pawtom/sdk": "^0.1.0",
47
+ "viem": "^2.58.4",
48
+ "zod": "^3.25.0"
49
+ },
50
+ "devDependencies": {
51
+ "@types/node": "^22.0.0",
52
+ "typescript": "~5.9.3",
53
+ "vitest": "^3.2.4"
54
+ }
55
+ }