Skip to content

Commit

Permalink
Merge branch 'main' into feat/align-binPm-tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
ChefMist authored Nov 14, 2024
2 parents fbb935d + 72633c4 commit 7a0044c
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1184840
1184840
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1050833
1050843
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1093093
1093103
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1257194
1257194
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1123276
1123286
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1159530
1159540
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1184840
1184840
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1050833
1050843
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1093089
1093099
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1255176
1255176
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1121258
1121268
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1157508
1157518
Original file line number Diff line number Diff line change
@@ -1 +1 @@
296697
296707
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1135179
1135179
Original file line number Diff line number Diff line change
@@ -1 +1 @@
541453
541463
Original file line number Diff line number Diff line change
@@ -1 +1 @@
915904
915914
Original file line number Diff line number Diff line change
@@ -1 +1 @@
865941
865951
8 changes: 6 additions & 2 deletions src/pool-bin/BinPositionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,12 @@ contract BinPositionManager is
/// @dev Checks if the activeId is within slippage before calling mint. If user mint to activeId and there
// was a swap in hook.beforeMint() which changes the activeId, user txn will fail
(uint24 activeId,,) = binPoolManager.getSlot0(params.poolKey.toId());
if (params.activeIdDesired + params.idSlippage < activeId) revert IdDesiredOverflows(activeId);
if (params.activeIdDesired - params.idSlippage > activeId) revert IdDesiredOverflows(activeId);
if (params.activeIdDesired + params.idSlippage < activeId) {
revert IdSlippageCaught(params.activeIdDesired, params.idSlippage, activeId);
}
if (params.activeIdDesired - params.idSlippage > activeId) {
revert IdSlippageCaught(params.activeIdDesired, params.idSlippage, activeId);
}

bytes32[] memory liquidityConfigs = new bytes32[](deltaLen);
for (uint256 i; i < liquidityConfigs.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/pool-bin/interfaces/IBinPositionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {IPositionManager} from "../../interfaces/IPositionManager.sol";

interface IBinPositionManager is IPositionManager {
error IdOverflows(int256);
error IdDesiredOverflows(uint24);
error IdSlippageCaught(uint256 activeIdDesired, uint256 idSlippage, uint24 activeId);
error AddLiquidityInputActiveIdMismath();

/// @notice BinAddLiquidityParams
Expand Down
6 changes: 5 additions & 1 deletion test/pool-bin/BinPositionManager_ModifyLiquidites.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,11 @@ contract BinPositionManager_ModifyLiquidityTest is BinLiquidityHelper, GasSnapsh
_getAddParams(key1, binIds, 1 ether, 1 ether, activeId, alice);
param.activeIdDesired = activeId - 1;
bytes memory payload = Planner.init().add(Actions.BIN_ADD_LIQUIDITY, abi.encode(param)).encode();
vm.expectRevert(abi.encodeWithSelector(IBinPositionManager.IdDesiredOverflows.selector, activeId));
vm.expectRevert(
abi.encodeWithSelector(
IBinPositionManager.IdSlippageCaught.selector, param.activeIdDesired, param.idSlippage, activeId
)
);
binPm.modifyLiquidities(payload, _deadline);
}

Expand Down

0 comments on commit 7a0044c

Please sign in to comment.