From adf6dff5aff2caad02a4b6d770434cbf0fc4024d Mon Sep 17 00:00:00 2001 From: andreivladbrg Date: Wed, 6 Nov 2024 00:54:27 +0200 Subject: [PATCH] docs: last polishes --- script/core/Init.s.sol | 2 -- src/core/SablierLockupLinear.sol | 12 ++++++------ src/core/libraries/Errors.sol | 2 +- src/core/types/DataTypes.sol | 1 - test/utils/Calculations.sol | 2 +- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/script/core/Init.s.sol b/script/core/Init.s.sol index ae5e63833..d6c9fc657 100644 --- a/script/core/Init.s.sol +++ b/script/core/Init.s.sol @@ -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"; diff --git a/src/core/SablierLockupLinear.sol b/src/core/SablierLockupLinear.sol index 8e6b9a71a..f91f04100 100644 --- a/src/core/SablierLockupLinear.sol +++ b/src/core/SablierLockupLinear.sol @@ -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; } @@ -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; @@ -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(); @@ -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. diff --git a/src/core/libraries/Errors.sol b/src/core/libraries/Errors.sol index 0dc0aec25..d3b45e3b5 100644 --- a/src/core/libraries/Errors.sol +++ b/src/core/libraries/Errors.sol @@ -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 ); diff --git a/src/core/types/DataTypes.sol b/src/core/types/DataTypes.sol index 0bb31a623..bfe1606f2 100644 --- a/src/core/types/DataTypes.sol +++ b/src/core/types/DataTypes.sol @@ -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 diff --git a/test/utils/Calculations.sol b/test/utils/Calculations.sol index c7571eb9b..6f2785a74 100644 --- a/test/utils/Calculations.sol +++ b/test/utils/Calculations.sol @@ -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,