function _removeStreamIdFromRecipient(address recipient, uint256 streamId) internal {
uint256 lastStreamId = _repicientStreamIds[repicient].length - 1;
uint256 streamIdIndex = _findStreamIdIndex(repicient, streamId);
// Move the last stream id to the slot of the stream id to delete
_repicientStreamIds[repicient][streamIdIndex] = _repicientStreamIds[repicient][lastStreamId];
// Remove the last id
_repicientStreamIds[repicient].pop();
}
function _findStreamIdIndex(address recipient, uint256 streamId) internal view returns (uint256) {
for (uint256 i = 0; i < _repicientStreamIds[recipient].length; i++) {
if (_repicientStreamIds[recipient][i] == streamId) {
return i;
}
}
}
function _addStreamIdToRecipient(address recipient, uint256 streamId) internal {
_repicientStreamIds[recipient].push(streamId);
}
-
-
Save andreivladbrg/59c27efa49662460e2463fa500be64e8 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment