refactor: addressing audit - #235
Merged
Merged
Conversation
kupermind
commented
Oct 13, 2025
Contributor
- Addressing audit.
77ph
reviewed
Oct 16, 2025
77ph
left a comment
Contributor
There was a problem hiding this comment.
function _increaseLiquidity
(aMin[0], aMin[1]) =
LiquidityAmounts.getAmountsForLiquidity(sqrtPriceX96, sqrtAB[0], sqrtAB[1], liquidity);
aMin[0] = inputAmounts[0] * (MAX_BPS - maxSlippage) / MAX_BPS;
aMin[1] = inputAmounts[1] * (MAX_BPS - maxSlippage) / MAX_BPS;
to
uint256[] memory aMin = new uint256[](2);
(aMin[0], aMin[1]) =
LiquidityAmounts.getAmountsForLiquidity(sqrtPriceX96, sqrtAB[0], sqrtAB[1], liquidity);
aMin[0] = aMin[0] * (MAX_BPS - maxSlippage) / MAX_BPS;
aMin[1] = aMin[1] * (MAX_BPS - maxSlippage) / MAX_BPS;
77ph
reviewed
Oct 16, 2025
Contributor
There was a problem hiding this comment.
Double check
function _roundDownToSpacing(int24 tick, int24 spacing) internal pure returns (int24) {
int24 r = tick % spacing;
return r == 0 ? tick : (tick - r);
}
function _roundUpToSpacing(int24 tick, int24 spacing) internal pure returns (int24) {
int24 r = tick % spacing;
return r == 0 ? tick : (tick - r + spacing);
}
for negative int
Example: tick = -7, spacing = 10
Maybe
function _roundDownToSpacing(int24 tick, int24 spacing) internal pure returns (int24) {
int24 r = tick % spacing;
return r == 0 ? tick : (r > 0 ? tick - r : tick - (r + spacing));
}
function _roundUpToSpacing(int24 tick, int24 spacing) internal pure returns (int24) {
int24 r = tick % spacing;
return r == 0 ? tick : (r > 0 ? tick + (spacing - r) : tick - r);
}
77ph
reviewed
Oct 16, 2025
77ph
left a comment
Contributor
There was a problem hiding this comment.
hiMinMax[0] = _roundUpToSpacing(ct + 1, tickSpacing);
if (hiMinMax[0] <= loHiBest[0]) hiMinMax[0] = loHiBest[0] + tickSpacing;
hiMinMax[1] = _roundDownToSpacing(TickMath.MAX_TICK, tickSpacing);
if (hiMinMax[1] <= hiMinMax[0]) hiMinMax[1] = hiMinMax[0] + tickSpacing; // <--- triple check out of MAX_TICK
77ph
reviewed
Oct 16, 2025
77ph
left a comment
Contributor
There was a problem hiding this comment.
// Snap to spacing + safety margins
int24 minSafe = _roundUpToSpacing(TickMath.MIN_TICK, tickSpacing);
minSafe += SAFETY_STEPS * tickSpacing;
int24 maxSafe = _roundDownToSpacing(TickMath.MAX_TICK, tickSpacing);
minSafe -= SAFETY_STEPS * tickSpacing;
double minSafe (typo)
77ph
reviewed
Oct 16, 2025
77ph
left a comment
Contributor
There was a problem hiding this comment.
function optimizeLiquidityAmounts(
...
) external pure returns (int24[] memory loHi, uint128 liquidity, uint256[] memory amountsDesired) {
-> amountsDesired = initialAmounts; --> double check copy array-to-array
doc: internal9 audit
…l_audit refactor: addressing internal audit
feat: Bridge2Burner contract
chore: code formatting
refactor: proxy and calldata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.