Skip to main content

LockupDynamic

Git Source

Namespace for the structs used in SablierV2LockupDynamic.

Structs

CreateWithDurations

Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithDurations} function.

struct CreateWithDurations {
address sender;
address recipient;
uint128 totalAmount;
IERC20 asset;
bool cancelable;
bool transferable;
SegmentWithDuration[] segments;
Broker broker;
}

Properties

NameTypeDescription
senderaddressThe address distributing the assets, with the ability to cancel the stream. It doesn't have to be the same as msg.sender.
recipientaddressThe address receiving the assets.
totalAmountuint128The total amount of ERC-20 assets to be distributed, including the stream deposit and any broker fee, both denoted in units of the asset's decimals.
assetIERC20The contract address of the ERC-20 asset to be distributed.
cancelableboolIndicates if the stream is cancelable.
transferableboolIndicates if the stream NFT is transferable.
segmentsSegmentWithDuration[]Segments with durations used to compose the dynamic distribution function. Timestamps are calculated by starting from block.timestamp and adding each duration to the previous timestamp.
brokerBrokerStruct containing (i) the address of the broker assisting in creating the stream, and (ii) the percentage fee paid to the broker from totalAmount, denoted as a fixed-point number. Both can be set to zero.

CreateWithTimestamps

Struct encapsulating the parameters of the {SablierV2LockupDynamic.createWithTimestamps} function.

struct CreateWithTimestamps {
address sender;
address recipient;
uint128 totalAmount;
IERC20 asset;
bool cancelable;
bool transferable;
uint40 startTime;
Segment[] segments;
Broker broker;
}

Properties

NameTypeDescription
senderaddressThe address distributing the assets, with the ability to cancel the stream. It doesn't have to be the same as msg.sender.
recipientaddressThe address receiving the assets.
totalAmountuint128The total amount of ERC-20 assets to be distributed, including the stream deposit and any broker fee, both denoted in units of the asset's decimals.
assetIERC20The contract address of the ERC-20 asset to be distributed.
cancelableboolIndicates if the stream is cancelable.
transferableboolIndicates if the stream NFT is transferable.
startTimeuint40The Unix timestamp indicating the stream's start.
segmentsSegment[]Segments used to compose the dynamic distribution function.
brokerBrokerStruct containing (i) the address of the broker assisting in creating the stream, and (ii) the percentage fee paid to the broker from totalAmount, denoted as a fixed-point number. Both can be set to zero.

Segment

Segment struct used in the Lockup Dynamic stream.

struct Segment {
uint128 amount;
UD2x18 exponent;
uint40 timestamp;
}

Properties

NameTypeDescription
amountuint128The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.
exponentUD2x18The exponent of the segment, denoted as a fixed-point number.
timestampuint40The Unix timestamp indicating the segment's end.

SegmentWithDuration

Segment struct used at runtime in {SablierV2LockupDynamic.createWithDurations}.

struct SegmentWithDuration {
uint128 amount;
UD2x18 exponent;
uint40 duration;
}

Properties

NameTypeDescription
amountuint128The amount of assets to be streamed in the segment, denoted in units of the asset's decimals.
exponentUD2x18The exponent of the segment, denoted as a fixed-point number.
durationuint40The time difference in seconds between the segment and the previous one.

StreamLD

Struct encapsulating the full details of a stream.

Extends Lockup.Stream by including the recipient and the segments.

struct StreamLD {
address sender;
address recipient;
uint40 startTime;
uint40 endTime;
bool isCancelable;
bool wasCanceled;
IERC20 asset;
bool isDepleted;
bool isStream;
bool isTransferable;
Lockup.Amounts amounts;
Segment[] segments;
}

Timestamps

Struct encapsulating the LockupDynamic timestamps.

struct Timestamps {
uint40 start;
uint40 end;
}

Properties

NameTypeDescription
startuint40The Unix timestamp indicating the stream's start.
enduint40The Unix timestamp indicating the stream's end.