Skip to main content

Segments

Definition

A Lockup Dynamic stream is composed of multiple segments, which are separate partitions with different streaming amount and rates. The protocol uses these segments to enable custom streaming curves, which power exponential streams, cliff streams, etc.

Technically, a segment is a struct with three fields:

FieldTypeDescription
Amountuint128The amount of tokens to be streamed in this segment, denoted in units of the token's decimals.
ExponentUD2x18The exponent of this segment, denoted as a fixed-point number.
Timestampuint40The Unix timestamp indicating this segment's end.

Each segment has its own streaming function:

f(x)=xexpcsaf(x) = x^{exp} * csa

Therefore, the distribution function of a dynamic stream becomes:

f(x)=xexpcsa+Σ(esa)f(x) = x^{exp} * csa + \Sigma(esa)

Where:

  • xx is the elapsed time divided by the total time in the current segment.
  • expexp is the current segment exponent.
  • csacsa is the current segment amount.
  • Σ(esa)\Sigma(esa) is the sum of all elapsed segments' amounts.
info

Segments can be used to represent any monotonic increasing function.

caution

Because x is a percentage, the payment rate is inversely proportional to the exponent. For example, if the exponent is 0.5, the rate is quadratically faster compared to the baseline when the exponent is 1.

Conversely, if the exponent is 2, the rate is quadratically slower compared to baseline.

Requirements