SablierLockupTranched
Inherits: ISablierLockupTranched, NoDelegateCall, SablierLockupState
See the documentation in ISablierLockupTranched.
Functions
createWithDurationsLT
Creates a stream by setting the start time to block.timestamp, and the end time to the sum of block.timestamp and
all specified time durations. The tranche timestamps are derived from these durations. The stream is funded by
msg.sender and is wrapped in an ERC-721 NFT.
Emits a {Transfer}, {CreateLockupTrancheStream} and {MetadataUpdate} event. Requirements:
- All requirements in {createWithTimestampsLT} must be met for the calculated parameters.
function createWithDurationsLT(
Lockup.CreateWithDurations calldata params,
LockupTranched.TrancheWithDuration[] calldata tranchesWithDuration
)
external
payable
override
noDelegateCall
returns (uint256 streamId);
Parameters
| Name | Type | Description |
|---|---|---|
params | Lockup.CreateWithDurations | Struct encapsulating the function parameters, which are documented in {Lockup} type. |
tranchesWithDuration | LockupTranched.TrancheWithDuration[] | Tranches with durations used to compose the tranched distribution function. Timestamps are calculated by starting from block.timestamp and adding each duration to the previous timestamp. |
Returns
| Name | Type | Description |
|---|---|---|
streamId | uint256 | The ID of the newly created stream. |
createWithTimestampsLT
Creates a stream with the provided tranche timestamps, implying the end time from the last timestamp. The stream is
funded by msg.sender and is wrapped in an ERC-721 NFT.
Emits a {Transfer}, {CreateLockupTrancheStream} and {MetadataUpdate} event. Notes:
- As long as the tranche timestamps are arranged in ascending order, it is not an error for some of them 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 than the first tranche's timestamp.tranchesmust have at least one tranche.- The tranche timestamps must be arranged in ascending order.
params.timestamps.endmust be equal to the last tranche's timestamp.- The sum of the tranche amounts must equal the deposit amount.
params.recipientmust not be the zero address.params.sendermust not be the zero address.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 createWithTimestampsLT(
Lockup.CreateWithTimestamps calldata params,
LockupTranched.Tranche[] calldata tranches
)
external
payable
override
noDelegateCall
returns (uint256 streamId);
Parameters
| Name | Type | Description |
|---|---|---|
params | Lockup.CreateWithTimestamps | Struct encapsulating the function parameters, which are documented in {Lockup} type. |
tranches | LockupTranched.Tranche[] | Tranches used to compose the tranched distribution function. |
Returns
| Name | Type | Description |
|---|---|---|
streamId | uint256 | The ID of the newly created stream. |
_createLT
See the documentation for the user-facing functions that call this private function.
function _createLT(
bool cancelable,
uint128 depositAmount,
address recipient,
address sender,
string memory shape,
Lockup.Timestamps memory timestamps,
IERC20 token,
bool transferable,
LockupTranched.Tranche[] memory tranches
)
private
returns (uint256 streamId);