recorded fuzzing

This commit is contained in:
johba 2025-08-18 22:09:03 +02:00
parent 85cc8191be
commit 7eef96f366
25 changed files with 56 additions and 6468 deletions

View file

@ -30,6 +30,9 @@ contract ImprovedFuzzingAnalysis is Test, CSVManager {
LiquidityManager lm;
bool token0isWeth;
// Reusable swap executor to avoid repeated deployments
SwapExecutor swapExecutor;
address account = makeAddr("trader");
address whale = makeAddr("whale");
address feeDestination = makeAddr("fees");
@ -87,15 +90,23 @@ contract ImprovedFuzzingAnalysis is Test, CSVManager {
vm.prank(whale);
weth.deposit{value: whaleFund}();
// Create SwapExecutor once per scenario to avoid repeated deployments
swapExecutor = new SwapExecutor(pool, weth, harberg, token0isWeth);
uint256 initialBalance = weth.balanceOf(account);
// Initial recenter
vm.prank(feeDestination);
lm.recenter();
// Initialize position tracking
// Initialize position tracking (skip CSV init if already done)
if (trackPositions) {
initializePositionsCSV();
if (seed == 0) {
// Only initialize CSV for first seed if not already initialized
if (bytes(csv).length == 0) {
initializePositionsCSV();
}
}
_recordPositionData("Initial");
}
@ -402,21 +413,19 @@ contract ImprovedFuzzingAnalysis is Test, CSVManager {
function _executeBuy(address buyer, uint256 amount) internal virtual {
if (amount == 0 || weth.balanceOf(buyer) < amount) return;
SwapExecutor executor = new SwapExecutor(pool, weth, harberg, token0isWeth);
vm.prank(buyer);
weth.transfer(address(executor), amount);
weth.transfer(address(swapExecutor), amount);
try executor.executeBuy(amount, buyer) {} catch {}
try swapExecutor.executeBuy(amount, buyer) {} catch {}
}
function _executeSell(address seller, uint256 amount) internal virtual {
if (amount == 0 || harberg.balanceOf(seller) < amount) return;
SwapExecutor executor = new SwapExecutor(pool, weth, harberg, token0isWeth);
vm.prank(seller);
harberg.transfer(address(executor), amount);
harberg.transfer(address(swapExecutor), amount);
try executor.executeSell(amount, seller) {} catch {}
try swapExecutor.executeSell(amount, seller) {} catch {}
}
function _getOptimizerByClass(string memory class) internal returns (address) {

View file

@ -13,6 +13,9 @@ contract RecordedFuzzingAnalysis is ImprovedFuzzingAnalysis {
ScenarioRecorder public recorder;
bool public enableRecording = true;
string public runId; // Unique identifier for this run
bool private isRecordingProfitable; // Only record if scenario is profitable
// Constructor removed - set trackPositions in run() instead
// Store actions for current scenario
struct ActionRecord {
@ -32,42 +35,29 @@ contract RecordedFuzzingAnalysis is ImprovedFuzzingAnalysis {
// Get run ID from environment or generate default
runId = vm.envOr("RUN_ID", string("LOCAL"));
// Force position tracking to be enabled for CSV generation
vm.setEnv("TRACK_POSITIONS", "true");
console.log("=== RECORDED Fuzzing Analysis ===");
console.log(string.concat("Run ID: ", runId));
console.log("Recording enabled for profitable scenario replay");
super.run();
}
// Override to add recording for profitable scenarios
function _runImprovedScenario(uint256 seed) internal override returns (uint256 finalBalance, bool reachedDiscovery) {
// Initialize recorder for this scenario
if (enableRecording) {
recorder = new ScenarioRecorder();
// Always track positions when recording to generate CSV for visualizer
trackPositions = true;
recorder.initializeScenario(
seed,
optimizerClass,
200 ether, // LM initial ETH
weth.balanceOf(account) + weth.balanceOf(whale), // Total trader ETH
token0isWeth,
10000 // Pool fee
);
delete currentActions; // Clear previous scenario
}
// Clear previous scenario
delete currentActions;
isRecordingProfitable = false;
// Record initial state
_recordState("INITIAL", address(0), 0);
// Run the scenario with recording
// Run the base scenario
(finalBalance, reachedDiscovery) = super._runImprovedScenario(seed);
// Record final state
_recordState("FINAL", address(0), 0);
// If profitable, export the recording
uint256 initialBalance = 50 ether; // Approximate initial
if (finalBalance > initialBalance && enableRecording) {
_exportScenario(seed, initialBalance, finalBalance, reachedDiscovery);
// Export summary if profitable
uint256 initialBalance = 50 ether;
if (finalBalance > initialBalance && reachedDiscovery) {
_exportSummary(seed, initialBalance, finalBalance, reachedDiscovery);
}
return (finalBalance, reachedDiscovery);
@ -79,22 +69,13 @@ contract RecordedFuzzingAnalysis is ImprovedFuzzingAnalysis {
(, int24 tickBefore,,,,,) = pool.slot0();
// Record pre-state
if (enableRecording) {
_recordState("PRE_BUY", buyer, amount);
recorder.recordBuy(buyer, amount, 0, 0);
}
// Execute trade
super._executeBuy(buyer, amount);
(, int24 tickAfter,,,,,) = pool.slot0();
// Record post-state and action
if (enableRecording) {
_recordState("POST_BUY", buyer, amount);
_recordAction("BUY", buyer, amount, tickBefore, tickAfter);
}
// Only record action summary (not full state)
_recordAction("BUY", buyer, amount, tickBefore, tickAfter);
}
function _executeSell(address seller, uint256 amount) internal override {
@ -102,22 +83,13 @@ contract RecordedFuzzingAnalysis is ImprovedFuzzingAnalysis {
(, int24 tickBefore,,,,,) = pool.slot0();
// Record pre-state
if (enableRecording) {
_recordState("PRE_SELL", seller, amount);
recorder.recordSell(seller, amount, 0, 0);
}
// Execute trade
super._executeSell(seller, amount);
(, int24 tickAfter,,,,,) = pool.slot0();
// Record post-state and action
if (enableRecording) {
_recordState("POST_SELL", seller, amount);
_recordAction("SELL", seller, amount, tickBefore, tickAfter);
}
// Only record action summary (not full state)
_recordAction("SELL", seller, amount, tickBefore, tickAfter);
}
// Override each strategy to add recenter recording
@ -163,25 +135,19 @@ contract RecordedFuzzingAnalysis is ImprovedFuzzingAnalysis {
function _executeRecenter() internal {
(, int24 tickBefore,,,,,) = pool.slot0();
if (enableRecording) {
_recordState("PRE_RECENTER", feeDestination, 0);
recorder.recordRecenter(feeDestination, tx.gasprice);
}
vm.warp(block.timestamp + 1 hours);
vm.prank(feeDestination);
try lm.recenter() {} catch {}
(, int24 tickAfter,,,,,) = pool.slot0();
if (enableRecording) {
_recordState("POST_RECENTER", feeDestination, 0);
_recordAction("RECENTER", feeDestination, 0, tickBefore, tickAfter);
}
// Only record action summary
_recordAction("RECENTER", feeDestination, 0, tickBefore, tickAfter);
}
function _recordState(string memory label, address actor, uint256 amount) internal {
if (!enableRecording) return;
// Only record states if we're exporting a profitable scenario
if (!isRecordingProfitable || !enableRecording) return;
(uint160 sqrtPriceX96, int24 currentTick,,,,,) = pool.slot0();
@ -193,17 +159,6 @@ contract RecordedFuzzingAnalysis is ImprovedFuzzingAnalysis {
0, // VWAP placeholder
harberg.outstandingSupply()
);
// Also record optimizer params if during recenter
if (keccak256(bytes(label)) == keccak256("POST_RECENTER")) {
// Get optimizer params (simplified - would need actual values)
recorder.recordOptimizerParams(
5e17, // capitalInefficiency placeholder
5e17, // anchorShare placeholder
50, // anchorWidth placeholder
5e17 // discoveryDepth placeholder
);
}
}
function _recordAction(
@ -225,7 +180,7 @@ contract RecordedFuzzingAnalysis is ImprovedFuzzingAnalysis {
}));
}
function _exportScenario(
function _exportSummary(
uint256 seed,
uint256 initialBalance,
uint256 finalBalance,
@ -235,23 +190,6 @@ contract RecordedFuzzingAnalysis is ImprovedFuzzingAnalysis {
console.log(string.concat(" Run ID: ", runId));
console.log(string.concat(" Seed: ", vm.toString(seed)));
// Export as JSON
string memory json = recorder.exportToJson();
string memory jsonFilename = string.concat(
"recorded_scenario_seed", vm.toString(seed), ".json"
);
vm.writeFile(jsonFilename, json);
console.log(string.concat(" JSON exported to: ", jsonFilename));
// Also export simplified replay script
string memory replayScript = _generateReplayScript(seed);
string memory scriptFilename = string.concat(
"replay_script_seed", vm.toString(seed), ".sol"
);
vm.writeFile(scriptFilename, replayScript);
console.log(string.concat(" Replay script exported to: ", scriptFilename));
// Export action summary with Run ID
string memory summary = _generateActionSummary(
seed,
initialBalance,
@ -263,6 +201,15 @@ contract RecordedFuzzingAnalysis is ImprovedFuzzingAnalysis {
);
vm.writeFile(summaryFilename, summary);
console.log(string.concat(" Summary exported to: ", summaryFilename));
if (currentActions.length > 0) {
string memory replayScript = _generateReplayScript(seed);
string memory scriptFilename = string.concat(
"replay_script_seed", vm.toString(seed), ".sol"
);
vm.writeFile(scriptFilename, replayScript);
console.log(string.concat(" Replay script exported to: ", scriptFilename));
}
}
function _generateReplayScript(uint256 seed) internal view returns (string memory) {

View file

@ -59,10 +59,10 @@ echo -e "${YELLOW}Starting recorded fuzzing analysis...${NC}"
FUZZING_RUNS=$RUNS_VALUE \
OPTIMIZER_CLASS=$OPTIMIZER \
RUN_ID=$RUN_ID \
forge script analysis/RecordedFuzzingAnalysis.s.sol:RecordedFuzzingAnalysis --disable-block-gas-limit -vv 2>&1 | tee $OUTPUT_DIR/fuzzing.log
forge script analysis/RecordedFuzzingAnalysis.s.sol:RecordedFuzzingAnalysis --gas-limit 1000000000 -vv 2>&1 | tee $OUTPUT_DIR/fuzzing.log
# Check for generated scenario files
SCENARIO_COUNT=$(ls -1 recorded_scenario_*.json 2>/dev/null | wc -l)
# Check for generated scenario files (check for summaries, they're always generated)
SCENARIO_COUNT=$(ls -1 scenario_summary_seed*.txt 2>/dev/null | wc -l)
if [ $SCENARIO_COUNT -gt 0 ]; then
echo ""
@ -176,6 +176,7 @@ if [ $POSITION_CSV_COUNT -gt 0 ] && [ $SCENARIO_COUNT -gt 0 ]; then
fi
# Use absolute path for the symlink
ln -s "$(realpath $FIRST_CSV)" "$TEMP_LINK"
echo "Created symlink: $TEMP_LINK -> $FIRST_CSV"
# Check if server is already running on common ports
SERVER_RUNNING=false

View file

@ -3,7 +3,7 @@ src = "src"
out = "out"
libs = ["lib"]
fs_permissions = [{ access = "read-write", path = "./"}]
gas_limit = 100_000_000
gas_limit = 1_000_000_000
gas_price = 0
optimizer = true
optimizer_runs = 200

View file

@ -1,5 +0,0 @@
MassiveBuy,119273,127400,127600,25563614720653619409,120200,127400,152183492855657924602025,109200,120200,2325025585294773848086493,true
WhaleDump,120090,127400,127600,25563614720653619409,120200,127400,152183492855657924602025,109200,120200,2325025585294773848086493,true
Discovery_Reached,119012,124800,125000,35441680661270157275,117600,124800,161630528569314481719245,106600,117600,2469355297586749026266243,true
Final,123585,124800,125000,35441680661270157275,117600,124800,161630528569314481719245,106600,117600,2469355297586749026266243,true
1 MassiveBuy 119273 127400 127600 25563614720653619409 120200 127400 152183492855657924602025 109200 120200 2325025585294773848086493 true
2 WhaleDump 120090 127400 127600 25563614720653619409 120200 127400 152183492855657924602025 109200 120200 2325025585294773848086493 true
3 Discovery_Reached 119012 124800 125000 35441680661270157275 117600 124800 161630528569314481719245 106600 117600 2469355297586749026266243 true
4 Final 123585 124800 125000 35441680661270157275 117600 124800 161630528569314481719245 106600 117600 2469355297586749026266243 true

View file

@ -1,7 +0,0 @@
precedingAction, currentTick, floorTickLower, floorTickUpper, floorLiquidity, anchorTickLower, anchorTickUpper, anchorLiquidity, discoveryTickLower, discoveryTickUpper, discoveryLiquidity, token0isWeth
Initial,-123891,-127600,-127400,25561339163394654594,-127400,-120200,152230779095623270236377,-120200,-109200,2325748013960911073055759,false
Whale_0,-121593,-127600,-127400,25561339163394654594,-127400,-120200,152230779095623270236377,-120200,-109200,2325748013960911073055759,false
Whale_2,-119901,-127600,-127400,25561339163394654594,-127400,-120200,152230779095623270236377,-120200,-109200,2325748013960911073055759,false
Whale_4,-119608,-127600,-127400,25561339163394654594,-127400,-120200,152230779095623270236377,-120200,-109200,2325748013960911073055759,false
Discovery_Reached,-119608,-127600,-127400,25561339163394654594,-127400,-120200,152230779095623270236377,-120200,-109200,2325748013960911073055759,false
Final,-119663,-127600,-127400,25561339163394654594,-127400,-120200,152230779095623270236377,-120200,-109200,2325748013960911073055759,false
1 precedingAction currentTick floorTickLower floorTickUpper floorLiquidity anchorTickLower anchorTickUpper anchorLiquidity discoveryTickLower discoveryTickUpper discoveryLiquidity token0isWeth
2 Initial -123891 -127600 -127400 25561339163394654594 -127400 -120200 152230779095623270236377 -120200 -109200 2325748013960911073055759 false
3 Whale_0 -121593 -127600 -127400 25561339163394654594 -127400 -120200 152230779095623270236377 -120200 -109200 2325748013960911073055759 false
4 Whale_2 -119901 -127600 -127400 25561339163394654594 -127400 -120200 152230779095623270236377 -120200 -109200 2325748013960911073055759 false
5 Whale_4 -119608 -127600 -127400 25561339163394654594 -127400 -120200 152230779095623270236377 -120200 -109200 2325748013960911073055759 false
6 Discovery_Reached -119608 -127600 -127400 25561339163394654594 -127400 -120200 152230779095623270236377 -120200 -109200 2325748013960911073055759 false
7 Final -119663 -127600 -127400 25561339163394654594 -127400 -120200 152230779095623270236377 -120200 -109200 2325748013960911073055759 false

View file

@ -1,20 +0,0 @@
Recorded Fuzzing Results
========================
Run ID: 250818-JY0U
Date: Mo 18. Aug 21:09:58 CEST 2025
Optimizer: BullMarketOptimizer
Total Runs: 20
Profitable Scenarios: 2
Files:
------
- fuzzing.log
- improved_positions_BullMarketOptimizer_0.csv
- improved_positions_BullMarketOptimizer_1.csv
- index.txt
- replay_250818-JY0U_seed0.sol
- replay_250818-JY0U_seed1.sol
- scenario_250818-JY0U_seed0.json
- scenario_250818-JY0U_seed1.json
- summary_250818-JY0U_seed0.txt
- summary_250818-JY0U_seed1.txt

View file

@ -1,37 +0,0 @@
// Replay script for profitable scenario
// Seed: 0
// Optimizer: BullMarketOptimizer
// Discovery reached: YES
function replayScenario() public {
// Step 0
_executeBuy(trader, 93019778485341734687);
// Tick moved from 123890 to 120098
// Step 1
_executeBuy(whale, 244025272055601196358);
// Tick moved from 120098 to 119273
// Step 2
_executeSell(whale, 38079345162363541473731623);
// Tick moved from 119273 to 120090
// Step 3
_executeSell(trader, 8686624801143060187044758);
// Tick moved from 120090 to 121269
// Step 4
vm.warp(3601);
vm.prank(feeDestination);
lm.recenter();
// Tick moved from 121269 to 121269
// Step 5
_executeBuy(trader, 45396259308851266436);
// Tick moved from 121269 to 119012
// Step 6
_executeSell(trader, 16100675243303605610895622);
// Tick moved from 119012 to 123585
}

View file

@ -1,43 +0,0 @@
// Replay script for profitable scenario
// Seed: 1
// Optimizer: BullMarketOptimizer
// Discovery reached: YES
function replayScenario() public {
// Step 0
_executeBuy(trader, 38215432537912335624);
// Tick moved from -123891 to -121593
// Step 1
_executeSell(trader, 2023617577713031308513047);
// Tick moved from -121593 to -122186
// Step 2
_executeBuy(whale, 132122625892942968181);
// Tick moved from -122186 to -119869
// Step 3
_executeSell(trader, 1517713183284773481384785);
// Tick moved from -119869 to -119901
// Step 4
_executeBuy(whale, 66061312946471484091);
// Tick moved from -119901 to -119677
// Step 5
_executeSell(trader, 1138284887463580111038589);
// Tick moved from -119677 to -119701
// Step 6
_executeBuy(whale, 33030656473235742045);
// Tick moved from -119701 to -119590
// Step 7
_executeSell(trader, 853713665597685083278941);
// Tick moved from -119590 to -119608
// Step 8
_executeSell(trader, 2561140996793055249836826);
// Tick moved from -119608 to -119663
}

View file

@ -1 +0,0 @@
{"scenario":{"seed":0,"optimizer":"BullMarketOptimizer","initialEth":"200000000000000000000","traderInitialEth":"437916987905703973573","startTimestamp":1,"startBlock":1,"token0isWeth":true,"poolFee":10000},"actions":[{"step":0,"type":"BUY","timestamp":1,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"132885397836202478125","traderKraiken":"0","currentTick":123890,"poolPrice":"38813714283599478074587411019430","vwap":"0","outstandingSupply":"413226953999797390248100716"}},{"step":1,"type":"BUY","timestamp":1,"block":1,"actor":"0x9e3AD1ae79015470ed3CfF3E062E4B3EAF11a797","preState":{"traderWeth":"39865619350860743438","traderKraiken":"17373249602286120374089516","currentTick":120098,"poolPrice":"32110464384401727662944198120161","vwap":"0","outstandingSupply":"413226953999797390248100716"}},{"step":2,"type":"SELL","timestamp":1,"block":1,"actor":"0x9e3AD1ae79015470ed3CfF3E062E4B3EAF11a797","preState":{"traderWeth":"39865619350860743438","traderKraiken":"17373249602286120374089516","currentTick":119273,"poolPrice":"30812862944640364687227822880556","vwap":"0","outstandingSupply":"413226953999797390248100716"}},{"step":3,"type":"SELL","timestamp":1,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"39865619350860743438","traderKraiken":"17373249602286120374089516","currentTick":120090,"poolPrice":"32097488370004114033187034337888","vwap":"0","outstandingSupply":"413226953999797390248100716"}},{"step":4,"type":"RECENTER","timestamp":1,"block":1,"actor":"0xA4E6160eF2Ee2E58Bf1aC59ad85D5e6a6Cf811e4","preState":{"traderWeth":"90792518617702532872","traderKraiken":"8686624801143060187044758","currentTick":121269,"poolPrice":"34047907384835713843150791308680","vwap":"0","outstandingSupply":"413226953999797390248100716"}},{"step":5,"type":"BUY","timestamp":3601,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"90792518617702532872","traderKraiken":"8686624801143060187044758","currentTick":121269,"poolPrice":"34047907384835713843150791308680","vwap":"0","outstandingSupply":"394463856810240134113940061"}},{"step":6,"type":"SELL","timestamp":3601,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"45396259308851266436","traderKraiken":"16100675243303605610895622","currentTick":119012,"poolPrice":"30413683092433275221583921948281","vwap":"0","outstandingSupply":"394463856810240134113940061"}}]}

View file

@ -1 +0,0 @@
{"scenario":{"seed":1,"optimizer":"BullMarketOptimizer","initialEth":"200000000000000000000","traderInitialEth":"417106981937535278860","startTimestamp":3601,"startBlock":1,"token0isWeth":false,"poolFee":10000},"actions":[{"step":0,"type":"BUY","timestamp":5401,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"152861730151649342497","traderKraiken":"0","currentTick":-123891,"poolPrice":"161723773678779450733783246","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":1,"type":"SELL","timestamp":5401,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"114646297613737006873","traderKraiken":"8094470310852125234052188","currentTick":-121593,"poolPrice":"181414017218734744871703229","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":2,"type":"BUY","timestamp":5401,"block":1,"actor":"0x9e3AD1ae79015470ed3CfF3E062E4B3EAF11a797","preState":{"traderWeth":"124842831271889337408","traderKraiken":"6070852733139093925539141","currentTick":-122186,"poolPrice":"176107254482909757175841776","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":3,"type":"SELL","timestamp":5401,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"124842831271889337408","traderKraiken":"6070852733139093925539141","currentTick":-119869,"poolPrice":"197743845112692177382153477","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":4,"type":"BUY","timestamp":5401,"block":1,"actor":"0x9e3AD1ae79015470ed3CfF3E062E4B3EAF11a797","preState":{"traderWeth":"134187673424715730835","traderKraiken":"4553139549854320444154356","currentTick":-119901,"poolPrice":"197425506811074811873956860","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":5,"type":"SELL","timestamp":5401,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"134187673424715730835","traderKraiken":"4553139549854320444154356","currentTick":-119677,"poolPrice":"199653425417280065710376340","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":6,"type":"BUY","timestamp":5401,"block":1,"actor":"0x9e3AD1ae79015470ed3CfF3E062E4B3EAF11a797","preState":{"traderWeth":"141335114312326533197","traderKraiken":"3414854662390740333115767","currentTick":-119701,"poolPrice":"199409943060289759425132754","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":7,"type":"SELL","timestamp":5401,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"141335114312326533197","traderKraiken":"3414854662390740333115767","currentTick":-119590,"poolPrice":"200523902363392386343308428","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":8,"type":"SELL","timestamp":5401,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"146744168046319825366","traderKraiken":"2561140996793055249836826","currentTick":-119608,"poolPrice":"200339639328139758352135908","vwap":"0","outstandingSupply":"413355367821089080069727544"}}]}

View file

@ -1,21 +0,0 @@
=== PROFITABLE SCENARIO SUMMARY ===
Run ID: 250818-JY0U
Seed: 0
Optimizer: BullMarketOptimizer
Discovery Reached: YES
Financial Results:
Initial Balance: 50 ETH
Final Balance: 131 ETH
Profit: 81 ETH (162%)
Action Sequence:
1. BUY - Trader - Amount: 93 ETH - Tick: 123890 -> 120098
2. BUY - Whale - Amount: 244 ETH - Tick: 120098 -> 119273
3. SELL - Whale - Amount: 38079345 ETH - Tick: 119273 -> 120090
4. SELL - Trader - Amount: 8686624 ETH - Tick: 120090 -> 121269
5. RECENTER - System - Tick: 121269 -> 121269
6. BUY - Trader - Amount: 45 ETH - Tick: 121269 -> 119012
7. SELL - Trader - Amount: 16100675 ETH - Tick: 119012 -> 123585
This scenario can be replayed using the generated replay script.

View file

@ -1,23 +0,0 @@
=== PROFITABLE SCENARIO SUMMARY ===
Run ID: 250818-JY0U
Seed: 1
Optimizer: BullMarketOptimizer
Discovery Reached: YES
Financial Results:
Initial Balance: 50 ETH
Final Balance: 162 ETH
Profit: 112 ETH (225%)
Action Sequence:
1. BUY - Trader - Amount: 38 ETH - Tick: -123891 -> -121593
2. SELL - Trader - Amount: 2023617 ETH - Tick: -121593 -> -122186
3. BUY - Whale - Amount: 132 ETH - Tick: -122186 -> -119869
4. SELL - Trader - Amount: 1517713 ETH - Tick: -119869 -> -119901
5. BUY - Whale - Amount: 66 ETH - Tick: -119901 -> -119677
6. SELL - Trader - Amount: 1138284 ETH - Tick: -119677 -> -119701
7. BUY - Whale - Amount: 33 ETH - Tick: -119701 -> -119590
8. SELL - Trader - Amount: 853713 ETH - Tick: -119590 -> -119608
9. SELL - Trader - Amount: 2561140 ETH - Tick: -119608 -> -119663
This scenario can be replayed using the generated replay script.

View file

@ -1,5 +0,0 @@
MassiveBuy,119273,127400,127600,25563614720653619409,120200,127400,152183492855657924602025,109200,120200,2325025585294773848086493,true
WhaleDump,120090,127400,127600,25563614720653619409,120200,127400,152183492855657924602025,109200,120200,2325025585294773848086493,true
Discovery_Reached,119012,124800,125000,35441680661270157275,117600,124800,161630528569314481719245,106600,117600,2469355297586749026266243,true
Final,123585,124800,125000,35441680661270157275,117600,124800,161630528569314481719245,106600,117600,2469355297586749026266243,true
1 MassiveBuy 119273 127400 127600 25563614720653619409 120200 127400 152183492855657924602025 109200 120200 2325025585294773848086493 true
2 WhaleDump 120090 127400 127600 25563614720653619409 120200 127400 152183492855657924602025 109200 120200 2325025585294773848086493 true
3 Discovery_Reached 119012 124800 125000 35441680661270157275 117600 124800 161630528569314481719245 106600 117600 2469355297586749026266243 true
4 Final 123585 124800 125000 35441680661270157275 117600 124800 161630528569314481719245 106600 117600 2469355297586749026266243 true

View file

@ -1,7 +0,0 @@
precedingAction, currentTick, floorTickLower, floorTickUpper, floorLiquidity, anchorTickLower, anchorTickUpper, anchorLiquidity, discoveryTickLower, discoveryTickUpper, discoveryLiquidity, token0isWeth
Initial,-123891,-127600,-127400,25561339163394654594,-127400,-120200,152230779095623270236377,-120200,-109200,2325748013960911073055759,false
Whale_0,-121593,-127600,-127400,25561339163394654594,-127400,-120200,152230779095623270236377,-120200,-109200,2325748013960911073055759,false
Whale_2,-119901,-127600,-127400,25561339163394654594,-127400,-120200,152230779095623270236377,-120200,-109200,2325748013960911073055759,false
Whale_4,-119608,-127600,-127400,25561339163394654594,-127400,-120200,152230779095623270236377,-120200,-109200,2325748013960911073055759,false
Discovery_Reached,-119608,-127600,-127400,25561339163394654594,-127400,-120200,152230779095623270236377,-120200,-109200,2325748013960911073055759,false
Final,-119663,-127600,-127400,25561339163394654594,-127400,-120200,152230779095623270236377,-120200,-109200,2325748013960911073055759,false
1 precedingAction currentTick floorTickLower floorTickUpper floorLiquidity anchorTickLower anchorTickUpper anchorLiquidity discoveryTickLower discoveryTickUpper discoveryLiquidity token0isWeth
2 Initial -123891 -127600 -127400 25561339163394654594 -127400 -120200 152230779095623270236377 -120200 -109200 2325748013960911073055759 false
3 Whale_0 -121593 -127600 -127400 25561339163394654594 -127400 -120200 152230779095623270236377 -120200 -109200 2325748013960911073055759 false
4 Whale_2 -119901 -127600 -127400 25561339163394654594 -127400 -120200 152230779095623270236377 -120200 -109200 2325748013960911073055759 false
5 Whale_4 -119608 -127600 -127400 25561339163394654594 -127400 -120200 152230779095623270236377 -120200 -109200 2325748013960911073055759 false
6 Discovery_Reached -119608 -127600 -127400 25561339163394654594 -127400 -120200 152230779095623270236377 -120200 -109200 2325748013960911073055759 false
7 Final -119663 -127600 -127400 25561339163394654594 -127400 -120200 152230779095623270236377 -120200 -109200 2325748013960911073055759 false

View file

@ -1,20 +0,0 @@
Recorded Fuzzing Results
========================
Run ID: 250818-WAER
Date: Mo 18. Aug 21:10:41 CEST 2025
Optimizer: BullMarketOptimizer
Total Runs: 20
Profitable Scenarios: 2
Files:
------
- fuzzing.log
- improved_positions_BullMarketOptimizer_0.csv
- improved_positions_BullMarketOptimizer_1.csv
- index.txt
- replay_250818-WAER_seed0.sol
- replay_250818-WAER_seed1.sol
- scenario_250818-WAER_seed0.json
- scenario_250818-WAER_seed1.json
- summary_250818-WAER_seed0.txt
- summary_250818-WAER_seed1.txt

View file

@ -1,37 +0,0 @@
// Replay script for profitable scenario
// Seed: 0
// Optimizer: BullMarketOptimizer
// Discovery reached: YES
function replayScenario() public {
// Step 0
_executeBuy(trader, 93019778485341734687);
// Tick moved from 123890 to 120098
// Step 1
_executeBuy(whale, 244025272055601196358);
// Tick moved from 120098 to 119273
// Step 2
_executeSell(whale, 38079345162363541473731623);
// Tick moved from 119273 to 120090
// Step 3
_executeSell(trader, 8686624801143060187044758);
// Tick moved from 120090 to 121269
// Step 4
vm.warp(3601);
vm.prank(feeDestination);
lm.recenter();
// Tick moved from 121269 to 121269
// Step 5
_executeBuy(trader, 45396259308851266436);
// Tick moved from 121269 to 119012
// Step 6
_executeSell(trader, 16100675243303605610895622);
// Tick moved from 119012 to 123585
}

View file

@ -1,43 +0,0 @@
// Replay script for profitable scenario
// Seed: 1
// Optimizer: BullMarketOptimizer
// Discovery reached: YES
function replayScenario() public {
// Step 0
_executeBuy(trader, 38215432537912335624);
// Tick moved from -123891 to -121593
// Step 1
_executeSell(trader, 2023617577713031308513047);
// Tick moved from -121593 to -122186
// Step 2
_executeBuy(whale, 132122625892942968181);
// Tick moved from -122186 to -119869
// Step 3
_executeSell(trader, 1517713183284773481384785);
// Tick moved from -119869 to -119901
// Step 4
_executeBuy(whale, 66061312946471484091);
// Tick moved from -119901 to -119677
// Step 5
_executeSell(trader, 1138284887463580111038589);
// Tick moved from -119677 to -119701
// Step 6
_executeBuy(whale, 33030656473235742045);
// Tick moved from -119701 to -119590
// Step 7
_executeSell(trader, 853713665597685083278941);
// Tick moved from -119590 to -119608
// Step 8
_executeSell(trader, 2561140996793055249836826);
// Tick moved from -119608 to -119663
}

View file

@ -1 +0,0 @@
{"scenario":{"seed":0,"optimizer":"BullMarketOptimizer","initialEth":"200000000000000000000","traderInitialEth":"437916987905703973573","startTimestamp":1,"startBlock":1,"token0isWeth":true,"poolFee":10000},"actions":[{"step":0,"type":"BUY","timestamp":1,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"132885397836202478125","traderKraiken":"0","currentTick":123890,"poolPrice":"38813714283599478074587411019430","vwap":"0","outstandingSupply":"413226953999797390248100716"}},{"step":1,"type":"BUY","timestamp":1,"block":1,"actor":"0x9e3AD1ae79015470ed3CfF3E062E4B3EAF11a797","preState":{"traderWeth":"39865619350860743438","traderKraiken":"17373249602286120374089516","currentTick":120098,"poolPrice":"32110464384401727662944198120161","vwap":"0","outstandingSupply":"413226953999797390248100716"}},{"step":2,"type":"SELL","timestamp":1,"block":1,"actor":"0x9e3AD1ae79015470ed3CfF3E062E4B3EAF11a797","preState":{"traderWeth":"39865619350860743438","traderKraiken":"17373249602286120374089516","currentTick":119273,"poolPrice":"30812862944640364687227822880556","vwap":"0","outstandingSupply":"413226953999797390248100716"}},{"step":3,"type":"SELL","timestamp":1,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"39865619350860743438","traderKraiken":"17373249602286120374089516","currentTick":120090,"poolPrice":"32097488370004114033187034337888","vwap":"0","outstandingSupply":"413226953999797390248100716"}},{"step":4,"type":"RECENTER","timestamp":1,"block":1,"actor":"0xA4E6160eF2Ee2E58Bf1aC59ad85D5e6a6Cf811e4","preState":{"traderWeth":"90792518617702532872","traderKraiken":"8686624801143060187044758","currentTick":121269,"poolPrice":"34047907384835713843150791308680","vwap":"0","outstandingSupply":"413226953999797390248100716"}},{"step":5,"type":"BUY","timestamp":3601,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"90792518617702532872","traderKraiken":"8686624801143060187044758","currentTick":121269,"poolPrice":"34047907384835713843150791308680","vwap":"0","outstandingSupply":"394463856810240134113940061"}},{"step":6,"type":"SELL","timestamp":3601,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"45396259308851266436","traderKraiken":"16100675243303605610895622","currentTick":119012,"poolPrice":"30413683092433275221583921948281","vwap":"0","outstandingSupply":"394463856810240134113940061"}}]}

View file

@ -1 +0,0 @@
{"scenario":{"seed":1,"optimizer":"BullMarketOptimizer","initialEth":"200000000000000000000","traderInitialEth":"417106981937535278860","startTimestamp":3601,"startBlock":1,"token0isWeth":false,"poolFee":10000},"actions":[{"step":0,"type":"BUY","timestamp":5401,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"152861730151649342497","traderKraiken":"0","currentTick":-123891,"poolPrice":"161723773678779450733783246","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":1,"type":"SELL","timestamp":5401,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"114646297613737006873","traderKraiken":"8094470310852125234052188","currentTick":-121593,"poolPrice":"181414017218734744871703229","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":2,"type":"BUY","timestamp":5401,"block":1,"actor":"0x9e3AD1ae79015470ed3CfF3E062E4B3EAF11a797","preState":{"traderWeth":"124842831271889337408","traderKraiken":"6070852733139093925539141","currentTick":-122186,"poolPrice":"176107254482909757175841776","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":3,"type":"SELL","timestamp":5401,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"124842831271889337408","traderKraiken":"6070852733139093925539141","currentTick":-119869,"poolPrice":"197743845112692177382153477","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":4,"type":"BUY","timestamp":5401,"block":1,"actor":"0x9e3AD1ae79015470ed3CfF3E062E4B3EAF11a797","preState":{"traderWeth":"134187673424715730835","traderKraiken":"4553139549854320444154356","currentTick":-119901,"poolPrice":"197425506811074811873956860","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":5,"type":"SELL","timestamp":5401,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"134187673424715730835","traderKraiken":"4553139549854320444154356","currentTick":-119677,"poolPrice":"199653425417280065710376340","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":6,"type":"BUY","timestamp":5401,"block":1,"actor":"0x9e3AD1ae79015470ed3CfF3E062E4B3EAF11a797","preState":{"traderWeth":"141335114312326533197","traderKraiken":"3414854662390740333115767","currentTick":-119701,"poolPrice":"199409943060289759425132754","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":7,"type":"SELL","timestamp":5401,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"141335114312326533197","traderKraiken":"3414854662390740333115767","currentTick":-119590,"poolPrice":"200523902363392386343308428","vwap":"0","outstandingSupply":"413355367821089080069727544"}},{"step":8,"type":"SELL","timestamp":5401,"block":1,"actor":"0x10E951fA67B511D044803c7757DA445Ddf646f6d","preState":{"traderWeth":"146744168046319825366","traderKraiken":"2561140996793055249836826","currentTick":-119608,"poolPrice":"200339639328139758352135908","vwap":"0","outstandingSupply":"413355367821089080069727544"}}]}

View file

@ -1,21 +0,0 @@
=== PROFITABLE SCENARIO SUMMARY ===
Run ID: 250818-WAER
Seed: 0
Optimizer: BullMarketOptimizer
Discovery Reached: YES
Financial Results:
Initial Balance: 50 ETH
Final Balance: 131 ETH
Profit: 81 ETH (162%)
Action Sequence:
1. BUY - Trader - Amount: 93 ETH - Tick: 123890 -> 120098
2. BUY - Whale - Amount: 244 ETH - Tick: 120098 -> 119273
3. SELL - Whale - Amount: 38079345 ETH - Tick: 119273 -> 120090
4. SELL - Trader - Amount: 8686624 ETH - Tick: 120090 -> 121269
5. RECENTER - System - Tick: 121269 -> 121269
6. BUY - Trader - Amount: 45 ETH - Tick: 121269 -> 119012
7. SELL - Trader - Amount: 16100675 ETH - Tick: 119012 -> 123585
This scenario can be replayed using the generated replay script.

View file

@ -1,23 +0,0 @@
=== PROFITABLE SCENARIO SUMMARY ===
Run ID: 250818-WAER
Seed: 1
Optimizer: BullMarketOptimizer
Discovery Reached: YES
Financial Results:
Initial Balance: 50 ETH
Final Balance: 162 ETH
Profit: 112 ETH (225%)
Action Sequence:
1. BUY - Trader - Amount: 38 ETH - Tick: -123891 -> -121593
2. SELL - Trader - Amount: 2023617 ETH - Tick: -121593 -> -122186
3. BUY - Whale - Amount: 132 ETH - Tick: -122186 -> -119869
4. SELL - Trader - Amount: 1517713 ETH - Tick: -119869 -> -119901
5. BUY - Whale - Amount: 66 ETH - Tick: -119901 -> -119677
6. SELL - Trader - Amount: 1138284 ETH - Tick: -119677 -> -119701
7. BUY - Whale - Amount: 33 ETH - Tick: -119701 -> -119590
8. SELL - Trader - Amount: 853713 ETH - Tick: -119590 -> -119608
9. SELL - Trader - Amount: 2561140 ETH - Tick: -119608 -> -119663
This scenario can be replayed using the generated replay script.

File diff suppressed because one or more lines are too long