Skip to content

Commit

Permalink
docs: polish assumptions in VestingMath (#1136)
Browse files Browse the repository at this point in the history
* docs: add one more assumptions in VestingMath

* docs: polish assumptions
  • Loading branch information
andreivladbrg authored Jan 10, 2025
1 parent 47c52ec commit d37730d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/libraries/VestingMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ library VestingMath {
///
/// Assumptions:
/// 1. The sum of all segment amounts does not overflow uint128.
/// 2. The segment timestamps are ordered chronologically.
/// 3. There are no duplicate segment timestamps.
/// 2. The first segment's timestamp is greater than the start time and the last segment's timestamp
/// equals the end time.
/// 3. The segment timestamps are arranged in ascending order.
function calculateLockupDynamicStreamedAmount(
uint128 depositedAmount,
LockupDynamic.Segment[] memory segments,
Expand Down Expand Up @@ -128,8 +129,9 @@ library VestingMath {
/// - $c$ is the cliff unlock amount.
///
/// Assumptions:
/// 1. The sum of the unlock amounts (start and cliff) does not overflow uint128.
/// 2. The start time is before the end time, and the block timestamp is between the start and end times.
/// 1. The sum of the unlock amounts (start and cliff) does not overflow uint128 and is less than or equal to
/// deposit amount.
/// 2. The start time is before the end time.
/// 3. If the cliff time is not zero, it is after the start time and before the end time.
function calculateLockupLinearStreamedAmount(
uint128 depositedAmount,
Expand Down Expand Up @@ -211,8 +213,9 @@ library VestingMath {
///
/// Assumptions:
/// 1. The sum of all tranche amounts does not overflow uint128.
/// 2. The tranche timestamps are ordered chronologically.
/// 3. There are no duplicate tranche timestamps.
/// 2. The first tranche's timestamp is greater than the start time and the last tranche's timestamp
/// equals the end time.
/// 3. The tranche timestamps are arranged in ascending order.
function calculateLockupTranchedStreamedAmount(
uint128 depositedAmount,
uint40 blockTimestamp,
Expand Down

0 comments on commit d37730d

Please sign in to comment.