Skip to content

Commit

Permalink
use address for subscriber (#405)
Browse files Browse the repository at this point in the history
* use address for subscriber

* fix bytecode snap
  • Loading branch information
snreynolds authored Dec 2, 2024
1 parent c3d3cad commit c71e4b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .forge-snapshots/positionDescriptor bytecode size.snap
Original file line number Diff line number Diff line change
@@ -1 +1 @@
24108
24177
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

0 comments on commit c71e4b9

Please sign in to comment.