Skip to content

Commit

Permalink
docs: last polishes
Browse files Browse the repository at this point in the history
  • Loading branch information
andreivladbrg committed Nov 5, 2024
1 parent bce8fa4 commit adf6dff
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
2 changes: 0 additions & 2 deletions script/core/Init.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ pragma solidity >=0.8.22 <0.9.0;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { ud2x18 } from "@prb/math/src/UD2x18.sol";

import { ud60x18 } from "@prb/math/src/UD60x18.sol";

import { Solarray } from "solarray/src/Solarray.sol";

import { ISablierLockupDynamic } from "../../src/core/interfaces/ISablierLockupDynamic.sol";
Expand Down
12 changes: 6 additions & 6 deletions src/core/SablierLockupLinear.sol
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,14 @@ contract SablierLockupLinear is
uint256 endTime = _streams[streamId].endTime;
uint128 depositedAmount = _streams[streamId].amounts.deposited;

// If the end time is in the past, return the deposited amount.
// If the end time is not in the future, return the deposited amount.
if (blockTimestamp >= endTime) {
return depositedAmount;
}

uint256 cliffTime = _cliffs[streamId];

// If the cliff time is set and it is in the future, return the start unlock amount.
// If the cliff time is in the future, return the start unlock amount.
if (cliffTime > blockTimestamp) {
return _unlockAmounts[streamId].start;
}
Expand All @@ -229,7 +229,7 @@ contract SablierLockupLinear is
uint128 unlockAmountsSum = _unlockAmounts[streamId].start + _unlockAmounts[streamId].cliff;

// If the sum of the unlock amounts is greater than or equal to the deposited amount, return the deposited
// amount. The ">=" operator is used as a safety measure in case of bug, as the sum of the unlock amounts
// amount. The ">=" operator is used as a safety measure in case of a bug, as the sum of the unlock amounts
// should never exceed the deposited amount.
if (unlockAmountsSum >= depositedAmount) {
return depositedAmount;
Expand All @@ -250,7 +250,7 @@ contract SablierLockupLinear is
UD60x18 elapsedTimePercentage = elapsedTime.div(streamableDuration);
UD60x18 streamableAmount = ud(depositedAmount - unlockAmountsSum);

// The streamed amount is the sum of the unlock amounts plus the product of elapsed time percentage and and
// The streamed amount is the sum of the unlock amounts plus the product of elapsed time percentage and
// streamable amount.
uint128 streamedAmount = unlockAmountsSum + (elapsedTimePercentage.mul(streamableAmount)).intoUint128();

Expand Down Expand Up @@ -295,13 +295,13 @@ contract SablierLockupLinear is
wasCanceled: false
});

// Effect: set the cliff time and cliff unlock amount if it is greater than zero.
// Effect: set the cliff time and cliff unlock amount if cliff time is greater than zero.
if (params.timestamps.cliff > 0) {
_cliffs[streamId] = params.timestamps.cliff;
_unlockAmounts[streamId].cliff = params.unlockAmounts.cliff;
}

// Effect: set the start unlock percentage.
// Effect: set the start unlock amount.
_unlockAmounts[streamId].start = params.unlockAmounts.start;

// Effect: bump the next stream ID.
Expand Down
2 changes: 1 addition & 1 deletion src/core/libraries/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ library Errors {
/// @notice Thrown when trying to create a stream with a start time not strictly less than the end time.
error SablierLockupLinear_StartTimeNotLessThanEndTime(uint40 startTime, uint40 endTime);

/// @notice Thrown when trying to create a stream with the sum of the unlock amounts is greater than deposit amount.
/// @notice Thrown when trying to create a stream with the sum of the unlock amounts greater than deposit amount.
error SablierLockupLinear_UnlockAmountsSumTooHigh(
uint128 depositAmount, uint128 startUnlockAmount, uint128 cliffUnlockAmount
);
Expand Down
1 change: 0 additions & 1 deletion src/core/types/DataTypes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ pragma solidity >=0.8.22;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { UD2x18 } from "@prb/math/src/UD2x18.sol";

import { UD60x18 } from "@prb/math/src/UD60x18.sol";

// DataTypes.sol
Expand Down
2 changes: 1 addition & 1 deletion test/utils/Calculations.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abstract contract Calculations {
return totalAmount - brokerFeeAmount;
}

/// @dev Helper function that replicates the logic of {SablierLockupLinear.streamedAmountOf}.
/// @dev Helper function that replicates the logic of {SablierLockupLinear._calculateStreamedAmount}.
function calculateStreamedAmount(
uint40 startTime,
uint40 cliffTime,
Expand Down

0 comments on commit adf6dff

Please sign in to comment.