Skip to main content

ISablierLockupLinear

Git Source

Inherits: ISablierLockupState

Creates Lockup streams with linear distribution model.

Functions

createWithDurationsLL

Creates a stream by setting the start time to block.timestamp, and the end time to the sum of block.timestamp and durations.total. The stream is funded by msg.sender and is wrapped in an ERC-721 NFT.

Emits a {Transfer}, {CreateLockupLinearStream} and {MetadataUpdate} event. Requirements:

  • All requirements in {createWithTimestampsLL} must be met for the calculated parameters.
function createWithDurationsLL(
Lockup.CreateWithDurations calldata params,
LockupLinear.UnlockAmounts calldata unlockAmounts,
LockupLinear.Durations calldata durations
)
external
payable
returns (uint256 streamId);

Parameters

NameTypeDescription
paramsLockup.CreateWithDurationsStruct encapsulating the function parameters, which are documented in {Lockup} type.
unlockAmountsLockupLinear.UnlockAmountsStruct encapsulating (i) the amount to unlock at the start time and (ii) the amount to unlock at the cliff time.
durationsLockupLinear.DurationsStruct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds.

Returns

NameTypeDescription
streamIduint256The ID of the newly created stream.

createWithTimestampsLL

Creates a stream with the provided start time and end time. The stream is funded by msg.sender and is wrapped in an ERC-721 NFT.

Emits a {Transfer}, {CreateLockupLinearStream} and {MetadataUpdate} event. Notes:

  • A cliff time of zero means there is no cliff.
  • As long as the times are ordered, it is not an error for the start or the cliff time to be in the past. Requirements:
  • Must not be delegate called.
  • params.depositAmount must be greater than zero.
  • params.timestamps.start must be greater than zero and less than params.timestamps.end.
  • If set, cliffTime must be greater than params.timestamps.start and less than params.timestamps.end.
  • params.recipient must not be the zero address.
  • params.sender must not be the zero address.
  • The sum of params.unlockAmounts.start and params.unlockAmounts.cliff must be less than or equal to deposit amount.
  • If params.timestamps.cliff not set, the params.unlockAmounts.cliff must be zero.
  • msg.sender must have allowed this contract to spend at least params.depositAmount tokens.
  • params.token must not be the native token.
  • params.shape.length must not be greater than 32 characters.
function createWithTimestampsLL(
Lockup.CreateWithTimestamps calldata params,
LockupLinear.UnlockAmounts calldata unlockAmounts,
uint40 cliffTime
)
external
payable
returns (uint256 streamId);

Parameters

NameTypeDescription
paramsLockup.CreateWithTimestampsStruct encapsulating the function parameters, which are documented in {Lockup} type.
unlockAmountsLockupLinear.UnlockAmountsStruct encapsulating (i) the amount to unlock at the start time and (ii) the amount to unlock at the cliff time.
cliffTimeuint40The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.

Returns

NameTypeDescription
streamIduint256The ID of the newly created stream.

Events

CreateLockupLinearStream

Emitted when an LL stream is created.

event CreateLockupLinearStream(
uint256 indexed streamId,
Lockup.CreateEventCommon commonParams,
uint40 cliffTime,
LockupLinear.UnlockAmounts unlockAmounts
);

Parameters

NameTypeDescription
streamIduint256The ID of the newly created stream.
commonParamsLockup.CreateEventCommonCommon parameters emitted in Create events across all Lockup models.
cliffTimeuint40The Unix timestamp for the cliff period's end. A value of zero means there is no cliff.
unlockAmountsLockupLinear.UnlockAmountsStruct encapsulating (i) the amount to unlock at the start time and (ii) the amount to unlock at the cliff time.