Merge pull request 'fix: feat: red-team agent should read LM and optimizer Solidity source (#821)' (#828) from fix/issue-821 into master

This commit is contained in:
johba 2026-03-15 15:57:21 +01:00
commit 963c0d316a

View file

@ -315,6 +315,15 @@ log " lm_eth_before = $LM_ETH_BEFORE wei"
# ── 6. Build agent prompt ──────────────────────────────────────────────────────
# ── 6a. Read Solidity source files (reflect the current candidate after inject) ─
ONCHAIN_SRC="$REPO_ROOT/onchain/src"
SOL_LM=$(< "$ONCHAIN_SRC/LiquidityManager.sol")
SOL_THREE_POS=$(< "$ONCHAIN_SRC/abstracts/ThreePositionStrategy.sol")
SOL_OPTIMIZER=$(< "$ONCHAIN_SRC/Optimizer.sol")
SOL_OPTIMIZERV3=$(< "$ONCHAIN_SRC/OptimizerV3.sol")
SOL_VWAP=$(< "$ONCHAIN_SRC/VWAPTracker.sol")
SOL_PRICE_ORACLE=$(< "$ONCHAIN_SRC/abstracts/PriceOracle.sol")
# Build Previous Findings section from memory file
MEMORY_SECTION=""
if [[ -f "$MEMORY_FILE" && -s "$MEMORY_FILE" ]]; then
@ -433,6 +442,44 @@ feeDestination is set to LM itself, so its KRK is already excluded by outstandin
---
## Source Code (read-only reference)
Use the source code below to reason about internal state transitions, edge cases in tick math,
exact mint/burn logic, optimizer parameter effects, and floor formula details.
Do NOT attempt to deploy or modify contracts — these are for reference only.
### LiquidityManager.sol
\`\`\`solidity
${SOL_LM}
\`\`\`
### ThreePositionStrategy.sol
\`\`\`solidity
${SOL_THREE_POS}
\`\`\`
### Optimizer.sol (base)
\`\`\`solidity
${SOL_OPTIMIZER}
\`\`\`
### OptimizerV3.sol (current candidate — reflects inject.sh output)
\`\`\`solidity
${SOL_OPTIMIZERV3}
\`\`\`
### VWAPTracker.sol
\`\`\`solidity
${SOL_VWAP}
\`\`\`
### PriceOracle.sol
\`\`\`solidity
${SOL_PRICE_ORACLE}
\`\`\`
---
## Cast command patterns
### Check total LM ETH (run after each strategy)