Skip to content

Commit

Permalink
perf: optimize createAndDepositMultiple
Browse files Browse the repository at this point in the history
  • Loading branch information
andreivladbrg committed Apr 29, 2024
1 parent 7dd64ce commit 1e120e7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/SablierV2OpenEnded.sol
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,16 @@ contract SablierV2OpenEnded is ISablierV2OpenEnded, NoDelegateCall, SablierV2Ope
streamIds = new uint256[](recipients.length);
streamIds = createMultiple(recipients, senders, ratesPerSecond, asset);

depositMultiple(streamIds, amounts);
uint256 streamIdsCount = streamIds.length;
if (streamIdsCount != amounts.length) {
revert Errors.SablierV2OpenEnded_DepositArrayCountsNotEqual(streamIdsCount, amounts.length);
}

// Deposit on each stream.
for (uint256 i = 0; i < streamIdsCount; ++i) {
// Checks, Effects and Interactions: deposit on stream.
_deposit(streamIds[i], amounts[i]);
}
}

/// @inheritdoc ISablierV2OpenEnded
Expand Down

0 comments on commit 1e120e7

Please sign in to comment.