Skip to main content

ISablierLockupRecipient

Git Source

Inherits: IERC165

Interface for recipient contracts capable of reacting to cancellations and withdrawals. For this to be able to hook into Sablier, it must fully implement this interface and it must have been allowlisted by the Lockup contract's admin.

See IERC165-supportsInterface. The implementation MUST implement the {IERC165-supportsInterface} method, which MUST return true when called with 0xf8ee98d3, i.e. type(ISablierLockupRecipient).interfaceId.

Functions

onSablierLockupCancel

Responds to cancellations.

Notes:

  • The function MUST return the selector ISablierLockupRecipient.onSablierLockupCancel.selector.
  • If this function reverts, the execution in the Lockup contract will revert as well.
function onSablierLockupCancel(
uint256 streamId,
address sender,
uint128 senderAmount,
uint128 recipientAmount
)
external
returns (bytes4 selector);

Parameters

NameTypeDescription
streamIduint256The ID of the canceled stream.
senderaddressThe stream's sender, who canceled the stream.
senderAmountuint128The amount of assets refunded to the stream's sender, denoted in units of the asset's decimals.
recipientAmountuint128The amount of assets left for the stream's recipient to withdraw, denoted in units of the asset's decimals.

Returns

NameTypeDescription
selectorbytes4The selector of this function needed to validate the hook.

onSablierLockupWithdraw

Responds to withdrawals triggered by any address except the contract implementing this interface.

Notes:

  • The function MUST return the selector ISablierLockupRecipient.onSablierLockupWithdraw.selector.
  • If this function reverts, the execution in the Lockup contract will revert as well.
function onSablierLockupWithdraw(
uint256 streamId,
address caller,
address to,
uint128 amount
)
external
returns (bytes4 selector);

Parameters

NameTypeDescription
streamIduint256The ID of the stream being withdrawn from.
calleraddressThe original msg.sender address that triggered the withdrawal.
toaddressThe address receiving the withdrawn assets.
amountuint128The amount of assets withdrawn, denoted in units of the asset's decimals.

Returns

NameTypeDescription
selectorbytes4The selector of this function needed to validate the hook.