wip
This commit is contained in:
parent
5b376885fd
commit
9f0b163303
19 changed files with 1340 additions and 490 deletions
|
|
@ -243,6 +243,61 @@ contract TestEnvironment is TestConstants {
|
|||
return (factory, pool, weth, harberg, stake, lm, optimizer, token0isWeth);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Setup environment with existing factory and specific optimizer
|
||||
* @param existingFactory The existing Uniswap factory to use
|
||||
* @param token0shouldBeWeth Whether WETH should be token0
|
||||
* @param recenterCaller Address that will be granted recenter access
|
||||
* @param optimizerAddress Address of the optimizer to use
|
||||
* @return _factory The existing Uniswap factory
|
||||
* @return _pool The created Uniswap pool
|
||||
* @return _weth The WETH token contract
|
||||
* @return _harberg The Kraiken token contract
|
||||
* @return _stake The staking contract
|
||||
* @return _lm The liquidity manager contract
|
||||
* @return _optimizer The optimizer contract
|
||||
* @return _token0isWeth Whether token0 is WETH
|
||||
*/
|
||||
function setupEnvironmentWithExistingFactory(
|
||||
IUniswapV3Factory existingFactory,
|
||||
bool token0shouldBeWeth,
|
||||
address recenterCaller,
|
||||
address optimizerAddress
|
||||
) external returns (
|
||||
IUniswapV3Factory _factory,
|
||||
IUniswapV3Pool _pool,
|
||||
IWETH9 _weth,
|
||||
Kraiken _harberg,
|
||||
Stake _stake,
|
||||
LiquidityManager _lm,
|
||||
Optimizer _optimizer,
|
||||
bool _token0isWeth
|
||||
) {
|
||||
// Use existing factory
|
||||
factory = existingFactory;
|
||||
|
||||
// Deploy tokens in correct order
|
||||
_deployTokensWithOrder(token0shouldBeWeth);
|
||||
|
||||
// Create and initialize pool
|
||||
_createAndInitializePool();
|
||||
|
||||
// Deploy protocol contracts with custom optimizer
|
||||
stake = new Stake(address(harberg), feeDestination);
|
||||
optimizer = Optimizer(optimizerAddress);
|
||||
lm = new LiquidityManager(address(factory), address(weth), address(harberg), optimizerAddress);
|
||||
lm.setFeeDestination(feeDestination);
|
||||
|
||||
// Configure permissions
|
||||
_configurePermissions();
|
||||
|
||||
// Grant recenter access to specified caller
|
||||
vm.prank(feeDestination);
|
||||
lm.setRecenterAccess(recenterCaller);
|
||||
|
||||
return (factory, pool, weth, harberg, stake, lm, optimizer, token0isWeth);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notice Perform recenter with proper time warp and oracle updates
|
||||
* @param liquidityManager The LiquidityManager instance to recenter
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue