From c71e4b9d12cad2944d3547720f712c8eaa462c4a Mon Sep 17 00:00:00 2001 From: Sara Reynolds <30504811+snreynolds@users.noreply.github.com> Date: Mon, 2 Dec 2024 17:05:20 +0000 Subject: [PATCH] use address for subscriber (#405) * use address for subscriber * fix bytecode snap --- .../positionDescriptor bytecode size.snap | 2 +- src/base/Notifier.sol | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.forge-snapshots/positionDescriptor bytecode size.snap b/.forge-snapshots/positionDescriptor bytecode size.snap index 4cdd5179..616fe551 100644 --- a/.forge-snapshots/positionDescriptor bytecode size.snap +++ b/.forge-snapshots/positionDescriptor bytecode size.snap @@ -1 +1 @@ -24108 \ No newline at end of file +24177 \ No newline at end of file diff --git a/src/base/Notifier.sol b/src/base/Notifier.sol index 3412ea64..7e755c66 100644 --- a/src/base/Notifier.sol +++ b/src/base/Notifier.sol @@ -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 ); }