Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: polish assumptions in VestingMath #1136

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/libraries/VestingMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ 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 ordered chronologically.
andreivladbrg marked this conversation as resolved.
Show resolved Hide resolved
/// 4. There are no duplicate segment timestamps.
andreivladbrg marked this conversation as resolved.
Show resolved Hide resolved
function calculateLockupDynamicStreamedAmount(
uint128 depositedAmount,
LockupDynamic.Segment[] memory segments,
Expand Down Expand Up @@ -128,7 +130,8 @@ library VestingMath {
/// - $c$ is the cliff unlock amount.
///
/// Assumptions:
/// 1. The sum of the unlock amounts (start and cliff) does not overflow uint128.
/// 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, and the block timestamp is between the start and end times.
andreivladbrg marked this conversation as resolved.
Show resolved Hide resolved
/// 3. If the cliff time is not zero, it is after the start time and before the end time.
function calculateLockupLinearStreamedAmount(
Expand Down Expand Up @@ -211,8 +214,10 @@ 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 ordered chronologically.
andreivladbrg marked this conversation as resolved.
Show resolved Hide resolved
/// 4. There are no duplicate tranche timestamps.
function calculateLockupTranchedStreamedAmount(
uint128 depositedAmount,
uint40 blockTimestamp,
Expand Down
Loading