Helpers
Library with helper functions needed across the Sablier V2 contracts.
Functions
calculateSegmentTimestamps
Calculate the timestamps and return the segments.
function calculateSegmentTimestamps(LockupDynamic.SegmentWithDuration[] memory segments)
    internal
    view
    returns (LockupDynamic.Segment[] memory segmentsWithTimestamps);
calculateTrancheTimestamps
Calculate the timestamps and return the tranches.
function calculateTrancheTimestamps(LockupTranched.TrancheWithDuration[] memory tranches)
    internal
    view
    returns (LockupTranched.Tranche[] memory tranchesWithTimestamps);
checkAndCalculateBrokerFee
Checks the broker fee is not greater than maxBrokerFee, and then calculates the broker fee amount and the deposit
amount from the total amount.
function checkAndCalculateBrokerFee(
    uint128 totalAmount,
    UD60x18 brokerFee,
    UD60x18 maxBrokerFee
)
    internal
    pure
    returns (Lockup.CreateAmounts memory amounts);
checkCreateLockupDynamic
Checks the parameters of the SablierV2LockupDynamic-_create function.
function checkCreateLockupDynamic(
    uint128 depositAmount,
    LockupDynamic.Segment[] memory segments,
    uint256 maxSegmentCount,
    uint40 startTime
)
    internal
    view;
checkCreateLockupLinear
Checks the parameters of the SablierV2LockupLinear-_create function.
function checkCreateLockupLinear(uint128 depositAmount, LockupLinear.Timestamps memory timestamps) internal view;
checkCreateLockupTranched
Checks the parameters of the SablierV2LockupTranched-_create function.
function checkCreateLockupTranched(
    uint128 depositAmount,
    LockupTranched.Tranche[] memory tranches,
    uint256 maxTrancheCount,
    uint40 startTime
)
    internal
    view;
_checkSegments
Checks that:
- The first timestamp is strictly greater than the start time.
- The timestamps are ordered chronologically.
- There are no duplicate timestamps.
- The deposit amount is equal to the sum of all segment amounts.
function _checkSegments(
    LockupDynamic.Segment[] memory segments,
    uint128 depositAmount,
    uint40 startTime
)
    private
    view;
_checkTranches
Checks that:
- The first timestamp is strictly greater than the start time.
- The timestamps are ordered chronologically.
- There are no duplicate timestamps.
- The deposit amount is equal to the sum of all tranche amounts.
function _checkTranches(
    LockupTranched.Tranche[] memory tranches,
    uint128 depositAmount,
    uint40 startTime
)
    private
    view;