Skip to main content

Helpers

Git Source

Library with functions needed to validate input parameters across Lockup streams.

Functions

calculateSegmentTimestamps

Calculate the timestamps and return the segments.

function calculateSegmentTimestamps(
LockupDynamic.SegmentWithDuration[] memory segmentsWithDuration,
uint40 startTime
)
public
pure
returns (LockupDynamic.Segment[] memory segmentsWithTimestamps);

calculateTrancheTimestamps

Calculate the timestamps and return the tranches.

function calculateTrancheTimestamps(
LockupTranched.TrancheWithDuration[] memory tranchesWithDuration,
uint40 startTime
)
public
pure
returns (LockupTranched.Tranche[] memory tranchesWithTimestamps);

checkCreateLD

Checks the parameters of the SablierLockup-_createLD function.

function checkCreateLD(
address sender,
Lockup.Timestamps memory timestamps,
uint128 depositAmount,
LockupDynamic.Segment[] memory segments,
address token,
address nativeToken,
string memory shape
)
public
pure;

checkCreateLL

Checks the parameters of the SablierLockup-_createLL function.

function checkCreateLL(
address sender,
Lockup.Timestamps memory timestamps,
uint40 cliffTime,
uint128 depositAmount,
LockupLinear.UnlockAmounts memory unlockAmounts,
address token,
address nativeToken,
string memory shape
)
public
pure;

checkCreateLT

Checks the parameters of the SablierLockup-_createLT function.

function checkCreateLT(
address sender,
Lockup.Timestamps memory timestamps,
uint128 depositAmount,
LockupTranched.Tranche[] memory tranches,
address token,
address nativeToken,
string memory shape
)
public
pure;

_checkTimestampsAndUnlockAmounts

Checks the user-provided cliff, end times, and unlock amounts of an LL stream.

function _checkTimestampsAndUnlockAmounts(
uint128 depositAmount,
Lockup.Timestamps memory timestamps,
uint40 cliffTime,
LockupLinear.UnlockAmounts memory unlockAmounts
)
private
pure;

_checkCreateStream

Checks the user-provided common parameters across Lockup streams.

function _checkCreateStream(
address sender,
uint128 depositAmount,
uint40 startTime,
address token,
address nativeToken,
string memory shape
)
private
pure;

_checkSegments

*Checks:

  1. The first timestamp is strictly greater than the start time.
  2. The timestamps are ordered chronologically.
  3. There are no duplicate timestamps.
  4. The deposit amount is equal to the sum of all segment amounts.
  5. The end time equals the last segment's timestamp.*
function _checkSegments(
LockupDynamic.Segment[] memory segments,
uint128 depositAmount,
Lockup.Timestamps memory timestamps
)
private
pure;

_checkTranches

*Checks:

  1. The first timestamp is strictly greater than the start time.
  2. The timestamps are ordered chronologically.
  3. There are no duplicate timestamps.
  4. The deposit amount is equal to the sum of all tranche amounts.
  5. The end time equals the last tranche's timestamp.*
function _checkTranches(
LockupTranched.Tranche[] memory tranches,
uint128 depositAmount,
Lockup.Timestamps memory timestamps
)
private
pure;