Skip to content

Commit

Permalink
Merge branch 'main' into tests/cancel-invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielstoica authored Jul 22, 2024
2 parents 6879df9 + ddce56a commit 1c8fc2a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/modules/invoice-module/sablier-v2/StreamManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ abstract contract StreamManager is IStreamManager {
_;
}

/// @notice Reverts if the `msg.sender` is not the initial stream sender (creator of the stream)
modifier onlyInitialStreamSender(uint256 streamId) {
address initialSender = _initialStreamSender[streamId];
if (msg.sender != initialSender) revert Errors.OnlyInitialStreamSender(initialSender);
_;
}

/*//////////////////////////////////////////////////////////////////////////
NON-CONSTANT FUNCTIONS
//////////////////////////////////////////////////////////////////////////*/
Expand Down Expand Up @@ -244,7 +251,12 @@ abstract contract StreamManager is IStreamManager {
}

/// @dev Withdraws from either a linear or tranched stream
function _withdrawStream(ISablierV2Lockup sablier, uint256 streamId, address to, uint128 amount) internal {
function _withdrawStream(
ISablierV2Lockup sablier,
uint256 streamId,
address to,
uint128 amount
) internal onlyInitialStreamSender(streamId) {
sablier.withdraw(streamId, to, amount);
}

Expand Down

0 comments on commit 1c8fc2a

Please sign in to comment.