ISablierLockupLinear
Inherits: ISablierLockupState
Title: ISablierLockupLinear
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,
uint40 granularity,
LockupLinear.Durations calldata durations
)
external
payable
returns (uint256 streamId);
Parameters
| Name | Type | Description |
|---|---|---|
params | Lockup.CreateWithDurations | Struct encapsulating the function parameters, which are documented in {Lockup} type. |
unlockAmounts | LockupLinear.UnlockAmounts | Struct encapsulating (i) the amount to unlock at the start time and (ii) the amount to unlock at the cliff time. |
granularity | uint40 | The smallest step in time between two consecutive token unlocks. Zero is a sentinel value for 1 second. |
durations | LockupLinear.Durations | Struct encapsulating (i) cliff period duration and (ii) total stream duration, both in seconds. |
Returns
| Name | Type | Description |
|---|---|---|
streamId | uint256 | The 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.depositAmountmust be greater than zero.params.timestamps.startmust be greater than zero and less thanparams.timestamps.end.- If set,
cliffTimemust be greater thanparams.timestamps.startand less thanparams.timestamps.end. params.recipientmust not be the zero address.params.sendermust not be the zero address.- The sum of
params.unlockAmounts.startandparams.unlockAmounts.cliffmust be less than or equal to deposit amount. - If
params.timestamps.cliffis not set, theparams.unlockAmounts.cliffmust be zero. granularitymust not exceed the streamable range which isparams.timestamps.end - cliffTimeif cliff is set,params.timestamps.end - params.timestamps.startotherwise.msg.sendermust have allowed this contract to spend at leastparams.depositAmounttokens.params.tokenmust not be the native token.params.shape.lengthmust not be greater than 32 characters.
function createWithTimestampsLL(
Lockup.CreateWithTimestamps calldata params,
LockupLinear.UnlockAmounts calldata unlockAmounts,
uint40 granularity,
uint40 cliffTime
)
external
payable
returns (uint256 streamId);
Parameters
| Name | Type | Description |
|---|---|---|
params | Lockup.CreateWithTimestamps | Struct encapsulating the function parameters, which are documented in {Lockup} type. |
unlockAmounts | LockupLinear.UnlockAmounts | Struct encapsulating (i) the amount to unlock at the start time and (ii) the amount to unlock at the cliff time. |
granularity | uint40 | The smallest step in time between two consecutive token unlocks. Zero is a sentinel value for 1 second. |
cliffTime | uint40 | The Unix timestamp for the cliff period's end. A value of zero means there is no cliff. |
Returns
| Name | Type | Description |
|---|---|---|
streamId | uint256 | The 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,
uint40 granularity,
LockupLinear.UnlockAmounts unlockAmounts
);
Parameters
| Name | Type | Description |
|---|---|---|
streamId | uint256 | The ID of the newly created stream. |
commonParams | Lockup.CreateEventCommon | Common parameters emitted in Create events across all Lockup models. |
cliffTime | uint40 | The Unix timestamp for the cliff period's end. A value of zero means there is no cliff. |
granularity | uint40 | The smallest step in time between two consecutive token unlocks. |
unlockAmounts | LockupLinear.UnlockAmounts | Struct encapsulating (i) the amount to unlock at the start time and (ii) the amount to unlock at the cliff time. |