Click to show 13 findings
File: v2-core/src/SablierV2LockupDynamic.sol
80 function getSegments(uint256 streamId)
91 function getStream(uint256 streamId)
123 function getTimestamps(uint256 streamId)
138 function createWithDurations(LockupDynamic.CreateWithDurations calldata params)
164 function createWithTimestamps(LockupDynamic.CreateWithTimestamps calldata params)
191 function _calculateStreamedAmount(uint256 streamId) internal view override returns (uint128) {
221 function _calculateStreamedAmountForMultipleSegments(uint256 streamId) internal view returns (uint128) {
282 function _calculateStreamedAmountForOneSegment(uint256 streamId) internal view returns (uint128) {
316 function _create(LockupDynamic.CreateWithTimestamps memory params) internal returns (uint256 streamId) {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/SablierV2LockupDynamic.sol#L0:0
File: v2-core/src/SablierV2LockupLinear.sol
71 function getCliffTime(uint256 streamId) external view override notNull(streamId) returns (uint40 cliffTime) {
76 function getStream(uint256 streamId)
108 function getTimestamps(uint256 streamId)
127 function createWithDurations(LockupLinear.CreateWithDurations calldata params)
163 function createWithTimestamps(LockupLinear.CreateWithTimestamps calldata params)
189 function _calculateStreamedAmount(uint256 streamId) internal view override returns (uint128) {
237 function _create(LockupLinear.CreateWithTimestamps memory params) internal returns (uint256 streamId) {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/SablierV2LockupLinear.sol#L0:0
File: v2-core/src/SablierV2LockupTranched.sol
75 function getStream(uint256 streamId)
107 function getTimestamps(uint256 streamId)
118 function getTranches(uint256 streamId)
133 function createWithDurations(LockupTranched.CreateWithDurations calldata params)
159 function createWithTimestamps(LockupTranched.CreateWithTimestamps calldata params)
183 function _calculateStreamedAmount(uint256 streamId) internal view override returns (uint128) {
220 function _create(LockupTranched.CreateWithTimestamps memory params) internal returns (uint256 streamId) {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/SablierV2LockupTranched.sol#L0:0
File: v2-core/src/SablierV2NFTDescriptor.sol
47 function tokenURI(IERC721Metadata sablier, uint256 streamId) external view override returns (string memory uri) {
171 function calculateDurationInDays(uint256 startTime, uint256 endTime) internal pure returns (string memory) {
190 function calculateStreamedPercentage(
206 function generateAccentColor(address sablier, uint256 streamId) internal view returns (string memory) {
240 function generateAttributes(
261 function generateDescription(
301 function generateName(string memory sablierModel, string memory streamId) internal pure returns (string memory) {
307 function mapSymbol(IERC721Metadata sablier) internal view returns (string memory) {
322 function safeAssetDecimals(address asset) internal view returns (uint8) {
334 function safeAssetSymbol(address asset) internal view returns (string memory) {
355 function stringifyFractionalAmount(uint256 fractionalAmount) internal pure returns (string memory) {
372 function stringifyPercentage(uint256 percentage) internal pure returns (string memory) {
384 function stringifyStatus(Lockup.Status status) internal pure returns (string memory) {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/SablierV2NFTDescriptor.sol#L0:0
File: v2-core/src/abstracts/SablierV2Lockup.sol
83 function getAsset(uint256 streamId) external view override notNull(streamId) returns (IERC20 asset) {
88 function getDepositedAmount(uint256 streamId)
99 function getEndTime(uint256 streamId) external view override notNull(streamId) returns (uint40 endTime) {
104 function getRecipient(uint256 streamId) external view override returns (address recipient) {
110 function getRefundedAmount(uint256 streamId)
121 function getSender(uint256 streamId) external view override notNull(streamId) returns (address sender) {
126 function getStartTime(uint256 streamId) external view override notNull(streamId) returns (uint40 startTime) {
131 function getWithdrawnAmount(uint256 streamId)
142 function isCancelable(uint256 streamId) external view override notNull(streamId) returns (bool result) {
149 function isCold(uint256 streamId) external view override notNull(streamId) returns (bool result) {
155 function isDepleted(uint256 streamId) external view override notNull(streamId) returns (bool result) {
160 function isStream(uint256 streamId) external view override returns (bool result) {
165 function isTransferable(uint256 streamId) external view override notNull(streamId) returns (bool result) {
170 function isWarm(uint256 streamId) external view override notNull(streamId) returns (bool result) {
176 function refundableAmountOf(uint256 streamId)
193 function statusOf(uint256 streamId) external view override notNull(streamId) returns (Lockup.Status status) {
198 function streamedAmountOf(uint256 streamId)
209 function tokenURI(uint256 streamId) public view override(IERC721Metadata, ERC721) returns (string memory uri) {
218 function wasCanceled(uint256 streamId) external view override notNull(streamId) returns (bool result) {
223 function withdrawableAmountOf(uint256 streamId)
464 function _calculateStreamedAmount(uint256 streamId) internal view virtual returns (uint128);
468 function _isCallerStreamRecipientOrApproved(uint256 streamId) internal view returns (bool) {
476 function _isCallerStreamSender(uint256 streamId) internal view returns (bool) {
481 function _statusOf(uint256 streamId) internal view returns (Lockup.Status) {
500 function _streamedAmountOf(uint256 streamId) internal view returns (uint128) {
542 function _withdrawableAmountOf(uint256 streamId) internal view returns (uint128) {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/abstracts/SablierV2Lockup.sol#L0:0
File: v2-core/src/libraries/Helpers.sol
17 function calculateSegmentTimestamps(LockupDynamic.SegmentWithDuration[] memory segments)
50 function calculateTrancheTimestamps(LockupTranched.TrancheWithDuration[] memory tranches)
80 function checkAndCalculateBrokerFee(
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/libraries/Helpers.sol#L0:0
File: v2-core/src/libraries/NFTSVG.sol
44 function generateSVG(SVGParams memory params) internal pure returns (string memory) {
98 function generateDefs(
120 function generateFloatingText(
146 function generateHrefs(
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/libraries/NFTSVG.sol#L0:0
File: v2-core/src/libraries/SVGElements.sol
74 function card(CardType cardType, string memory content) internal pure returns (uint256, string memory) {
78 function card(
128 function floatingText(string memory offset, string memory text) internal pure returns (string memory) {
139 function gradients(string memory accentColor) internal pure returns (string memory) {
185 function hourglass(string memory status) internal pure returns (string memory) {
198 function progressCircle(
233 function calculatePixelWidth(string memory text, bool largeFont) internal pure returns (uint256 width) {
255 function stringifyCardType(CardType cardType) internal pure returns (string memory) {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/libraries/SVGElements.sol#L0:0
File: v2-periphery/src/SablierV2BatchLockup.sol
25 function createWithDurationsLD(
73 function createWithTimestampsLD(
126 function createWithDurationsLL(
174 function createWithTimestampsLL(
226 function createWithDurationsLT(
274 function createWithTimestampsLT(
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-periphery/src/SablierV2BatchLockup.sol#L0:0
File: v2-periphery/src/SablierV2MerkleLL.sol
59 function claim(
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-periphery/src/SablierV2MerkleLL.sol#L0:0
File: v2-periphery/src/SablierV2MerkleLT.sol
65 function getTranchesWithPercentages() external view override returns (MerkleLT.TrancheWithPercentage[] memory) {
74 function claim(
120 function _calculateTranches(uint128 claimAmount)
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-periphery/src/SablierV2MerkleLT.sol#L0:0
File: v2-periphery/src/SablierV2MerkleLockupFactory.sol
25 function createMerkleLL(
43 function createMerkleLT(
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-periphery/src/SablierV2MerkleLockupFactory.sol#L0:0
File: v2-periphery/src/abstracts/SablierV2MerkleLockup.sol
83 function getFirstClaimTime() external view override returns (uint40) {
88 function hasClaimed(uint256 index) public view override returns (bool) {
93 function hasExpired() public view override returns (bool) {
98 function name() external view override returns (string memory) {
156 function _hasGracePeriodPassed() internal view returns (bool) {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-periphery/src/abstracts/SablierV2MerkleLockup.sol#L0:0
Click to show 15 findings
File: v2-core/src/SablierV2LockupDynamic.sol
80 function getSegments(uint256 streamId)
91 function getStream(uint256 streamId)
123 function getTimestamps(uint256 streamId)
138 function createWithDurations(LockupDynamic.CreateWithDurations calldata params)
164 function createWithTimestamps(LockupDynamic.CreateWithTimestamps calldata params)
191 function _calculateStreamedAmount(uint256 streamId) internal view override returns (uint128) {
221 function _calculateStreamedAmountForMultipleSegments(uint256 streamId) internal view returns (uint128) {
282 function _calculateStreamedAmountForOneSegment(uint256 streamId) internal view returns (uint128) {
316 function _create(LockupDynamic.CreateWithTimestamps memory params) internal returns (uint256 streamId) {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/SablierV2LockupDynamic.sol#L0:0
File: v2-core/src/SablierV2LockupLinear.sol
71 function getCliffTime(uint256 streamId) external view override notNull(streamId) returns (uint40 cliffTime) {
76 function getStream(uint256 streamId)
108 function getTimestamps(uint256 streamId)
127 function createWithDurations(LockupLinear.CreateWithDurations calldata params)
163 function createWithTimestamps(LockupLinear.CreateWithTimestamps calldata params)
189 function _calculateStreamedAmount(uint256 streamId) internal view override returns (uint128) {
237 function _create(LockupLinear.CreateWithTimestamps memory params) internal returns (uint256 streamId) {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/SablierV2LockupLinear.sol#L0:0
File: v2-core/src/SablierV2LockupTranched.sol
75 function getStream(uint256 streamId)
107 function getTimestamps(uint256 streamId)
118 function getTranches(uint256 streamId)
133 function createWithDurations(LockupTranched.CreateWithDurations calldata params)
159 function createWithTimestamps(LockupTranched.CreateWithTimestamps calldata params)
183 function _calculateStreamedAmount(uint256 streamId) internal view override returns (uint128) {
220 function _create(LockupTranched.CreateWithTimestamps memory params) internal returns (uint256 streamId) {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/SablierV2LockupTranched.sol#L0:0
File: v2-core/src/SablierV2NFTDescriptor.sol
47 function tokenURI(IERC721Metadata sablier, uint256 streamId) external view override returns (string memory uri) {
171 function calculateDurationInDays(uint256 startTime, uint256 endTime) internal pure returns (string memory) {
190 function calculateStreamedPercentage(
206 function generateAccentColor(address sablier, uint256 streamId) internal view returns (string memory) {
240 function generateAttributes(
261 function generateDescription(
301 function generateName(string memory sablierModel, string memory streamId) internal pure returns (string memory) {
307 function mapSymbol(IERC721Metadata sablier) internal view returns (string memory) {
322 function safeAssetDecimals(address asset) internal view returns (uint8) {
334 function safeAssetSymbol(address asset) internal view returns (string memory) {
384 function stringifyStatus(Lockup.Status status) internal pure returns (string memory) {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/SablierV2NFTDescriptor.sol#L0:0
File: v2-core/src/abstracts/Adminable.sol
34 function transferAdmin(address newAdmin) public virtual override onlyAdmin {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/abstracts/Adminable.sol#L0:0
File: v2-core/src/abstracts/NoDelegateCall.sol
13 constructor() {
29 function _preventDelegateCall() private view {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/abstracts/NoDelegateCall.sol#L0:0
File: v2-core/src/abstracts/SablierV2Lockup.sol
83 function getAsset(uint256 streamId) external view override notNull(streamId) returns (IERC20 asset) {
88 function getDepositedAmount(uint256 streamId)
99 function getEndTime(uint256 streamId) external view override notNull(streamId) returns (uint40 endTime) {
104 function getRecipient(uint256 streamId) external view override returns (address recipient) {
110 function getRefundedAmount(uint256 streamId)
121 function getSender(uint256 streamId) external view override notNull(streamId) returns (address sender) {
126 function getStartTime(uint256 streamId) external view override notNull(streamId) returns (uint40 startTime) {
131 function getWithdrawnAmount(uint256 streamId)
142 function isCancelable(uint256 streamId) external view override notNull(streamId) returns (bool result) {
149 function isCold(uint256 streamId) external view override notNull(streamId) returns (bool result) {
155 function isDepleted(uint256 streamId) external view override notNull(streamId) returns (bool result) {
160 function isStream(uint256 streamId) external view override returns (bool result) {
165 function isTransferable(uint256 streamId) external view override notNull(streamId) returns (bool result) {
170 function isWarm(uint256 streamId) external view override notNull(streamId) returns (bool result) {
176 function refundableAmountOf(uint256 streamId)
193 function statusOf(uint256 streamId) external view override notNull(streamId) returns (Lockup.Status status) {
198 function streamedAmountOf(uint256 streamId)
209 function tokenURI(uint256 streamId) public view override(IERC721Metadata, ERC721) returns (string memory uri) {
218 function wasCanceled(uint256 streamId) external view override notNull(streamId) returns (bool result) {
223 function withdrawableAmountOf(uint256 streamId)
238 function burn(uint256 streamId) external override noDelegateCall notNull(streamId) {
256 function cancel(uint256 streamId) public override noDelegateCall notNull(streamId) {
274 function cancelMultiple(uint256[] calldata streamIds) external override noDelegateCall {
284 function renounce(uint256 streamId) external override noDelegateCall notNull(streamId) updateMetadata(streamId) {
315 function setNFTDescriptor(ISablierV2NFTDescriptor newNFTDescriptor) external override onlyAdmin {
332 function withdraw(
405 function withdrawMax(uint256 streamId, address to) external override {
410 function withdrawMaxAndTransfer(
436 function withdrawMultiple(
481 function _statusOf(uint256 streamId) internal view returns (Lockup.Status) {
500 function _streamedAmountOf(uint256 streamId) internal view returns (uint128) {
542 function _withdrawableAmountOf(uint256 streamId) internal view returns (uint128) {
551 function _cancel(uint256 streamId) internal {
620 function _renounce(uint256 streamId) internal {
631 function _withdraw(uint256 streamId, address to, uint128 amount) internal {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/abstracts/SablierV2Lockup.sol#L0:0
File: v2-core/src/libraries/Helpers.sol
17 function calculateSegmentTimestamps(LockupDynamic.SegmentWithDuration[] memory segments)
50 function calculateTrancheTimestamps(LockupTranched.TrancheWithDuration[] memory tranches)
80 function checkAndCalculateBrokerFee(
111 function checkCreateLockupDynamic(
146 function checkCreateLockupLinear(uint128 depositAmount, LockupLinear.Timestamps memory timestamps) internal view {
183 function checkCreateLockupTranched(
227 function _checkSegments(
290 function _checkTranches(
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/libraries/Helpers.sol#L0:0
File: v2-core/src/libraries/NFTSVG.sol
44 function generateSVG(SVGParams memory params) internal pure returns (string memory) {
98 function generateDefs(
120 function generateFloatingText(
146 function generateHrefs(
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/libraries/NFTSVG.sol#L0:0
File: v2-core/src/libraries/SVGElements.sol
74 function card(CardType cardType, string memory content) internal pure returns (uint256, string memory) {
78 function card(
128 function floatingText(string memory offset, string memory text) internal pure returns (string memory) {
139 function gradients(string memory accentColor) internal pure returns (string memory) {
185 function hourglass(string memory status) internal pure returns (string memory) {
198 function progressCircle(
233 function calculatePixelWidth(string memory text, bool largeFont) internal pure returns (uint256 width) {
255 function stringifyCardType(CardType cardType) internal pure returns (string memory) {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/libraries/SVGElements.sol#L0:0
File: v2-periphery/src/SablierV2BatchLockup.sol
25 function createWithDurationsLD(
73 function createWithTimestampsLD(
126 function createWithDurationsLL(
174 function createWithTimestampsLL(
226 function createWithDurationsLT(
274 function createWithTimestampsLT(
330 function _approve(address sablierContract, IERC20 asset, uint256 amount) internal {
339 function _handleTransfer(address sablierContract, IERC20 asset, uint256 amount) internal {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-periphery/src/SablierV2BatchLockup.sol#L0:0
File: v2-periphery/src/SablierV2MerkleLL.sol
40 constructor(
59 function claim(
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-periphery/src/SablierV2MerkleLL.sol#L0:0
File: v2-periphery/src/SablierV2MerkleLT.sol
40 constructor(
65 function getTranchesWithPercentages() external view override returns (MerkleLT.TrancheWithPercentage[] memory) {
74 function claim(
120 function _calculateTranches(uint128 claimAmount)
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-periphery/src/SablierV2MerkleLT.sol#L0:0
File: v2-periphery/src/SablierV2MerkleLockupFactory.sol
25 function createMerkleLL(
43 function createMerkleLT(
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-periphery/src/SablierV2MerkleLockupFactory.sol#L0:0
File: v2-periphery/src/abstracts/SablierV2MerkleLockup.sol
59 constructor(MerkleLockup.ConstructorParams memory params) {
83 function getFirstClaimTime() external view override returns (uint40) {
88 function hasClaimed(uint256 index) public view override returns (bool) {
93 function hasExpired() public view override returns (bool) {
98 function name() external view override returns (string memory) {
107 function clawback(address to, uint128 amount) external override onlyAdmin {
129 function _checkClaim(uint256 index, bytes32 leaf, bytes32[] calldata merkleProof) internal {
156 function _hasGracePeriodPassed() internal view returns (bool) {
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-periphery/src/abstracts/SablierV2MerkleLockup.sol#L0:0
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-periphery/src/SablierV2MerkleLL.sol#L0:0
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-periphery/src/abstracts/SablierV2MerkleLockup.sol#L0:0
In Solidity, complex inheritance structures can obfuscate code understanding, introducing potential security risks. Multiple inheritance, especially with overlapping function names or state variables, can cause unintentional overrides or ambiguous behavior. Resolution: Strive for linear and simple inheritance chains. Avoid diamond or circular inheritance patterns. Clearly document the purpose and relationships of base contracts, ensuring that overrides are intentional. Tools like Remix or Hardhat can visualize inheritance chains, assisting in verification. Keeping inheritance streamlined aids in better code readability, reduces potential errors, and ensures smoother audits and upgrades.
Combining multiple libraries, interfaces, or contracts in a single file can lead to clutter, reduced readability, and versioning issues. Resolution: Adopt the best practice of defining only one library, interface, or contract per Solidity file. This modular approach enhances clarity, simplifies unit testing, and streamlines code review. Furthermore, segregating components makes version management easier, as updates to one component won't necessitate changes to a file housing multiple unrelated components. Structured file management can further assist in avoiding naming collisions and ensure smoother integration into larger systems or DApps.
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-core/src/types/DataTypes.sol#L0:0
https://github.com/Cyfrin/2024-05-Sablier/tree/main/v2-periphery/src/types/DataTypes.sol#L0:0