Skip to content

Commit

Permalink
Merge branch 'main' into remove-unnecessary-length-check
Browse files Browse the repository at this point in the history
  • Loading branch information
snreynolds authored Dec 2, 2024
2 parents d7195fa + 1d92e95 commit 1c075de
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/PositionManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ contract PositionManager is

// Can only call modify if there is non zero liquidity.
BalanceDelta feesAccrued;
BalanceDelta liquidityDelta;
if (liquidity > 0) {
BalanceDelta liquidityDelta;
// do not use _modifyLiquidity as we do not need to notify on modification for burns.
(liquidityDelta, feesAccrued) = poolManager.modifyLiquidity(
poolKey,
Expand Down
18 changes: 7 additions & 11 deletions src/base/Notifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,32 +96,28 @@ abstract contract Notifier is INotifier {
uint256 liquidity,
BalanceDelta feesAccrued
) internal {
ISubscriber _subscriber = subscriber[tokenId];
address _subscriber = address(subscriber[tokenId]);

// remove the subscriber
delete subscriber[tokenId];

bool success = _call(
address(_subscriber), abi.encodeCall(ISubscriber.notifyBurn, (tokenId, owner, info, liquidity, feesAccrued))
);
bool success =
_call(_subscriber, abi.encodeCall(ISubscriber.notifyBurn, (tokenId, owner, info, liquidity, feesAccrued)));

if (!success) {
address(_subscriber).bubbleUpAndRevertWith(
ISubscriber.notifyBurn.selector, BurnNotificationReverted.selector
);
_subscriber.bubbleUpAndRevertWith(ISubscriber.notifyBurn.selector, BurnNotificationReverted.selector);
}
}

function _notifyModifyLiquidity(uint256 tokenId, int256 liquidityChange, BalanceDelta feesAccrued) internal {
ISubscriber _subscriber = subscriber[tokenId];
address _subscriber = address(subscriber[tokenId]);

bool success = _call(
address(_subscriber),
abi.encodeCall(ISubscriber.notifyModifyLiquidity, (tokenId, liquidityChange, feesAccrued))
_subscriber, abi.encodeCall(ISubscriber.notifyModifyLiquidity, (tokenId, liquidityChange, feesAccrued))
);

if (!success) {
address(_subscriber).bubbleUpAndRevertWith(
_subscriber.bubbleUpAndRevertWith(
ISubscriber.notifyModifyLiquidity.selector, ModifyLiquidityNotificationReverted.selector
);
}
Expand Down
2 changes: 0 additions & 2 deletions src/interfaces/INotifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ interface INotifier {
error ModifyLiquidityNotificationReverted(address subscriber, bytes reason);
/// @notice Wraps the revert message of the subscriber contract on a reverting burn notification
error BurnNotificationReverted(address subscriber, bytes reason);
/// @notice Wraps the revert message of the subscriber contract on a reverting transfer notification
error TransferNotificationReverted(address subscriber, bytes reason);
/// @notice Thrown when a tokenId already has a subscriber
error AlreadySubscribed(uint256 tokenId, address subscriber);

Expand Down

0 comments on commit 1c075de

Please sign in to comment.