Notifier
Git Source - Generated with forge doc
Inherits: INotifier
Notifier is used to opt in to sending updates to external contracts about position modifications or transfers
State Variables
NO_SUBSCRIBER
ISubscriber private constant NO_SUBSCRIBER = ISubscriber(address(0));
unsubscribeGasLimit
Returns and determines the maximum allowable gas-used for notifying unsubscribe
uint256 public immutable unsubscribeGasLimit;
subscriber
Returns the subscriber for a respective position
mapping(uint256 tokenId => ISubscriber subscriber) public subscriber;
Functions
constructor
constructor(uint256 _unsubscribeGasLimit);
onlyIfApproved
Only allow callers that are approved as spenders or operators of the tokenId
to be implemented by the parent contract (PositionManager)
modifier onlyIfApproved(address caller, uint256 tokenId) virtual;
Parameters
Name | Type | Description |
---|---|---|
caller | address | the address of the caller |
tokenId | uint256 | the tokenId of the position |
onlyIfPoolManagerLocked
Enforces that the PoolManager is locked.
modifier onlyIfPoolManagerLocked() virtual;
_setUnsubscribed
function _setUnsubscribed(uint256 tokenId) internal virtual;
_setSubscribed
function _setSubscribed(uint256 tokenId) internal virtual;
subscribe
Enables the subscriber to receive notifications for a respective position
Calling subscribe when a position is already subscribed will revert
function subscribe(uint256 tokenId, address newSubscriber, bytes calldata data)
external
payable
onlyIfPoolManagerLocked
onlyIfApproved(msg.sender, tokenId);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | the ERC721 tokenId |
newSubscriber | address | the address of the subscriber contract |
data | bytes | caller-provided data that's forwarded to the subscriber contract |
unsubscribe
Removes the subscriber from receiving notifications for a respective position
Callers must specify a high gas limit (remaining gas should be higher than unsubscriberGasLimit) such that the subscriber can be notified
function unsubscribe(uint256 tokenId) external payable onlyIfPoolManagerLocked onlyIfApproved(msg.sender, tokenId);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | the ERC721 tokenId |
_unsubscribe
function _unsubscribe(uint256 tokenId) internal;
_notifyModifyLiquidity
function _notifyModifyLiquidity(uint256 tokenId, int256 liquidityChange, BalanceDelta feesAccrued) internal;
_notifyTransfer
function _notifyTransfer(uint256 tokenId, address previousOwner, address newOwner) internal;
_call
function _call(address target, bytes memory encodedCall) internal returns (bool success);