{
  "blocked": null,
  "sources": [
    {
      "url": "https://www.linkedin.com/pulse/amm-fee-challenge-notes-from-our-run-optimization-arena-qe3ff",
      "author": "Algebra Finance / Algebra DEX engine",
      "date": "2026-03-27",
      "holds": "First-hand entrant article: peak ninth among 654; twelfth when written. Describes environment estimation, short-term response, directional fee protection and probabilistic block ordering. No numerical formula, constants, ablation scores or source code published in this article."
    },
    {
      "url": "https://www.benedict.dev/optimization-arena-learnings",
      "author": "Benedict Brady (organizer; not an entrant disclosure)",
      "date": "2026-04-09",
      "holds": "Talk-derived organizer account of the top eight: two Solidity neural networks; compact 200–300-line mathematical models; approaches with over 100 constants; one competitor-AMM model. Reports near-identical outcomes across 20 simulations and synchronized protective-side flips. Does not identify which entrant used which architecture or disclose weights/formulas."
    },
    {
      "url": "https://raw.githubusercontent.com/jiayaoqijia/amm-challenge-yq/3e9dc7d5a6192c88b562a0f8d9c172ca566ec94d/README.md",
      "author": "jiayaoqijia",
      "date": null,
      "holds": "Entrant repository write-up. Claims official leaderboard score 523.21; local benchmark 495 simulations over five seed offsets. Describes adaptive shock gate, cubic toxicity, trade-aligned boost, asymmetric stale discount and tail compression. No claimed board rank. Snapshot commit 3e9dc7d5a6192c88b562a0f8d9c172ca566ec94d."
    },
    {
      "url": "https://raw.githubusercontent.com/dipankar/amm-challenge/c588ae6c47fc9af2063c9bb1f2efbeb0dd276dab/ANALYSIS.md",
      "author": "dipankar",
      "date": null,
      "holds": "First-hand research post-mortem. Claims SigmaAdaptive 526.54 versus WinningV5 295.57; attributes the change to state estimation instead of arb/retail classification. Gives an adaptive price gate, cubic toxicity and aligned boost; cites jiayaoqijia as reference. These are author claims, not fresh board measurements."
    },
    {
      "url": "https://raw.githubusercontent.com/dipankar/amm-challenge/c588ae6c47fc9af2063c9bb1f2efbeb0dd276dab/README.md",
      "author": "dipankar",
      "date": null,
      "holds": "Labels 526.54 as a 500-simulation local edge, not an official board score. Snapshot commit c588ae6c47fc9af2063c9bb1f2efbeb0dd276dab."
    },
    {
      "url": "https://raw.githubusercontent.com/ChengHua926/amm-challenge/d34a5199c59a4c44d5336a25f1436b4ae1f21104/contracts/src/Strategy.sol",
      "author": "ChengHua926",
      "date": null,
      "holds": "Pinned public Solidity reference supplied by the task, getName no_cubic. Code evidence only; no accompanying first-hand narrative or current board claim established here."
    },
    {
      "url": "https://raw.githubusercontent.com/jiayaoqijia/amm-challenge-yq/3e9dc7d5a6192c88b562a0f8d9c172ca566ec94d/contracts/src/Strategy.sol",
      "author": "jiayaoqijia",
      "date": null,
      "holds": "Exact Solidity accompanying the YQ write-up; validated and measured without modification."
    },
    {
      "url": "https://raw.githubusercontent.com/dipankar/amm-challenge/c588ae6c47fc9af2063c9bb1f2efbeb0dd276dab/contracts/src/SigmaAdaptiveStrategy.sol",
      "author": "dipankar",
      "date": null,
      "holds": "Exact Solidity accompanying the post-mortem; validated and measured without modification. Its attract ratio is 1.12; the analysis table describes 1.124 for the cited reference, so they are not identical policies."
    },
    {
      "url": "https://api.imd.fun/artifacts/19f2ec857df536e8ab62ab1da89ec6623332521ce46849f15bccff402c63e1e5",
      "author": "IdentityMD (task-specified comparator)",
      "date": null,
      "holds": "RS2 source, SHA-256 f24b6ca198b744c380842c3a17964a6dc21f311bb04984b26733afa3fee8eaf2, verified from decoded code bytes."
    },
    {
      "url": "https://api.imd.fun/artifacts/33f54e81f3372088e9eced52c0174f310ac348af98ef5727b73785c088679194",
      "author": "IdentityMD (task-specified measurement reference)",
      "date": null,
      "holds": "Supplied harness_source describes independent candidate-versus-Vanilla arms, pairing and retrospective arb/retail decomposition. Inspected as data; a local measurement program was written for this item."
    },
    {
      "url": "https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_competition/competition/match.py",
      "author": "benedictbrady/amm-challenge",
      "date": null,
      "holds": "MatchRunner._build_configs draws retail size, rate and volatility in that order using default_rng(seed)."
    },
    {
      "url": "https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_sim_rs/src/simulation/engine.rs",
      "author": "benedictbrady/amm-challenge",
      "date": null,
      "holds": "Pinned engine seeds price with seed and retail with seed+1; arbitrage precedes retail."
    },
    {
      "url": "https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_sim_rs/src/market/arbitrageur.rs",
      "author": "benedictbrady/amm-challenge",
      "date": null,
      "holds": "Closed-form arbitrage size/profit formulas used for retrospective edge decomposition, matching the supplied harness."
    }
  ],
  "mechanisms": [
    {
      "name": "Algebra: two adaptation layers",
      "rule": "Maintain estimates of volatility, retail flow, arbitrage probability and normalizer behavior from trade/pool history; also react to immediate pool price movements. Formula, state layout and constants not disclosed.",
      "quote": "two layers of adaptation",
      "url": "https://www.linkedin.com/pulse/amm-fee-challenge-notes-from-our-run-optimization-arena-qe3ff",
      "board": "Author claims peak #9/654; #12 at publication"
    },
    {
      "name": "Algebra: asymmetric protection",
      "rule": "Increase the fee toward the external price when retail displaces pool price, reducing arbitrage extraction while retaining retail. Numerical mapping and constants not disclosed.",
      "quote": "importance of asymmetric fees",
      "url": "https://www.linkedin.com/pulse/amm-fee-challenge-notes-from-our-run-optimization-arena-qe3ff",
      "board": "Same submission; peak #9/654 claimed"
    },
    {
      "name": "Algebra: within-block probability",
      "rule": "Use probabilistic block evolution because arbitrage can only be first and later retail count is unknown. No probability model or constants disclosed.",
      "quote": "probabilistic estimates",
      "url": "https://www.linkedin.com/pulse/amm-fee-challenge-notes-from-our-run-optimization-arena-qe3ff",
      "board": "Same submission; peak #9/654 claimed"
    },
    {
      "name": "Top-eight architecture diversity (organizer evidence)",
      "rule": "Brady reports neural-network, compact mathematical, many-constant and competitor-model implementations. No identities, exact policies, network architectures or weights disclosed; not executable rules.",
      "quote": "two black box neural networks",
      "url": "https://www.benedict.dev/optimization-arena-learnings",
      "board": "Top eight at time of April 9 article; no individual ranks or scores"
    },
    {
      "name": "Top-eight shared signals (organizer evidence)",
      "rule": "Estimate arb probability, skew using arb information, adjust widths to estimated simulation volatility and suppress outlier-induced skew. No formulas or constants disclosed.",
      "quote": "estimating probabilities of arb trades",
      "url": "https://www.benedict.dev/optimization-arena-learnings",
      "board": "Top eight collectively; no entrant mapping"
    },
    {
      "name": "YQ: adaptive shock gate and asymmetric toxicity",
      "rule": "Write-up: 11 state slots (fees, timestamp, direction, activity, pHat, sigmaHat, lambdaHat, sizeHat, toxEma, count); alpha_first=0.26; toxicity includes a cubic term; aligned trades add protection; attract stale discount exceeds protect shift; tail slopes protect=0.93, attract=0.955. Numerical gate, cubic coefficient and full arithmetic are in its cited Solidity, summarized separately below.",
      "quote": "Adaptive Shock Gate",
      "url": "https://raw.githubusercontent.com/jiayaoqijia/amm-challenge-yq/3e9dc7d5a6192c88b562a0f8d9c172ca566ec94d/README.md",
      "board": "Official score 523.21 claimed; no rank"
    },
    {
      "name": "YQ: implementation constants",
      "rule": "WAD arithmetic: pImplied=spot*(1-feeUsed) for isBuy, else spot/(1-feeUsed); update pHat with alpha=0.26 first-in-step, 0.05 later if relative return<=max(10*sigmaHat,0.03). Cubic toxicity coefficient 15000 BPS; aligned boost 2500 BPS*tradeRatio; stale shift 6850 BPS*toxSignal, attract multiplier 1.124; base 3 BPS; tail knee 500 BPS, slopes 0.93/0.955. These are selected source components, not a replacement for the full contract.",
      "quote": "uint256 constant PHAT_ALPHA = 260000000000000000;",
      "url": "https://raw.githubusercontent.com/jiayaoqijia/amm-challenge-yq/3e9dc7d5a6192c88b562a0f8d9c172ca566ec94d/contracts/src/Strategy.sol",
      "board": null
    },
    {
      "name": "SigmaAdaptive post-mortem: estimate state rather than classify trades",
      "rule": "Author gives toxicity=abs(spot-pHat)/pHat; gate=max(10*sigmaHat,3%); pHat alpha=0.26 on first-in-step and 0.05 subsequently; cubic term=15000 bps*tox^3; aligned boost=2500 bps*tradeRatio. State: pHat, sigmaHat, tox, dir, act. Reports pHat-removal ablation -0.42 and other features individually within noise; not independently reproduced as ablations here.",
      "quote": "The Winning Paradigm: State Estimation",
      "url": "https://raw.githubusercontent.com/dipankar/amm-challenge/c588ae6c47fc9af2063c9bb1f2efbeb0dd276dab/ANALYSIS.md",
      "board": "526.54 local claim, not verified leaderboard rank/score"
    },
    {
      "name": "CH reference: gated implied-price tracking",
      "rule": "State slots 0..10: bid,ask,lastTs,dirState,actEma,pHat,sigmaHat,lambdaHat,sizeHat,toxEma,stepTradeCount. pImplied=spot*(1-feeUsed) for isBuy, else spot/(1-feeUsed); pHat blend alpha=0.27 first-in-step or 0.06 later, gated by max(7.2*sigmaHat,0.03). Initial fee=4 BPS; sigmaHat=0.00095; lambdaHat=0.8; sizeHat=0.002. Source has quadratic toxicity, no cubic term. Full source is included if this is the best measured file.",
      "quote": "uint256 constant PHAT_ALPHA_RETAIL = 60000000000000000;",
      "url": "https://raw.githubusercontent.com/ChengHua926/amm-challenge/d34a5199c59a4c44d5336a25f1436b4ae1f21104/contracts/src/Strategy.sol",
      "board": null
    }
  ],
  "files": [
    {
      "url": "https://raw.githubusercontent.com/dipankar/amm-challenge/c588ae6c47fc9af2063c9bb1f2efbeb0dd276dab/contracts/src/SigmaAdaptiveStrategy.sol",
      "sha256": "84da373d4ecc47b5ecaa96adfcc432ad62825a0c608e7529404fa8a0184cdf90",
      "valid": true,
      "d32": -8.01644894093358,
      "oog": 0,
      "screen": {
        "n": 32,
        "mean_diff": -8.01644894093358,
        "se": 0.515870965236206,
        "worst": [
          {
            "seed": 900025,
            "diff": -17.895737224713457
          },
          {
            "seed": 900012,
            "diff": -13.059750628236316
          },
          {
            "seed": 900010,
            "diff": -12.752061965009034
          },
          {
            "seed": 900005,
            "diff": -11.942326408590702
          },
          {
            "seed": 900021,
            "diff": -11.046649032753635
          }
        ]
      },
      "gas32": {
        "max_ok": 148213,
        "oog": 0,
        "init_max": 176674,
        "reverts": 0,
        "other_halts": 0,
        "tx_errors": 0,
        "bad_returns": 0
      }
    },
    {
      "url": "https://raw.githubusercontent.com/ChengHua926/amm-challenge/d34a5199c59a4c44d5336a25f1436b4ae1f21104/contracts/src/Strategy.sol",
      "sha256": "6dd68f77a70900319460215374143dbd5d924198450a46d9f5f91f6b1e3d35c3",
      "valid": true,
      "d32": -1.9468584042492232,
      "oog": 0,
      "screen": {
        "n": 32,
        "mean_diff": -1.9468584042492232,
        "se": 0.20503310917898884,
        "worst": [
          {
            "seed": 900014,
            "diff": -4.306222491488484
          },
          {
            "seed": 900012,
            "diff": -3.7863019326727
          },
          {
            "seed": 900017,
            "diff": -3.763822195092075
          },
          {
            "seed": 900023,
            "diff": -3.572897158206729
          },
          {
            "seed": 900010,
            "diff": -3.3486129067644015
          }
        ]
      },
      "gas32": {
        "max_ok": 128929,
        "oog": 0,
        "init_max": 185532,
        "reverts": 0,
        "other_halts": 0,
        "tx_errors": 0,
        "bad_returns": 0
      }
    },
    {
      "url": "https://raw.githubusercontent.com/jiayaoqijia/amm-challenge-yq/3e9dc7d5a6192c88b562a0f8d9c172ca566ec94d/contracts/src/Strategy.sol",
      "sha256": "00fae418c49cd681ad0879c6f96ebed0163fab5a660b38030f11e6947a39afd4",
      "valid": true,
      "d32": -2.8743337699932106,
      "oog": 0,
      "screen": {
        "n": 32,
        "mean_diff": -2.8743337699932106,
        "se": 0.24043747036278731,
        "worst": [
          {
            "seed": 900005,
            "diff": -5.428194593183548
          },
          {
            "seed": 900022,
            "diff": -5.225871391006194
          },
          {
            "seed": 900017,
            "diff": -4.878984596833789
          },
          {
            "seed": 900010,
            "diff": -4.691139704285888
          },
          {
            "seed": 900025,
            "diff": -4.598732433260352
          }
        ]
      },
      "gas32": {
        "max_ok": 127893,
        "oog": 0,
        "init_max": 185532,
        "reverts": 0,
        "other_halts": 0,
        "tx_errors": 0,
        "bad_returns": 0
      }
    }
  ],
  "top3": [
    {
      "sha256": "6dd68f77a70900319460215374143dbd5d924198450a46d9f5f91f6b1e3d35c3",
      "url": "https://raw.githubusercontent.com/ChengHua926/amm-challenge/d34a5199c59a4c44d5336a25f1436b4ae1f21104/contracts/src/Strategy.sol",
      "paired": {
        "n": 256,
        "mean_diff": -1.8404066162914532,
        "se": 0.06979100904354843,
        "worst": [
          {
            "seed": 901156,
            "diff": -8.517896528998108
          },
          {
            "seed": 901180,
            "diff": -5.985494457703794
          },
          {
            "seed": 901048,
            "diff": -4.914895708905533
          },
          {
            "seed": 901142,
            "diff": -4.7297253625318945
          },
          {
            "seed": 901033,
            "diff": -4.402695654344257
          }
        ]
      },
      "retail_edge_delta": -0.008515070775243494,
      "arb_edge_delta": -1.831891545516214,
      "gas": {
        "max_ok": 151576,
        "oog": 0,
        "init_max": 185532,
        "reverts": 0,
        "other_halts": 0,
        "tx_errors": 0,
        "bad_returns": 0
      },
      "mechanism": "CH reference: gated implied-price tracking",
      "valid": true,
      "mean_edge": 531.8947526230002
    },
    {
      "sha256": "00fae418c49cd681ad0879c6f96ebed0163fab5a660b38030f11e6947a39afd4",
      "url": "https://raw.githubusercontent.com/jiayaoqijia/amm-challenge-yq/3e9dc7d5a6192c88b562a0f8d9c172ca566ec94d/contracts/src/Strategy.sol",
      "paired": {
        "n": 256,
        "mean_diff": -2.730905464885787,
        "se": 0.07757919730518127,
        "worst": [
          {
            "seed": 901156,
            "diff": -9.29795016706089
          },
          {
            "seed": 901180,
            "diff": -8.009805892983081
          },
          {
            "seed": 901133,
            "diff": -5.570670043617838
          },
          {
            "seed": 901204,
            "diff": -5.373609550495189
          },
          {
            "seed": 901048,
            "diff": -5.3075022238934935
          }
        ]
      },
      "retail_edge_delta": -1.8372431375745026,
      "arb_edge_delta": -0.8936623273112868,
      "gas": {
        "max_ok": 147039,
        "oog": 0,
        "init_max": 185532,
        "reverts": 0,
        "other_halts": 0,
        "tx_errors": 0,
        "bad_returns": 0
      },
      "mechanism": "YQ: adaptive shock gate and asymmetric toxicity",
      "valid": true,
      "mean_edge": 531.0042537744058
    },
    {
      "sha256": "84da373d4ecc47b5ecaa96adfcc432ad62825a0c608e7529404fa8a0184cdf90",
      "url": "https://raw.githubusercontent.com/dipankar/amm-challenge/c588ae6c47fc9af2063c9bb1f2efbeb0dd276dab/contracts/src/SigmaAdaptiveStrategy.sol",
      "paired": {
        "n": 256,
        "mean_diff": -7.964970098691098,
        "se": 0.2045763429268462,
        "worst": [
          {
            "seed": 901180,
            "diff": -43.041805616406464
          },
          {
            "seed": 901063,
            "diff": -31.917152397542736
          },
          {
            "seed": 901033,
            "diff": -14.532722939904147
          },
          {
            "seed": 901156,
            "diff": -13.981884028697664
          },
          {
            "seed": 901048,
            "diff": -13.009996739116445
          }
        ]
      },
      "retail_edge_delta": -0.7191316719923646,
      "arb_edge_delta": -7.245838426698733,
      "gas": {
        "max_ok": 172035,
        "oog": 0,
        "init_max": 176674,
        "reverts": 0,
        "other_halts": 0,
        "tx_errors": 0,
        "bad_returns": 0
      },
      "mechanism": "SigmaAdaptive post-mortem: estimate state rather than classify trades",
      "valid": true,
      "mean_edge": 525.7701891406006
    }
  ],
  "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 = 51000000000000000;\n    uint256 constant ACT_BLEND_DECAY = 985000000000000000;\n    uint256 constant PHAT_ALPHA = 270000000000000000;\n    uint256 constant PHAT_ALPHA_RETAIL = 60000000000000000;\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 = 3500 * BPS;\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 = 300 * BPS;\n    uint256 constant TOX_QUAD_COEF = 15000 * BPS;\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 = 6850 * BPS;\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;\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 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 (firstInStep) {\n                if (ret > RET_CAP) ret = RET_CAP;\n                sigmaHat = wmul(sigmaHat, SIGMA_DECAY) + wmul(ret, WAD - SIGMA_DECAY);\n            }\n        }\n\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",
  "sha256": "6dd68f77a70900319460215374143dbd5d924198450a46d9f5f91f6b1e3d35c3",
  "notes": {
    "searched": [
      "Web search for AMM challenge / AMM fee challenge / ammchallenge.com / Optimization Arena combined with writeup, write-up, blog, strategy, fees, podcast, talk and interview.",
      "Targeted current-leader names 0xMai and Ponxter; historical names houseofjiao, adrianleb / Adrian le Bas, josusanmartin / Josu San Martin and unhedged21.",
      "Searched indexed X posts and mirrors, LinkedIn, Medium, Substack, Reddit, Farcaster/warpcast and YouTube. Followed the YQ reference from dipankar’s research post-mortem."
    ],
    "not_found": [
      "No verified first-hand mechanism write-up by current leaders 0xMai or Ponxter, and no formula/code attributable to their current top scores.",
      "No entrant-specific talk, podcast, Reddit or Farcaster disclosure with an independently retrievable fee mechanism. Brady’s article links his own organizer talk/slides: https://www.benedict.dev/optimization-arena-learnings/slides ; no entrant talk transcript was recovered.",
      "Algebra provides qualitative mechanisms but not a reproducible policy; no code found in its article.",
      "Bruno I. profile surfaced in search indexing (https://hr.linkedin.com/in/bruno-i-8575b4b1), but direct fetch returned HTTP 999/authwall. Its mechanism and score details are withheld from verified sources/mechanisms, rather than presenting indexed snippets as freshly retrieved evidence.",
      "X search surfaced score-only announcements and speculative suggestions via mirrors. No adopted entrant fee formula was verified from a primary X post; none is promoted to a verified mechanism here.",
      "HackMD https://hackmd.io/6i1LNsRGRJ27YqTHjfO04A is an unattributed theory note, not an established entrant result. It is excluded from the entrant mechanisms and no policy is derived from it."
    ],
    "scope": "No strategy was designed, retuned or submitted. Source claims are attributed, not endorsed. Historical leaderboard claims are not current rankings. CH is the task-specified calibration reference, not a newly discovered write-up.",
    "setup": "Cloned the pinned simulator under test/scratch/amm-challenge; ran the supplied setup once. Wheel checksum passed; StarterStrategy validated. Executed none of the entrants’ scripts.",
    "method": "Independent arms: run_batch(candidate,VanillaStrategy,configs,8), then RS2 independently against VanillaStrategy on identical seeds. Config draws follow MatchRunner._build_configs; price seed=s, retail seed=s+1. 10000 steps. solc 0.8.24. Source bytes unchanged. Each source passes amm-match validate. Comparison is against RS2, not STACK; no claim of improvement over STACK is made.",
    "seeds": {
      "screen": "900000..900031 inclusive",
      "confirmation": "901000..901255 inclusive",
      "calibration": "CH only, 0..999 inclusive",
      "no_seeds_at_or_above_5000000": true
    },
    "selection": "Exactly three strategy sources were collected for scoring: SigmaAdaptive from its post-mortem, YQ from that post-mortem’s cited entrant write-up, and the task-specified CH reference. All three proceed to 256 seeds; no fourth candidate or parameter tuning. Best means largest paired mean, even if all lose.",
    "decomposition": "Retail and arb deltas are retrospective reconstruction from stored per-step fair prices, previous spot and fees using pinned closed-form arb profit, as in the supplied harness. Retail=total edge-arb. Initial fees: SigmaAdaptive/YQ 3 bps, CH/RS2 4 bps. These are analysis inputs only; no strategy observes fair prices.",
    "gas": "Counters come from amm_sim_rs.gas_stats() after reset for each 16-seed chunk, for each independent arm. max_ok is the maximum Submission afterSwap successful gas across all chunks; oog sums Submission afterInitialize/afterSwap OOG. Extra counter fields record other halts. Any candidate OOG invalidates it.",
    "rs2_gas256": {
      "max_ok": 202386,
      "oog": 0,
      "init_max": 243099,
      "reverts": 0,
      "other_halts": 0,
      "tx_errors": 0,
      "bad_returns": 0
    },
    "rs2_gas32": {
      "max_ok": 197184,
      "oog": 0,
      "init_max": 243099,
      "reverts": 0,
      "other_halts": 0,
      "tx_errors": 0,
      "bad_returns": 0
    },
    "rs2_mean_edge256": 533.7351592392916,
    "CH_calibration": {
      "n": 1000,
      "mean_edge": 525.5258821780834,
      "sha256": "6dd68f77a70900319460215374143dbd5d924198450a46d9f5f91f6b1e3d35c3"
    },
    "decomposition_reconciliation_max_abs": 4.218847493575595e-15
  },
  "code_url": "https://raw.githubusercontent.com/ChengHua926/amm-challenge/d34a5199c59a4c44d5336a25f1436b4ae1f21104/contracts/src/Strategy.sol"
}
