feat: protocol stats display + parameter sweep fuzzing infrastructure (#106)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
37b1002dae
commit
21857ae8ca
10 changed files with 1592 additions and 308 deletions
|
|
@ -205,7 +205,7 @@ contract ReplayProfitableScenario is Test {
|
|||
return;
|
||||
}
|
||||
|
||||
SwapExecutor executor = new SwapExecutor(pool, weth, kraiken, token0isWeth, lm);
|
||||
SwapExecutor executor = new SwapExecutor(pool, weth, kraiken, token0isWeth, lm, false);
|
||||
vm.prank(buyer);
|
||||
weth.transfer(address(executor), amount);
|
||||
|
||||
|
|
@ -222,7 +222,7 @@ contract ReplayProfitableScenario is Test {
|
|||
if (amount == 0) return;
|
||||
}
|
||||
|
||||
SwapExecutor executor = new SwapExecutor(pool, weth, kraiken, token0isWeth, lm);
|
||||
SwapExecutor executor = new SwapExecutor(pool, weth, kraiken, token0isWeth, lm, false);
|
||||
vm.prank(seller);
|
||||
kraiken.transfer(address(executor), amount);
|
||||
|
||||
|
|
|
|||
45
onchain/test/mocks/ConfigurableOptimizer.sol
Normal file
45
onchain/test/mocks/ConfigurableOptimizer.sol
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
/// @title ConfigurableOptimizer
|
||||
/// @notice Optimizer mock with directly settable parameters for parameter sweep fuzzing
|
||||
/// @dev Parameters are set via constructor or setter, not environment variables (Solidity can't read env)
|
||||
contract ConfigurableOptimizer {
|
||||
uint256 private _capitalInefficiency;
|
||||
uint256 private _anchorShare;
|
||||
uint24 private _anchorWidth;
|
||||
uint256 private _discoveryDepth;
|
||||
|
||||
constructor(uint256 capitalInefficiency_, uint256 anchorShare_, uint24 anchorWidth_, uint256 discoveryDepth_) {
|
||||
_capitalInefficiency = capitalInefficiency_;
|
||||
_anchorShare = anchorShare_;
|
||||
_anchorWidth = anchorWidth_;
|
||||
_discoveryDepth = discoveryDepth_;
|
||||
}
|
||||
|
||||
function setParams(uint256 capitalInefficiency_, uint256 anchorShare_, uint24 anchorWidth_, uint256 discoveryDepth_) external {
|
||||
_capitalInefficiency = capitalInefficiency_;
|
||||
_anchorShare = anchorShare_;
|
||||
_anchorWidth = anchorWidth_;
|
||||
_discoveryDepth = discoveryDepth_;
|
||||
}
|
||||
|
||||
function calculateSentiment(uint256, uint256) public pure returns (uint256) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function getSentiment() external pure returns (uint256) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function getLiquidityParams() external view returns (uint256 capitalInefficiency, uint256 anchorShare, uint24 anchorWidth, uint256 discoveryDepth) {
|
||||
capitalInefficiency = _capitalInefficiency;
|
||||
anchorShare = _anchorShare;
|
||||
anchorWidth = _anchorWidth;
|
||||
discoveryDepth = _discoveryDepth;
|
||||
}
|
||||
|
||||
function getDescription() external pure returns (string memory) {
|
||||
return "Configurable Optimizer (Parameter Sweep)";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue