Merge pull request 'fix: Remove recenterAccess — make recenter() public with TWAP enforcement (#706)' (#713) from fix/issue-706 into master
This commit is contained in:
commit
6ff8282a7e
19 changed files with 241 additions and 330 deletions
|
|
@ -143,14 +143,13 @@ contract BacktestRunner is Script {
|
|||
// ------------------------------------------------------------------
|
||||
KrAIkenSystem memory sys = KrAIkenDeployer.deploy(address(sp.factory), address(mockWeth), address(krk), sender, initialCapital);
|
||||
|
||||
// Deploy StrategyExecutor and grant it recenter access on the LM.
|
||||
// recenterAccess bypasses TWAP stability check and cooldown — correct
|
||||
// for simulation where vm.warp drives time, not a real oracle.
|
||||
// sender == feeDestination, so the onlyFeeDestination guard is satisfied.
|
||||
// Deploy StrategyExecutor — recenter() is now permissionless, so no
|
||||
// access grant is needed. StrategyExecutor.maybeRecenter() calls
|
||||
// recenter() via try/catch and logs "SKIP" on cooldown/TWAP failures.
|
||||
// vm.warp in EventReplayer drives time so TWAP and cooldown pass.
|
||||
bool token0isWeth = sp.token0 == address(mockWeth);
|
||||
StrategyExecutor executor =
|
||||
new StrategyExecutor(sys.lm, IERC20(address(mockWeth)), IERC20(address(krk)), sender, recenterInterval, sp.pool, token0isWeth);
|
||||
sys.lm.setRecenterAccess(address(executor));
|
||||
|
||||
// Deploy baseline strategies and initialize with the same capital as KrAIken.
|
||||
BaselineStrategies baselines =
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ import { console2 } from "forge-std/console2.sol";
|
|||
* notified on every block (for time-in-range) and on each successful recenter
|
||||
* (for position lifecycle and fee/IL accounting).
|
||||
*
|
||||
* Access model: StrategyExecutor must be set as recenterAccess on the LM so that
|
||||
* the cooldown and TWAP price-stability checks are bypassed in the simulation
|
||||
* (vm.warp advances simulated time, not real oracle state).
|
||||
* Access model: recenter() is permissionless — no special access grant is required.
|
||||
* EventReplayer advances block.timestamp via vm.warp, so the 60-second cooldown and
|
||||
* the 300-second TWAP window pass normally during simulation.
|
||||
*
|
||||
* TODO(#319): The negligible-impact assumption means we replay historical events
|
||||
* as-is without accounting for KrAIken's own liquidity affecting swap outcomes.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue