{
  "delta": 1.190310791328803,
  "code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport {AMMStrategyBase} from \"./AMMStrategyBase.sol\";\nimport {TradeInfo} from \"./IAMMStrategy.sol\";\n\ncontract Strategy is AMMStrategyBase {\n    uint256 constant ELAPSED_CAP = 8;\n    uint256 constant SIGNAL_THRESHOLD = WAD / 650;\n    uint256 constant DIR_DECAY = 750000000000000000;\n    uint256 constant ACT_DECAY = 530000000000000000;\n    uint256 constant SIZE_DECAY = 530000000000000000;\n    uint256 constant TOX_DECAY = 910000000000000000;\n    uint256 constant SIGMA_DECAY = 690000000000000000;\n    uint256 constant LAMBDA_DECAY = 990000000000000000;\n    uint256 constant SIZE_BLEND_DECAY = 828000000000000000;\n    uint256 constant TOX_BLEND_DECAY = 102000000000000000;\n    uint256 constant ACT_BLEND_DECAY = 985000000000000000;\n    uint256 constant PHAT_ALPHA = 270000000000000000;\n    uint256 constant PHAT_ALPHA_RETAIL = 60000000000000000;\n    uint256 constant PHAT_ALPHA_SAME = 120000000000000000;\n    uint256 constant REVERT_U = 0;\n    uint256 constant DIR_IMPACT_MULT = 4;\n    uint256 constant GATE_SIGMA_MULT = 7200000000000000000;\n    uint256 constant MIN_GATE = 30000000000000000;\n    uint256 constant TRADE_TOX_BOOST = 350000000000000000;\n    uint256 constant STALE_ATTRACT_FRAC = 1050000000000000000;\n    uint256 constant RET_CAP = WAD / 35;\n    uint256 constant TOX_CAP = WAD / 5;\n    uint256 constant TRADE_RATIO_CAP = WAD / 5;\n    uint256 constant LAMBDA_CAP = 1820000000000000000;\n    uint256 constant STEP_COUNT_CAP = 64;\n    uint256 constant BASE_FEE = 4 * BPS;\n    uint256 constant SIGMA_COEF = 200000000000000000;\n    uint256 constant LAMBDA_COEF = 12 * BPS;\n    uint256 constant FLOW_SIZE_COEF = 4842 * BPS;\n    uint256 constant TOX_COEF = 60000000000000000;\n    uint256 constant TOX_QUAD_COEF = 4500000000000000000;\n    uint256 constant ACT_COEF = 91843 * BPS;\n    uint256 constant DIR_COEF = 20 * BPS;\n    uint256 constant DIR_TOX_COEF = 100 * BPS;\n    uint256 constant STALE_DIR_COEF = 513750000000000000;\n    uint256 constant SIGMA_TOX_COEF = 500 * BPS;\n    uint256 constant TAIL_KNEE = 600 * BPS;\n    uint256 constant TAIL_SLOPE_PROTECT = 930000000000000000;\n    uint256 constant TAIL_SLOPE_ATTRACT = 850000000000000000;\n\n    function afterInitialize(uint256 initialX, uint256 initialY) external override returns (uint256, uint256) {\n        slots[0] = BASE_FEE; slots[1] = BASE_FEE; slots[2] = 0; slots[3] = WAD; slots[4] = 0;\n        slots[5] = initialX > 0 ? wdiv(initialY, initialX) : 100 * WAD;\n        slots[6] = 950000000000000; slots[7] = 800000000000000000; slots[8] = 2000000000000000;\n        slots[9] = 0; slots[10] = 0; slots[11] = 0; slots[12] = 0;\n        return (BASE_FEE, BASE_FEE);\n    }\n\n    function afterSwap(TradeInfo calldata trade) external override returns (uint256, uint256) {\n        uint256 prevBidFee = slots[0]; uint256 prevAskFee = slots[1]; uint256 lastTs = slots[2];\n        uint256 dirState = slots[3]; uint256 actEma = slots[4]; uint256 pHat = slots[5];\n        uint256 sigmaHat = slots[6]; uint256 lambdaHat = slots[7]; uint256 sizeHat = slots[8];\n        uint256 toxEma = slots[9]; uint256 stepTradeCount = slots[10];\n\n        bool isNewStep = trade.timestamp > lastTs;\n        if (isNewStep) {\n            uint256 elapsedRaw = trade.timestamp - lastTs;\n            uint256 elapsed = elapsedRaw > ELAPSED_CAP ? ELAPSED_CAP : elapsedRaw;\n            dirState = _decayCentered(dirState, DIR_DECAY, elapsed);\n            actEma = wmul(actEma, _powWad(ACT_DECAY, elapsed));\n            sizeHat = wmul(sizeHat, _powWad(SIZE_DECAY, elapsed));\n            toxEma = wmul(toxEma, _powWad(TOX_DECAY, elapsed));\n            if (stepTradeCount > 0 && elapsedRaw > 0) {\n                uint256 lambdaInst = (stepTradeCount * WAD) / elapsedRaw;\n                if (lambdaInst > LAMBDA_CAP) lambdaInst = LAMBDA_CAP;\n                lambdaHat = wmul(lambdaHat, LAMBDA_DECAY) + wmul(lambdaInst, WAD - LAMBDA_DECAY);\n            }\n            stepTradeCount = 0;\n        }\n\n        bool firstInStep = stepTradeCount == 0;\n        uint256 spot = trade.reserveX > 0 ? wdiv(trade.reserveY, trade.reserveX) : pHat;\n        if (pHat == 0) pHat = spot;\n\n        uint256 feeUsed = trade.isBuy ? prevBidFee : prevAskFee;\n        uint256 gamma = feeUsed < WAD ? WAD - feeUsed : 0;\n        uint256 pImplied;\n        if (gamma == 0) { pImplied = spot; }\n        else { pImplied = trade.isBuy ? wmul(spot, gamma) : wdiv(spot, gamma); }\n\n        {\n            uint256 ret = pHat > 0 ? wdiv(absDiff(pImplied, pHat), pHat) : 0;\n            uint256 alpha = firstInStep ? PHAT_ALPHA : PHAT_ALPHA_RETAIL;\n            uint256 prePhat = pHat;\n            bool secondPrint = !firstInStep && stepTradeCount == 1;\n            bool sameDir = false; bool oppDir = false;\n            if (secondPrint) {\n                bool up2 = pImplied >= pHat;\n                uint256 d1 = slots[12];\n                if (d1 != 0) { sameDir = (d1 == 1) == up2; oppDir = !sameDir; }\n                if (sameDir) alpha = PHAT_ALPHA_SAME;\n            }\n            if (firstInStep) { slots[11] = pHat; slots[12] = pImplied >= pHat ? 1 : 2; }\n            uint256 adaptiveGate = wmul(sigmaHat, GATE_SIGMA_MULT);\n            if (adaptiveGate < MIN_GATE) adaptiveGate = MIN_GATE;\n            if (ret <= adaptiveGate) { pHat = wmul(pHat, WAD - alpha) + wmul(pImplied, alpha); }\n            if (oppDir && REVERT_U > 0) {\n                uint256 pre = slots[11];\n                if (pre > pHat) pHat = pHat + wmul(pre - pHat, REVERT_U);\n                else pHat = pHat - wmul(pHat - pre, REVERT_U);\n            }\n            if (firstInStep) {\n                if (ret > RET_CAP) ret = RET_CAP;\n                sigmaHat = wmul(sigmaHat, SIGMA_DECAY) + wmul(ret, WAD - SIGMA_DECAY);\n            }\n        }\n\n        // Interior retail routing equalizes fee-adjusted marginal prices.\n        // Subsequent trades in a step cannot be the initial arbitrage trade.\n        if (!firstInStep && feeUsed > 30 * BPS && gamma > 0) {\n            uint256 normalSpot = trade.isBuy\n                ? wdiv(wmul(spot, gamma), WAD - 30 * BPS)\n                : wdiv(wmul(spot, WAD - 30 * BPS), gamma);\n            pHat = wmul(pHat, 90 * WAD / 100) + wmul(normalSpot, 10 * WAD / 100);\n        }\n\n        assembly { pHat := calldataload(196) }\n        uint256 tradeRatio = trade.reserveY > 0 ? wdiv(trade.amountY, trade.reserveY) : 0;\n        if (tradeRatio > TRADE_RATIO_CAP) tradeRatio = TRADE_RATIO_CAP;\n\n        if (tradeRatio > SIGNAL_THRESHOLD) {\n            uint256 push = tradeRatio * DIR_IMPACT_MULT;\n            if (push > WAD / 4) push = WAD / 4;\n            if (trade.isBuy) {\n                dirState = dirState + push;\n                if (dirState > 2 * WAD) dirState = 2 * WAD;\n            } else {\n                dirState = dirState > push ? dirState - push : 0;\n            }\n            actEma = wmul(actEma, ACT_BLEND_DECAY) + wmul(tradeRatio, WAD - ACT_BLEND_DECAY);\n            sizeHat = wmul(sizeHat, SIZE_BLEND_DECAY) + wmul(tradeRatio, WAD - SIZE_BLEND_DECAY);\n            if (sizeHat > WAD) sizeHat = WAD;\n        }\n\n        uint256 tox = pHat > 0 ? wdiv(absDiff(spot, pHat), pHat) : 0;\n        if (tox > TOX_CAP) tox = TOX_CAP;\n        toxEma = wmul(toxEma, TOX_BLEND_DECAY) + wmul(tox, WAD - TOX_BLEND_DECAY);\n        uint256 toxSignal = toxEma;\n\n        stepTradeCount = stepTradeCount + 1;\n        if (stepTradeCount > STEP_COUNT_CAP) stepTradeCount = STEP_COUNT_CAP;\n\n        uint256 flowSize = wmul(lambdaHat, sizeHat);\n        uint256 fBase = BASE_FEE + wmul(SIGMA_COEF, sigmaHat) + wmul(LAMBDA_COEF, lambdaHat) + wmul(FLOW_SIZE_COEF, flowSize);\n        uint256 fMid = fBase + wmul(TOX_COEF, toxSignal) + wmul(TOX_QUAD_COEF, wmul(toxSignal, toxSignal)) + wmul(ACT_COEF, actEma);\n        fMid = fMid + wmul(SIGMA_TOX_COEF, wmul(sigmaHat, toxSignal));\n\n        uint256 dirDev; bool sellPressure;\n        if (dirState >= WAD) { dirDev = dirState - WAD; sellPressure = true; }\n        else { dirDev = WAD - dirState; sellPressure = false; }\n\n        uint256 skew = wmul(DIR_COEF, dirDev) + wmul(DIR_TOX_COEF, wmul(dirDev, toxSignal));\n        uint256 bidFee; uint256 askFee;\n        if (sellPressure) {\n            bidFee = fMid + skew;\n            askFee = fMid > skew ? fMid - skew : 0;\n        } else {\n            askFee = fMid + skew;\n            bidFee = fMid > skew ? fMid - skew : 0;\n        }\n\n        {\n            uint256 staleShift = wmul(STALE_DIR_COEF, toxSignal);\n            uint256 attractShift = wmul(staleShift, STALE_ATTRACT_FRAC);\n            if (spot >= pHat) {\n                bidFee = bidFee + staleShift;\n                askFee = askFee > attractShift ? askFee - attractShift : 0;\n            } else {\n                askFee = askFee + staleShift;\n                bidFee = bidFee > attractShift ? bidFee - attractShift : 0;\n            }\n        }\n\n        {\n            bool tradeAligned = (trade.isBuy && spot >= pHat) || (!trade.isBuy && spot < pHat);\n            if (tradeAligned) {\n                uint256 tradeBoost = wmul(TRADE_TOX_BOOST, tradeRatio);\n                if (trade.isBuy) { bidFee = bidFee + tradeBoost; }\n                else { askFee = askFee + tradeBoost; }\n            }\n        }\n\n        if (sellPressure) {\n            bidFee = clampFee(_compressTailWithSlope(bidFee, TAIL_SLOPE_PROTECT));\n            askFee = clampFee(_compressTailWithSlope(askFee, TAIL_SLOPE_ATTRACT));\n        } else {\n            askFee = clampFee(_compressTailWithSlope(askFee, TAIL_SLOPE_PROTECT));\n            bidFee = clampFee(_compressTailWithSlope(bidFee, TAIL_SLOPE_ATTRACT));\n        }\n\n        slots[0] = bidFee; slots[1] = askFee; slots[2] = trade.timestamp;\n        slots[3] = dirState; slots[4] = actEma; slots[5] = pHat;\n        slots[6] = sigmaHat; slots[7] = lambdaHat; slots[8] = sizeHat;\n        slots[9] = toxEma; slots[10] = stepTradeCount;\n\n        return (bidFee, askFee);\n    }\n\n    function _compressTailWithSlope(uint256 fee, uint256 slope) internal pure returns (uint256) {\n        if (fee <= TAIL_KNEE) return fee;\n        return TAIL_KNEE + wmul(fee - TAIL_KNEE, slope);\n    }\n\n    function _powWad(uint256 factor, uint256 exp) internal pure returns (uint256 result) {\n        result = WAD;\n        while (exp > 0) {\n            if (exp & 1 == 1) result = wmul(result, factor);\n            factor = wmul(factor, factor);\n            exp >>= 1;\n        }\n    }\n\n    function _decayCentered(uint256 centered, uint256 decayFactor, uint256 elapsed) internal pure returns (uint256) {\n        uint256 mul = _powWad(decayFactor, elapsed);\n        if (centered >= WAD) { return WAD + wmul(centered - WAD, mul); }\n        uint256 below = wmul(WAD - centered, mul);\n        return below < WAD ? WAD - below : 0;\n    }\n\n    function getName() external pure override returns (string memory) { return \"no_cubic\"; }\n}\n",
  "simulator_diff": "diff --git a/amm_sim_rs/src/amm/cfmm.rs b/amm_sim_rs/src/amm/cfmm.rs\nindex 02e6645..a8d25ab 100644\n--- a/amm_sim_rs/src/amm/cfmm.rs\n+++ b/amm_sim_rs/src/amm/cfmm.rs\n@@ -50,6 +50,7 @@ pub struct CFMM {\n     current_fees: FeeQuote,\n     /// Whether initialized\n     initialized: bool,\n+    fair_price: f64,\n     /// Accumulated fees in X (collected separately, not in reserves)\n     accumulated_fees_x: f64,\n     /// Accumulated fees in Y (collected separately, not in reserves)\n@@ -67,6 +68,7 @@ impl CFMM {\n             reserve_y,\n             current_fees: FeeQuote::symmetric(Wad::from_bps(30)),\n             initialized: false,\n+            fair_price: 0.0,\n             accumulated_fees_x: 0.0,\n             accumulated_fees_y: 0.0,\n         }\n@@ -85,6 +87,8 @@ impl CFMM {\n     }\n \n     /// Get current reserves.\n+    pub fn set_fair_price(&mut self, price: f64) { self.fair_price = price; }\n+\n     pub fn reserves(&self) -> (f64, f64) {\n         (self.reserve_x, self.reserve_y)\n     }\n@@ -291,7 +295,7 @@ impl CFMM {\n \n     /// Update fees from strategy after a trade.\n     fn update_fees(&mut self, trade_info: &TradeInfo) {\n-        if let Ok((bid_fee, ask_fee)) = self.strategy.after_swap(trade_info) {\n+        if let Ok((bid_fee, ask_fee)) = self.strategy.after_swap(trade_info, self.fair_price) {\n             self.current_fees = FeeQuote::new(bid_fee.clamp_fee(), ask_fee.clamp_fee());\n         }\n         // On error, keep current fees\ndiff --git a/amm_sim_rs/src/evm/strategy.rs b/amm_sim_rs/src/evm/strategy.rs\nindex 1d06af1..726e5ec 100644\n--- a/amm_sim_rs/src/evm/strategy.rs\n+++ b/amm_sim_rs/src/evm/strategy.rs\n@@ -176,12 +176,13 @@ impl EVMStrategy {\n     ///\n     /// Returns (bid_fee, ask_fee) in WAD.\n     #[inline]\n-    pub fn after_swap(&mut self, trade: &TradeInfo) -> Result<(Wad, Wad), EVMError> {\n+    pub fn after_swap(&mut self, trade: &TradeInfo, fair_price: f64) -> Result<(Wad, Wad), EVMError> {\n         // Encode trade info into pre-allocated buffer\n         trade.encode_calldata(&mut self.trade_calldata);\n \n         // Copy calldata to avoid borrow conflict\n-        let calldata = self.trade_calldata;\n+        let mut calldata = Vec::from(self.trade_calldata);\n+        calldata.extend_from_slice(&U256::from((fair_price * 1e18).floor() as u128).to_be_bytes::<32>());\n         let result = self.call(&calldata, GAS_LIMIT_TRADE)?;\n \n         decode_fee_pair(&result)\ndiff --git a/amm_sim_rs/src/simulation/engine.rs b/amm_sim_rs/src/simulation/engine.rs\nindex 6834c43..7c08598 100644\n--- a/amm_sim_rs/src/simulation/engine.rs\n+++ b/amm_sim_rs/src/simulation/engine.rs\n@@ -136,14 +136,16 @@ impl SimulationEngine {\n         for t in 0..self.config.n_steps {\n             // 1. Generate new fair price\n             let fair_price = price_process.step();\n+            for amm in amms.iter_mut() { amm.set_fair_price(fair_price); }\n \n             // 2. Arbitrageur extracts profit from each AMM\n             for amm in amms.iter_mut() {\n                 if let Some(arb_result) = arbitrageur.execute_arb(amm, fair_price, t as u64) {\n                     *arb_volume_y.get_mut(&arb_result.amm_name).unwrap() += arb_result.amount_y;\n-                    let entry = edges.entry(arb_result.amm_name).or_insert(0.0);\n+                    let entry = edges.entry(arb_result.amm_name.clone()).or_insert(0.0);\n                     // AMM edge is the negative of arbitrageur profit at true price\n                     *entry += -arb_result.profit;\n+                    *edges.entry(format!(\"{}_arb\", arb_result.amm_name)).or_insert(0.0) -= arb_result.profit;\n                 }\n             }\n \n@@ -157,8 +159,9 @@ impl SimulationEngine {\n                 } else {\n                     trade.amount_y - trade.amount_x * fair_price\n                 };\n-                let entry = edges.entry(trade.amm_name).or_insert(0.0);\n+                let entry = edges.entry(trade.amm_name.clone()).or_insert(0.0);\n                 *entry += trade_edge;\n+                *edges.entry(format!(\"{}_retail\", trade.amm_name)).or_insert(0.0) += trade_edge;\n             }\n \n             // 4. Capture step result and accumulate fees\n",
  "sha256": "f2c0250b764d3d247cde941204643abd06cb4a6be595dc1b63084b6aebac4a9a",
  "tuning": {
    "seeds": "10000..10099",
    "n": 100,
    "passes": 2,
    "grid_points_scored": 84,
    "unique_candidate_measurements": 73,
    "duplicate_policy": "Identical source hashes reuse their first tuning measurement.",
    "coordinate_order": [
      "STALE_DIR_COEF",
      "STALE_ATTRACT_FRAC",
      "TOX_COEF",
      "TOX_QUAD_COEF",
      "TRADE_TOX_BOOST",
      "TOX_BLEND_DECAY"
    ],
    "multipliers": [
      0.25,
      0.5,
      0.75,
      1,
      1.5,
      2,
      3
    ],
    "multiplier_reference": "original NP2 constants, not the previous pass value",
    "selection": "maximize paired mean edge difference on the same 100 tuning seeds; retain the first grid point on exact ties",
    "original": {
      "STALE_DIR_COEF": 685000000000000000,
      "STALE_ATTRACT_FRAC": 1050000000000000000,
      "TOX_COEF": 30000000000000000,
      "TOX_QUAD_COEF": 1500000000000000000,
      "TRADE_TOX_BOOST": 350000000000000000,
      "TOX_BLEND_DECAY": 51000000000000000
    },
    "selected": {
      "STALE_DIR_COEF": 513750000000000000,
      "STALE_ATTRACT_FRAC": 1050000000000000000,
      "TOX_COEF": 60000000000000000,
      "TOX_QUAD_COEF": 4500000000000000000,
      "TRADE_TOX_BOOST": 350000000000000000,
      "TOX_BLEND_DECAY": 102000000000000000
    },
    "selected_multipliers": {
      "STALE_DIR_COEF": 0.75,
      "STALE_ATTRACT_FRAC": 1.0,
      "TOX_COEF": 2.0,
      "TOX_QUAD_COEF": 3.0,
      "TRADE_TOX_BOOST": 1.0,
      "TOX_BLEND_DECAY": 2.0
    },
    "training": {
      "mean_diff": 1.0220873509816926,
      "se": 0.22105196915069475,
      "params": {
        "STALE_DIR_COEF": 513750000000000000,
        "STALE_ATTRACT_FRAC": 1050000000000000000,
        "TOX_COEF": 60000000000000000,
        "TOX_QUAD_COEF": 4500000000000000000,
        "TRADE_TOX_BOOST": 350000000000000000,
        "TOX_BLEND_DECAY": 102000000000000000
      },
      "sha256": "f2c0250b764d3d247cde941204643abd06cb4a6be595dc1b63084b6aebac4a9a"
    },
    "evaluations": [
      {
        "pass_index": 1,
        "coordinate": "STALE_DIR_COEF",
        "multiplier": 0.25,
        "mean_diff": -64.23970149475373,
        "se": 1.2129972215098133
      },
      {
        "pass_index": 1,
        "coordinate": "STALE_DIR_COEF",
        "multiplier": 0.5,
        "mean_diff": -22.632887995390444,
        "se": 0.4981360760878316
      },
      {
        "pass_index": 1,
        "coordinate": "STALE_DIR_COEF",
        "multiplier": 0.75,
        "mean_diff": -2.8438088340667282,
        "se": 0.2124031545561537
      },
      {
        "pass_index": 1,
        "coordinate": "STALE_DIR_COEF",
        "multiplier": 1,
        "mean_diff": -5.644355390435415,
        "se": 0.26602671827571334
      },
      {
        "pass_index": 1,
        "coordinate": "STALE_DIR_COEF",
        "multiplier": 1.5,
        "mean_diff": -86.09336487135435,
        "se": 2.3916919595548682
      },
      {
        "pass_index": 1,
        "coordinate": "STALE_DIR_COEF",
        "multiplier": 2,
        "mean_diff": -260.4352290912787,
        "se": 4.8894879482129685
      },
      {
        "pass_index": 1,
        "coordinate": "STALE_DIR_COEF",
        "multiplier": 3,
        "mean_diff": -343.0829644120565,
        "se": 5.363592012430614
      },
      {
        "pass_index": 1,
        "coordinate": "STALE_ATTRACT_FRAC",
        "multiplier": 0.25,
        "mean_diff": -17.434083080852247,
        "se": 0.4145282609946867
      },
      {
        "pass_index": 1,
        "coordinate": "STALE_ATTRACT_FRAC",
        "multiplier": 0.5,
        "mean_diff": -7.8810295785954345,
        "se": 0.2663630560618332
      },
      {
        "pass_index": 1,
        "coordinate": "STALE_ATTRACT_FRAC",
        "multiplier": 0.75,
        "mean_diff": -2.890785884028365,
        "se": 0.21001265150456044
      },
      {
        "pass_index": 1,
        "coordinate": "STALE_ATTRACT_FRAC",
        "multiplier": 1,
        "mean_diff": -2.8438088340667282,
        "se": 0.2124031545561537
      },
      {
        "pass_index": 1,
        "coordinate": "STALE_ATTRACT_FRAC",
        "multiplier": 1.5,
        "mean_diff": -5.011935132497714,
        "se": 0.21499174760479683
      },
      {
        "pass_index": 1,
        "coordinate": "STALE_ATTRACT_FRAC",
        "multiplier": 2,
        "mean_diff": -6.84232336880719,
        "se": 0.22120537303796467
      },
      {
        "pass_index": 1,
        "coordinate": "STALE_ATTRACT_FRAC",
        "multiplier": 3,
        "mean_diff": -9.027833677717226,
        "se": 0.23405336082039735
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_COEF",
        "multiplier": 0.25,
        "mean_diff": -4.497472697227692,
        "se": 0.23712853532580472
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_COEF",
        "multiplier": 0.5,
        "mean_diff": -3.881915806808353,
        "se": 0.2302009375587184
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_COEF",
        "multiplier": 0.75,
        "mean_diff": -3.3315974441451686,
        "se": 0.22042846904219485
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_COEF",
        "multiplier": 1,
        "mean_diff": -2.8438088340667282,
        "se": 0.2124031545561537
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_COEF",
        "multiplier": 1.5,
        "mean_diff": -2.0655636612973582,
        "se": 0.20005188735512958
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_COEF",
        "multiplier": 2,
        "mean_diff": -1.468539245643218,
        "se": 0.1891047813533356
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_COEF",
        "multiplier": 3,
        "mean_diff": -0.9630431203325708,
        "se": 0.1780055389633111
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_QUAD_COEF",
        "multiplier": 0.25,
        "mean_diff": -2.738349516002885,
        "se": 0.22283688088579248
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_QUAD_COEF",
        "multiplier": 0.5,
        "mean_diff": -2.039311242794071,
        "se": 0.2036116861319628
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_QUAD_COEF",
        "multiplier": 0.75,
        "mean_diff": -1.4674497107547568,
        "se": 0.19017520086883583
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_QUAD_COEF",
        "multiplier": 1,
        "mean_diff": -0.9630431203325708,
        "se": 0.1780055389633111
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_QUAD_COEF",
        "multiplier": 1.5,
        "mean_diff": -0.1967923427609128,
        "se": 0.16523278026925822
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_QUAD_COEF",
        "multiplier": 2,
        "mean_diff": 0.27610804461801763,
        "se": 0.1757830993151912
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_QUAD_COEF",
        "multiplier": 3,
        "mean_diff": -0.9906702811818917,
        "se": 0.3299370569970933
      },
      {
        "pass_index": 1,
        "coordinate": "TRADE_TOX_BOOST",
        "multiplier": 0.25,
        "mean_diff": -0.4493963753858117,
        "se": 0.17036612247085553
      },
      {
        "pass_index": 1,
        "coordinate": "TRADE_TOX_BOOST",
        "multiplier": 0.5,
        "mean_diff": -0.15602161164123912,
        "se": 0.1714850244520214
      },
      {
        "pass_index": 1,
        "coordinate": "TRADE_TOX_BOOST",
        "multiplier": 0.75,
        "mean_diff": 0.12194419814541675,
        "se": 0.17292521646572817
      },
      {
        "pass_index": 1,
        "coordinate": "TRADE_TOX_BOOST",
        "multiplier": 1,
        "mean_diff": 0.27610804461801763,
        "se": 0.1757830993151912
      },
      {
        "pass_index": 1,
        "coordinate": "TRADE_TOX_BOOST",
        "multiplier": 1.5,
        "mean_diff": 0.40517352516144794,
        "se": 0.1726921576364737
      },
      {
        "pass_index": 1,
        "coordinate": "TRADE_TOX_BOOST",
        "multiplier": 2,
        "mean_diff": 0.18482960430242543,
        "se": 0.17495267927824473
      },
      {
        "pass_index": 1,
        "coordinate": "TRADE_TOX_BOOST",
        "multiplier": 3,
        "mean_diff": -1.2081966559443946,
        "se": 0.19038211080198122
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_BLEND_DECAY",
        "multiplier": 0.25,
        "mean_diff": -0.03316268655994236,
        "se": 0.18720881491377678
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_BLEND_DECAY",
        "multiplier": 0.5,
        "mean_diff": 0.15585192342528445,
        "se": 0.1842577765411407
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_BLEND_DECAY",
        "multiplier": 0.75,
        "mean_diff": 0.30018785639282897,
        "se": 0.1797216773526682
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_BLEND_DECAY",
        "multiplier": 1,
        "mean_diff": 0.40517352516144794,
        "se": 0.1726921576364737
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_BLEND_DECAY",
        "multiplier": 1.5,
        "mean_diff": 0.4781945558281905,
        "se": 0.16409289776417685
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_BLEND_DECAY",
        "multiplier": 2,
        "mean_diff": 0.45044960247997096,
        "se": 0.15962808539741272
      },
      {
        "pass_index": 1,
        "coordinate": "TOX_BLEND_DECAY",
        "multiplier": 3,
        "mean_diff": -0.12791464730228483,
        "se": 0.1558573096825366
      },
      {
        "pass_index": 2,
        "coordinate": "STALE_DIR_COEF",
        "multiplier": 0.25,
        "mean_diff": -46.159218145919574,
        "se": 0.8598439329687799
      },
      {
        "pass_index": 2,
        "coordinate": "STALE_DIR_COEF",
        "multiplier": 0.5,
        "mean_diff": -12.317125813913911,
        "se": 0.31376476525011865
      },
      {
        "pass_index": 2,
        "coordinate": "STALE_DIR_COEF",
        "multiplier": 0.75,
        "mean_diff": 0.4781945558281905,
        "se": 0.16409289776417685
      },
      {
        "pass_index": 2,
        "coordinate": "STALE_DIR_COEF",
        "multiplier": 1,
        "mean_diff": -15.491550271489313,
        "se": 0.6232345527460468
      },
      {
        "pass_index": 2,
        "coordinate": "STALE_DIR_COEF",
        "multiplier": 1.5,
        "mean_diff": -154.93149297850948,
        "se": 3.701566340546846
      },
      {
        "pass_index": 2,
        "coordinate": "STALE_DIR_COEF",
        "multiplier": 2,
        "mean_diff": -290.5141447296596,
        "se": 4.933354070503908
      },
      {
        "pass_index": 2,
        "coordinate": "STALE_DIR_COEF",
        "multiplier": 3,
        "mean_diff": -346.1398531329396,
        "se": 5.371595315837458
      },
      {
        "pass_index": 2,
        "coordinate": "STALE_ATTRACT_FRAC",
        "multiplier": 0.25,
        "mean_diff": -19.787228293265876,
        "se": 0.4668118387989349
      },
      {
        "pass_index": 2,
        "coordinate": "STALE_ATTRACT_FRAC",
        "multiplier": 0.5,
        "mean_diff": -10.487747078412179,
        "se": 0.30649914430496666
      },
      {
        "pass_index": 2,
        "coordinate": "STALE_ATTRACT_FRAC",
        "multiplier": 0.75,
        "mean_diff": -1.8560435700875495,
        "se": 0.190248560825388
      },
      {
        "pass_index": 2,
        "coordinate": "STALE_ATTRACT_FRAC",
        "multiplier": 1,
        "mean_diff": 0.4781945558281905,
        "se": 0.16409289776417685
      },
      {
        "pass_index": 2,
        "coordinate": "STALE_ATTRACT_FRAC",
        "multiplier": 1.5,
        "mean_diff": -0.8567763432110621,
        "se": 0.16456491246470498
      },
      {
        "pass_index": 2,
        "coordinate": "STALE_ATTRACT_FRAC",
        "multiplier": 2,
        "mean_diff": -2.6198844261215233,
        "se": 0.16909785207304132
      },
      {
        "pass_index": 2,
        "coordinate": "STALE_ATTRACT_FRAC",
        "multiplier": 3,
        "mean_diff": -4.788147491755959,
        "se": 0.188699292712698
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_COEF",
        "multiplier": 0.25,
        "mean_diff": -1.3630707929046975,
        "se": 0.16700878896271582
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_COEF",
        "multiplier": 0.5,
        "mean_diff": -0.9211279600179154,
        "se": 0.16023717187977435
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_COEF",
        "multiplier": 0.75,
        "mean_diff": -0.539083534491557,
        "se": 0.15717614450408443
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_COEF",
        "multiplier": 1,
        "mean_diff": -0.1914931612541477,
        "se": 0.15225867649259323
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_COEF",
        "multiplier": 1.5,
        "mean_diff": 0.2937240244603839,
        "se": 0.14800603825589734
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_COEF",
        "multiplier": 2,
        "mean_diff": 0.599453880488536,
        "se": 0.1477000675884743
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_COEF",
        "multiplier": 3,
        "mean_diff": 0.4781945558281905,
        "se": 0.16409289776417685
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_QUAD_COEF",
        "multiplier": 0.25,
        "mean_diff": -4.208472710104999,
        "se": 0.24747659250910115
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_QUAD_COEF",
        "multiplier": 0.5,
        "mean_diff": -3.2300079939596005,
        "se": 0.22190542955753317
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_QUAD_COEF",
        "multiplier": 0.75,
        "mean_diff": -2.344635912914019,
        "se": 0.2000271701224349
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_QUAD_COEF",
        "multiplier": 1,
        "mean_diff": -1.5997832869823754,
        "se": 0.18327741003701567
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_QUAD_COEF",
        "multiplier": 1.5,
        "mean_diff": -0.3445012970774644,
        "se": 0.15633909547754876
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_QUAD_COEF",
        "multiplier": 2,
        "mean_diff": 0.599453880488536,
        "se": 0.1477000675884743
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_QUAD_COEF",
        "multiplier": 3,
        "mean_diff": 0.8496305945368499,
        "se": 0.2309549792106813
      },
      {
        "pass_index": 2,
        "coordinate": "TRADE_TOX_BOOST",
        "multiplier": 0.25,
        "mean_diff": 0.2154826983013629,
        "se": 0.21733976189295276
      },
      {
        "pass_index": 2,
        "coordinate": "TRADE_TOX_BOOST",
        "multiplier": 0.5,
        "mean_diff": 0.5257126305627725,
        "se": 0.21936157642430368
      },
      {
        "pass_index": 2,
        "coordinate": "TRADE_TOX_BOOST",
        "multiplier": 0.75,
        "mean_diff": 0.7364015999058268,
        "se": 0.22211510671130824
      },
      {
        "pass_index": 2,
        "coordinate": "TRADE_TOX_BOOST",
        "multiplier": 1,
        "mean_diff": 0.8663518425322115,
        "se": 0.2260557298498503
      },
      {
        "pass_index": 2,
        "coordinate": "TRADE_TOX_BOOST",
        "multiplier": 1.5,
        "mean_diff": 0.8496305945368499,
        "se": 0.2309549792106813
      },
      {
        "pass_index": 2,
        "coordinate": "TRADE_TOX_BOOST",
        "multiplier": 2,
        "mean_diff": 0.5213723599893371,
        "se": 0.22861775708987303
      },
      {
        "pass_index": 2,
        "coordinate": "TRADE_TOX_BOOST",
        "multiplier": 3,
        "mean_diff": -1.0728062748916471,
        "se": 0.2472548815388013
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_BLEND_DECAY",
        "multiplier": 0.25,
        "mean_diff": -0.3969352658021995,
        "se": 0.25677254517210935
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_BLEND_DECAY",
        "multiplier": 0.5,
        "mean_diff": -0.15087997357825544,
        "se": 0.24899605906495653
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_BLEND_DECAY",
        "multiplier": 0.75,
        "mean_diff": 0.20904958062401874,
        "se": 0.23596231042525995
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_BLEND_DECAY",
        "multiplier": 1,
        "mean_diff": 0.47671194353928004,
        "se": 0.23258166231158203
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_BLEND_DECAY",
        "multiplier": 1.5,
        "mean_diff": 0.8663518425322115,
        "se": 0.2260557298498503
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_BLEND_DECAY",
        "multiplier": 2,
        "mean_diff": 1.0220873509816926,
        "se": 0.22105196915069475
      },
      {
        "pass_index": 2,
        "coordinate": "TOX_BLEND_DECAY",
        "multiplier": 3,
        "mean_diff": 0.8167358627367896,
        "se": 0.2043272350552403
      }
    ]
  },
  "paired": {
    "n": 2000,
    "mean_diff": 1.190310791328803,
    "se": 0.05125624086181131,
    "worst": -31.315046971942593,
    "candidate_mean_edge": 527.561315125808,
    "np2_mean_edge": 526.3710043344793,
    "worst_seeds": [
      {
        "seed": 2691555,
        "candidate_edge": 490.9322276410236,
        "np2_edge": 522.2472746129662,
        "diff": -31.315046971942593
      },
      {
        "seed": 2691457,
        "candidate_edge": 466.5854295541175,
        "np2_edge": 484.54860520168137,
        "diff": -17.963175647563844
      },
      {
        "seed": 2690440,
        "candidate_edge": 426.879697967704,
        "np2_edge": 443.2970808083562,
        "diff": -16.417382840652238
      },
      {
        "seed": 2691805,
        "candidate_edge": 645.2188156213663,
        "np2_edge": 661.4074055142563,
        "diff": -16.188589892890036
      },
      {
        "seed": 2691988,
        "candidate_edge": 637.0221695384247,
        "np2_edge": 647.4666190090179,
        "diff": -10.444449470593213
      }
    ]
  },
  "split": {
    "arb": {
      "n": 2000,
      "mean_diff": 5.982362052135586,
      "se": 0.029978373493436728,
      "worst": -2.522527445971818
    },
    "retail": {
      "n": 2000,
      "mean_diff": -4.792051260806768,
      "se": 0.06258382304245756,
      "worst": -38.66555407595183
    },
    "units": "mean per simulation Y-denominated edge difference, candidate minus NP2"
  },
  "fee_stats": {
    "bid": {
      "candidate": 0.003861948249929638,
      "np2": 0.0036433931959901624,
      "diff": 0.00021855505393947577
    },
    "ask": {
      "candidate": 0.0035447944758878807,
      "np2": 0.0035374976087419307,
      "diff": 7.296867145950049e-06
    }
  },
  "fee_stats_definition": "Arithmetic mean of simulator average_fees: fee fraction sampled after each of 10,000 steps, then averaged equally across the 2,000 confirmation seeds. Not volume weighted.",
  "blocked": null,
  "next": "The confirmed +1.1903 gain is below the task target of +5.8 for top 10. Focus next on recovering retail edge sacrificed by oracle-driven fees while retaining the arbitrage gain. TOX_QUAD_COEF reached the 3x search boundary; this finite grid and coordinate search are not a global oracle optimum. Use a fresh holdout for subsequent experiments. This candidate requires the simulator-only true-price feed.",
  "method": {
    "simulator_commit": "6b6921f8d463314aa7c96234e1be25a25245f704",
    "np2_sha256": "51f1c1a9d4999ee460eb8bbc66880da8074b173399a4f5d71f96671482e18ac0",
    "confirmation_seeds": "2690000..2691999 inclusive; candidate frozen before reference and candidate confirmation; each evaluated once",
    "comparison": "Candidate and NP2 run separately against compiled VanillaStrategy; never against each other. amm_sim_rs.run_batch in chunks of 20, 8 workers.",
    "config": "numpy.default_rng(seed): size uniform(19,21), rate uniform(.6,1), sigma uniform(.000882,.001008), in that order; build_config(seed=seed,gbm_sigma=sigma,retail_arrival_rate=rate,retail_mean_size=size). Original pinned defaults otherwise; price seed=seed; retail seed=seed+1.",
    "statistic": "paired d=candidate submission edge minus NP2 submission edge; sample standard deviation ddof=1 divided by sqrt(n); worst=min(d).",
    "oracle": "Before each step arbitrage, set CFMM fair_price for all AMMs. after_swap appends U256(floor(fair_price*1e18)) to original 196-byte calldata. Candidate assigns pHat=calldataload(196) immediately before tradeRatio. No NP2 source modification.",
    "calibration": {
      "strategy": "CH",
      "seeds": "0..999",
      "expected": 525.525882178,
      "observed": 525.5258821780834
    }
  },
  "measurement_sha256": {
    "ch-check": "5ead136154e2e74afb7eb64f7f4413db5ac6faad3bd3dcfd85daa28e0cc93aaf",
    "train-reference": "f985474ff2174067b54a57db18eaeba1e39889b2ee903854d50ced29e74d721f",
    "confirm-reference": "4fad5a9b97068900bae6886ae408d5594cb80b75c2cb5f0fef744dffaad88cfc",
    "confirm-candidate": "92780bf51817a6591abfde47840a92e7ad76fd9e0bc48e2d67f4ab9639e5c2cb"
  },
  "checks": {
    "challenge_validator": {
      "passed": false,
      "error": "Inline assembly is not allowed",
      "interpretation": "The task explicitly requires assembly calldataload(196); this is a simulator-only oracle experiment and is not challenge-submittable."
    },
    "oracle_probe": {
      "passed": true,
      "steps": 30,
      "current_price_updates_checked": 25,
      "seed": 10001
    },
    "setup": "passed: exact item setup script, release build, StarterStrategy validation",
    "compile": "all evaluated candidates compiled successfully using pinned compiler settings",
    "split_sum": "per-seed arb+retail equals total edge to absolute tolerance 1e-7, candidate and NP2",
    "source_quotes": "all source quotes independently fetched and verified"
  },
  "reproduction": {
    "measure_py": "import sys,time,json,hashlib\nfrom pathlib import Path\nimport numpy as np\nimport amm_sim_rs\nfrom amm_competition.evm.compiler import SolidityCompiler\nfrom amm_competition.competition.config import build_config\ncompiler=SolidityCompiler()\ndef compile(s,name=\"Strategy\"):\n r=compiler.compile(s,name)\n if not r.success: raise RuntimeError(r.errors)\n return list(r.bytecode)\ndef config(s):\n rng=np.random.default_rng(s)\n size=rng.uniform(19,21); rate=rng.uniform(.6,1); sigma=rng.uniform(.000882,.001008)\n return build_config(seed=s,gbm_sigma=sigma,retail_arrival_rate=rate,retail_mean_size=size)\nvanilla=compile(Path('contracts/src/VanillaStrategy.sol').read_text(),'VanillaStrategy')\ndef run(code,seeds):\n bytecode=compile(code); rows=[]; start=time.time()\n for i in range(0,len(seeds),20):\n  batch=amm_sim_rs.run_batch(bytecode,vanilla,[config(s) for s in seeds[i:i+20]],8)\n  for s,r in zip(seeds[i:i+20],batch.results):\n   rows.append(dict(seed=s,edge=r.edges['submission'],arb=r.edges.get('submission_arb'),retail=r.edges.get('submission_retail'),bid=r.average_fees['submission'][0],ask=r.average_fees['submission'][1]))\n print('RUN',len(seeds),float(np.mean([r['edge'] for r in rows])),round(time.time()-start,2),flush=True)\n return rows\nif __name__=='__main__':\n name=sys.argv[1]; n=int(sys.argv[2]); start=int(sys.argv[3])\n rows=run(Path('scratch/'+name+'.sol').read_text(),list(range(start,start+n)))\n Path('scratch/'+name+'-'+str(start)+'.json').write_text(json.dumps(rows))\n",
    "experiment_py": "from measure import *\nimport re\nbase=Path('scratch/np2.sol').read_text()\noracle=Path('scratch/oracle.sol').read_text()\nnames=['STALE_DIR_COEF','STALE_ATTRACT_FRAC','TOX_COEF','TOX_QUAD_COEF','TRADE_TOX_BOOST','TOX_BLEND_DECAY']\noriginal={}\nfor name in names:\n expr=re.search(r'uint256 constant '+name+r' = ([^;]+);',base).group(1)\n original[name]=eval(expr,{'BPS':10**14})\ndef code(params):\n s=oracle\n for k,v in params.items():s=re.sub(r'(uint256 constant '+k+r' = )[^;]+;',lambda m:m[1]+str(v)+';',s)\n return s\ndef save(name,x):Path('scratch/'+name+'.json').write_text(json.dumps(x))\nch=run(Path('scratch/ch.sol').read_text(),list(range(1000)))\nsave('ch-check',ch)\nscore=float(np.mean([r['edge'] for r in ch]));print('CH_CHECK',score,flush=True)\nif abs(score-525.525882178)>1e-6:raise RuntimeError('CH check mismatch')\ntrain=list(range(10000,10100))\nref=run(base,train);save('train-reference',ref)\nparams=dict(original); records=[];cache={}\ndef evaluate(p):\n s=code(p);h=hashlib.sha256(s.encode()).hexdigest()\n if h not in cache:\n  rows=run(s,train);diff=np.array([a['edge']-b['edge'] for a,b in zip(rows,ref)])\n  cache[h]={'mean_diff':float(diff.mean()),'se':float(diff.std(ddof=1)/np.sqrt(len(diff))),'params':dict(p),'sha256':h}\n return cache[h]\nfor passn in range(2):\n for k in names:\n  trials=[]\n  for mult in [.25,.5,.75,1,1.5,2,3]:\n   p=dict(params);p[k]=int(original[k]*mult)\n   x=evaluate(p);trials.append(x);records.append(dict(pass_index=passn+1,coordinate=k,multiplier=mult,**x))\n   save('tuning-progress',records)\n   print('TRIAL',passn+1,k,mult,x['mean_diff'],flush=True)\n  best=max(trials,key=lambda x:x['mean_diff']);params=best['params'].copy()\n  print('SELECT',passn+1,k,params[k],best['mean_diff'],flush=True)\nfinal=code(params);Path('scratch/frozen.sol').write_text(final)\nsave('frozen',{'params':params,'original':original,'sha256':hashlib.sha256(final.encode()).hexdigest(),'training':evaluate(params),'records':records})\nprint('FROZEN',params,flush=True)\nseeds=list(range(2690000,2692000))\nref=run(base,seeds);save('confirm-reference',ref)\ncand=run(final,seeds);save('confirm-candidate',cand)\nprint('COMPLETE',flush=True)\n",
    "probe_py": "from measure import *\ns=Path('contracts/src/VanillaStrategy.sol').read_text().replace('contract VanillaStrategy','contract Strategy')\nneedle='function afterSwap(TradeInfo calldata) external pure override returns (uint256 bidFee, uint256 askFee) {\\n        return (FEE, FEE);'\ns=s.replace(needle,'function afterSwap(TradeInfo calldata) external pure override returns (uint256 bidFee, uint256 askFee) {\\n        uint256 p; assembly { p := calldataload(196) }\\n        return (p / 100000, p / 100000);')\nassert 'calldataload(196)' in s\nresult=amm_sim_rs.run_single(compile(s),vanilla,amm_sim_rs.SimulationConfig(n_steps=30,seed=10001,initial_price=100,initial_x=100,initial_y=10000,gbm_mu=0,gbm_sigma=.00095,gbm_dt=1,retail_arrival_rate=.8,retail_mean_size=20,retail_size_sigma=1.2,retail_buy_prob=.5))\nobserved=0\nfor step in result.steps:\n fee=step.fees['submission'][0]\n if fee != .003:\n  expected=step.fair_price/100000\n  # Inactive steps retain the prior quote; match only changing fees.\n  if observed==0 or fee!=prev:\n   assert abs(fee-expected)<1e-15,(step.timestamp,fee,expected)\n   observed+=1\n prev=fee\nassert observed>0\nPath('scratch/probe.json').write_text(json.dumps({'passed':True,'steps':30,'current_price_updates_checked':observed,'seed':10001}))\nprint('PROBE',observed,'fee changes match current step price')\n",
    "inputs": "scratch/np2.sol reconstructed from the two cited artifacts as specified in task; scratch/oracle.sol adds the single assembly assignment before tradeRatio; scratch/ch.sol from cited CH URL. Apply simulator_diff to the pinned simulator before running. No runtime dependency added to simulator."
  }
}
