Skip to content

Commit

Permalink
optimization: minor adjust per comment
Browse files Browse the repository at this point in the history
  • Loading branch information
chefburger committed Nov 12, 2024
1 parent 9c8fa74 commit 6b718c7
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/BinHookTest#testSwapSucceedsWithHook.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
190198
190107
2 changes: 1 addition & 1 deletion .forge-snapshots/BinPoolManagerBytecodeSize.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23602
23558
Original file line number Diff line number Diff line change
@@ -1 +1 @@
178883
178450
Original file line number Diff line number Diff line change
@@ -1 +1 @@
185165
184732
Original file line number Diff line number Diff line change
@@ -1 +1 @@
133876
133785
6 changes: 3 additions & 3 deletions src/pool-bin/libraries/BinPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,15 @@ library BinPool {
amountsInWithFees = amountsInWithFees.sub(pFee);
}

self.reserveOfBin[swapState.activeId] = binReserves.add(amountsInWithFees).sub(amountsOutOfBin);

if (
(binReserves.add(amountsInWithFees).sub(amountsOutOfBin)).getLiquidity(
self.reserveOfBin[swapState.activeId].getLiquidity(
swapState.activeId.getPriceFromId(params.binStep)
) > Constants.MAX_LIQUIDITY_PER_BIN
) {
revert BinPool__MaxLiquidityPerBinExceeded();
}

self.reserveOfBin[swapState.activeId] = binReserves.add(amountsInWithFees).sub(amountsOutOfBin);
}
}

Expand Down

0 comments on commit 6b718c7

Please sign in to comment.