{"sources":[{"url":"https://raw.githubusercontent.com/gtmcknight/amm-sim/66604b3426d8e97a73e2c39940b9b4dece51cc73/research/tell/README.md","quote":"# Simple AMM: telling the arbitrageur from retail\n\nWritten 2026-11-10. `../solved` left one thing between this network and first place: whether the first trade of a step is the arbitrageur's or a retail order. The reference guesses and is wrong on 16%. This folder shows the trade's own numbers say w"},{"url":"https://raw.githubusercontent.com/gtmcknight/amm-sim/66604b3426d8e97a73e2c39940b9b4dece51cc73/research/tell/tellref.py","quote":"\"\"\"The arbitrage test in whole numbers only, as a contract has to do it.\n\nA contract's afterSwap is handed four integers a trade (amountX, amountY, reserveX, reserveY, each the\nengine's f64 times 1e18, truncated) and it knows two more things it can keep itself: the reserves its\nprevious callback was"},{"url":"https://raw.githubusercontent.com/gtmcknight/amm-sim/66604b3426d8e97a73e2c39940b9b4dece51cc73/research/tell/tellpol.py","quote":"\"\"\"The solved policy with the arbitrage test in place of its guess, on the replica, blind.\n\n  python3 -I run.py tellpol:TellPolicy 10000 2048 out.json soft=1 qm=qm_k1e-5.json\n  python3 -I pair.py out.json ref/gauss_qm.json        # +3.21: what the test adds to the policy the ports implement\n  python"},{"url":"https://raw.githubusercontent.com/gtmcknight/amm-sim/66604b3426d8e97a73e2c39940b9b4dece51cc73/research/tell/fetch.sh","quote":"#!/bin/sh\n# Fetch ../solved and this folder into ONE directory and check every file's sha256.\n# usage: sh fetch.sh <raw URL of research/ at a commit> [dir]        default dir: test/scratch/amm\n# This folder's README.md lands as TELL.md and its fetch.sh as fetch-tell.sh; ../solved keeps its names.\nse"},{"url":"https://raw.githubusercontent.com/gtmcknight/amm-sim/main/research/setup.sh","quote":"#!/bin/sh\n# Setup block of IMD goals 282fbc03 and amm-filter-1: run once from the amm-challenge checkout root; then `. scratch/env.sh`.\nset -eu;R=$PWD/scratch;mkdir -p $R/tmp $R/bin $R/solcx\necho \"export TMPDIR=$R/tmp XDG_CACHE_HOME=$R/xc UV_CACHE_DIR=$R/uvc UV_PYTHON_INSTALL_DIR=$R/uvpy SOLCX_BINAR"},{"url":"https://api.imd.fun/artifacts/8a6e303b662e1a5ea9bb47f31acedd3988ef65b3ddb66d074517aa59ad41ca40","quote":"# qt1: Taylor's qm tables (qm-spline compression) in trim-2's contract\n\n**Summary.** I replaced trim-2's network with the qm-spline lookup and kept trim-2's filter, 3-slot state and fee conversion. The new contract reproduces the reference's fees: on Gate F (50 runs, 100,000 callbacks) the max |fee "},{"url":"https://api.imd.fun/artifacts/22122152083d7c876b3475c321fd3c85be79de48419965491d117f095e3d1905","quote":"{\"item\": \"bounded-bitmath\", \"status\": \"done\", \"summary\": \"TellMath.isArb(bool,uint256 x8)->bool, exact integer port of tellref.is_arb (amm-sim research@66604b34). Matches expected (last field) on 11856/11856 vectors.json.gz vectors, 0 mismatches, plus 6892 extra edge vectors labelled by tellref itse"},{"url":"https://api.imd.fun/artifacts/b0cb4b28e101ad902ec383c2d4142b6e9a9dd10d229f482b47ca81b273933495","quote":"{\"item\":\"probe-reference\",\"batch\":\"e01-p-engine-probe\",\"summary\":\"Tell test (tellref.is_arb ported to Solidity) proven on the unpatched amm_sim_rs wheel, seeds 14000000..14000007 once each, probe at 30 bps + telemetry vs VanillaStrategy. Arbitrage trades read: 29091 of 29091 (100%), 0 false negative"},{"url":"https://api.imd.fun/artifacts/9093159ef6d83b4f6f8c0368355cec5771548c9e9ab3cb9608885007afa43741","quote":"{\n \"item\": \"lookup-headroom\",\n \"batch\": \"e01-a-spline-gas\",\n \"kind\": \"behavior-preserving C0 lookup optimization (implementation headroom only; no edge claim)\",\n \"base\": {\n  \"c0_url\": \"https://api.imd.fun/artifacts/8a6e303b662e1a5ea9bb47f31acedd3988ef65b3ddb66d074517aa59ad41ca40\",\n  \"c0_source_sha25"},{"url":"https://raw.githubusercontent.com/gtmcknight/amm-sim/66604b3426d8e97a73e2c39940b9b4dece51cc73/research/solved/real.py","quote":"\"\"\"Solved policy driven ONLY by what afterSwap sees (side, amounts, timestamp, reserves).\n\nFilter: Gaussian belief over ln p (mean, variance).\n  - new step: variance grows by sigma^2 a step; steps with no trade of ours truncate the belief to our no-arb interval\n  - first trade of a step: arb or reta"},{"url":"https://raw.githubusercontent.com/gtmcknight/amm-sim/66604b3426d8e97a73e2c39940b9b4dece51cc73/research/solved/replica2.py","quote":"\"\"\"Pure-Python replica of benedictbrady/amm-challenge @6b6921f8 (engine.rs, cfmm.rs,\narbitrageur.rs, router.rs, retail.rs), written from the source for ceiling experiments.\nRNG streams differ from the Rust engine, so absolute scores move by the seed set;\ncompare policies paired on the same seeds.\n\nA"},{"url":"https://raw.githubusercontent.com/gtmcknight/amm-sim/66604b3426d8e97a73e2c39940b9b4dece51cc73/research/solved/evalpol.py","quote":"\"\"\"Run a solved (dp.py) perfect-information policy on the pure-Python replica.\nusage: python3 -I evalpol.py <pol.json>[,<pol2.json>...] hold        seeds 10000..12047, paired vs the stored HA / old oracle table rows\n       python3 -I evalpol.py <pol.json> mid [n]                      midpoint parame"},{"url":"https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/contracts/src/AMMStrategyBase.sol","quote":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport {IAMMStrategy, TradeInfo} from \"./IAMMStrategy.sol\";\n\n/// @title AMM Strategy Base Contract\n/// @notice Base contract that all user strategies must inherit from\n/// @dev Provides fixed storage slots, helper functions, and fee clamping\n"},{"url":"https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/contracts/src/IAMMStrategy.sol","quote":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\n/// @title Trade information passed to AMM strategies\n/// @notice Contains all data about an executed trade that strategies can use to adjust fees\nstruct TradeInfo {\n    bool isBuy;          // true if AMM bought X (trader sold X)\n    uint256"},{"url":"https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_competition/evm/compiler.py","quote":"\"\"\"Solidity compilation service using py-solc-x.\"\"\"\n\nimport solcx\nfrom dataclasses import dataclass\nfrom pathlib import Path\nfrom typing import Optional\n\n\n@dataclass\nclass CompilationResult:\n    \"\"\"Result of Solidity compilation.\"\"\"\n\n    success: bool\n    bytecode: Optional[bytes] = None\n    deploye"}]}