exact repeat of initial pulledHarb storage var.
This commit is contained in:
parent
8439392e3f
commit
8c28b05312
1 changed files with 2 additions and 22 deletions
|
|
@ -221,27 +221,6 @@ contract LiquidityManager {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @notice calculates token0/token1 amount based on range and liquidity
|
|
||||||
/// @dev Use TOKEN_ZERO as tokenZero value, when need to calculate TOKEN amount
|
|
||||||
/// Use !TOKEN_ZERO as tokenZero value, when need to calculate WETH amount
|
|
||||||
function getAmountForLiquidity(
|
|
||||||
int24 tickLower,
|
|
||||||
int24 tickUpper,
|
|
||||||
uint128 liquidity,
|
|
||||||
bool tokenZero
|
|
||||||
)
|
|
||||||
internal
|
|
||||||
pure
|
|
||||||
returns (uint256 amount)
|
|
||||||
{
|
|
||||||
uint160 sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(tickLower);
|
|
||||||
uint160 sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(tickUpper);
|
|
||||||
|
|
||||||
amount = tokenZero
|
|
||||||
? LiquidityAmounts.getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity)
|
|
||||||
: LiquidityAmounts.getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @notice Internal function to set or adjust the floor, anchor, and discovery positions based on current market conditions and the manager's strategy.
|
/// @notice Internal function to set or adjust the floor, anchor, and discovery positions based on current market conditions and the manager's strategy.
|
||||||
/// @param currentTick The current market tick.
|
/// @param currentTick The current market tick.
|
||||||
/// @dev Recalculates and realigns all liquidity positions according to the latest market data and strategic requirements.
|
/// @dev Recalculates and realigns all liquidity positions according to the latest market data and strategic requirements.
|
||||||
|
|
@ -283,12 +262,13 @@ contract LiquidityManager {
|
||||||
anchorLiquidity = LiquidityAmounts.getLiquidityForAmount0(
|
anchorLiquidity = LiquidityAmounts.getLiquidityForAmount0(
|
||||||
sqrtRatioX96, sqrtRatioBX96, anchorEthBalance
|
sqrtRatioX96, sqrtRatioBX96, anchorEthBalance
|
||||||
);
|
);
|
||||||
|
pulledHarb = LiquidityAmounts.getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, anchorLiquidity);
|
||||||
} else {
|
} else {
|
||||||
anchorLiquidity = LiquidityAmounts.getLiquidityForAmount1(
|
anchorLiquidity = LiquidityAmounts.getLiquidityForAmount1(
|
||||||
sqrtRatioAX96, sqrtRatioX96, anchorEthBalance
|
sqrtRatioAX96, sqrtRatioX96, anchorEthBalance
|
||||||
);
|
);
|
||||||
|
pulledHarb = LiquidityAmounts.getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, anchorLiquidity);
|
||||||
}
|
}
|
||||||
pulledHarb = getAmountForLiquidity(tickLower, tickUpper, anchorLiquidity, !token0isWeth);
|
|
||||||
_mint(Stage.ANCHOR, tickLower, tickUpper, anchorLiquidity);
|
_mint(Stage.ANCHOR, tickLower, tickUpper, anchorLiquidity);
|
||||||
}
|
}
|
||||||
currentTick = currentTick / TICK_SPACING * TICK_SPACING;
|
currentTick = currentTick / TICK_SPACING * TICK_SPACING;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue