From d37730d4b66af6ea955081de6b14897dc5de216e Mon Sep 17 00:00:00 2001 From: Andrei Vlad Birgaoanu <99738872+andreivladbrg@users.noreply.github.com> Date: Fri, 10 Jan 2025 16:46:36 +0200 Subject: [PATCH] docs: polish assumptions in VestingMath (#1136) * docs: add one more assumptions in VestingMath * docs: polish assumptions --- src/libraries/VestingMath.sol | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/libraries/VestingMath.sol b/src/libraries/VestingMath.sol index fd507bbd0..a846020cb 100644 --- a/src/libraries/VestingMath.sol +++ b/src/libraries/VestingMath.sol @@ -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, @@ -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, @@ -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,