From 7e9cec031c43dc71946d77be6d090f221796feda Mon Sep 17 00:00:00 2001 From: Paul Razvan Berg Date: Sun, 23 Oct 2022 20:28:13 +0300 Subject: [PATCH] test: improve wording in testing trees test: add new "operator" user test: add new testing branches for un/authorized test: delete superfluous warps in "withdraw" tests test: move assertions for recipients at the bottom test: refer to approved "third-party" as "operator" test: rename "withdrawAmountZero" to "withdrawAmount" test: refactor "CallerRecipient" to "OriginalRecipient" test: use the new operator user in the "approved operator" tests --- test/unit/SablierV2UnitTest.t.sol | 12 ++++- .../cancel-all/cancelAll.t.sol | 36 ++++++------- .../cancel-all/cancelAll.tree | 12 ++--- .../sablier-v2-linear/cancel/cancel.t.sol | 18 +++---- .../unit/sablier-v2-linear/cancel/cancel.tree | 31 +++++------ .../createWithDuration.t.sol | 6 +-- .../sablier-v2-linear/create/create.t.sol | 24 ++++----- .../withdraw-all-to/withdrawAllTo.t.sol | 28 +++++----- .../withdraw-all-to/withdrawAllTo.tree | 12 ++--- .../withdraw-all/withdrawAll.t.sol | 40 +++++++-------- .../withdraw-all/withdrawAll.tree | 12 ++--- .../withdraw-to/withdrawTo.t.sol | 51 +++++++++---------- .../withdraw-to/withdrawTo.tree | 6 +-- .../sablier-v2-linear/withdraw/withdraw.t.sol | 42 +++++++-------- .../sablier-v2-linear/withdraw/withdraw.tree | 39 +++++++------- .../createWithDuration.tree | 18 +++---- test/unit/sablier-v2-pro/create/create.t.sol | 12 ++--- test/unit/sablier-v2-pro/create/create.tree | 2 +- 18 files changed, 206 insertions(+), 195 deletions(-) diff --git a/test/unit/SablierV2UnitTest.t.sol b/test/unit/SablierV2UnitTest.t.sol index 73394305e..a123e2564 100644 --- a/test/unit/SablierV2UnitTest.t.sol +++ b/test/unit/SablierV2UnitTest.t.sol @@ -45,6 +45,7 @@ abstract contract SablierV2UnitTest is Test { struct Users { address payable alice; address payable eve; + address payable operator; address payable recipient; address payable sender; } @@ -76,13 +77,22 @@ abstract contract SablierV2UnitTest is Test { STOP_TIME = block.timestamp + TOTAL_DURATION; // Create 5 users for testing. Order matters. - users = Users({ sender: getNextUser(), recipient: getNextUser(), eve: getNextUser(), alice: getNextUser() }); + users = Users({ + sender: getNextUser(), + recipient: getNextUser(), + operator: getNextUser(), + eve: getNextUser(), + alice: getNextUser() + }); fundUser(users.sender); vm.label(users.sender, "Sender"); fundUser(users.recipient); vm.label(users.recipient, "Recipient"); + fundUser(users.operator); + vm.label(users.operator, "Operator"); + fundUser(users.eve); vm.label(users.eve, "Eve"); diff --git a/test/unit/sablier-v2-linear/cancel-all/cancelAll.t.sol b/test/unit/sablier-v2-linear/cancel-all/cancelAll.t.sol index 4273eba61..9e9b26fbc 100644 --- a/test/unit/sablier-v2-linear/cancel-all/cancelAll.t.sol +++ b/test/unit/sablier-v2-linear/cancel-all/cancelAll.t.sol @@ -133,17 +133,17 @@ contract SablierV2Linear__CancelAll is SablierV2LinearUnitTest { } /// @dev it should cancel and delete the streams. - function testCancelAll__CallerApprovedThirdPartyAllStreams() + function testCancelAll__CallerApprovedOperatorAllStreams() external OnlyExistentStreams AllStreamsCancelable CallerAuthorizedAllStreams { - // Approve Alice for all the streams. - sablierV2Linear.setApprovalForAll(users.alice, true); + // Approve the operator for all streams. + sablierV2Linear.setApprovalForAll(users.operator, true); - // Make Alice the `msg.sender` in this test case. - changePrank(users.alice); + // Make the operator the `msg.sender` in this test case. + changePrank(users.operator); // Run the test. sablierV2Linear.cancelAll(defaultStreamIds); @@ -161,16 +161,16 @@ contract SablierV2Linear__CancelAll is SablierV2LinearUnitTest { } /// @dev it should revert. - function testCannotCancelAll__RecipientNotOwnerAllStreams() + function testCannotCancelAll__OriginalRecipientTransferredOwnershipAllStreams() external OnlyExistentStreams AllStreamsCancelable CallerAuthorizedAllStreams CallerRecipientAllStreams { - // Transfer the streams to eve. - sablierV2Linear.safeTransferFrom(users.recipient, users.eve, defaultStreamIds[0]); - sablierV2Linear.safeTransferFrom(users.recipient, users.eve, defaultStreamIds[1]); + // Transfer the streams to Alice. + sablierV2Linear.safeTransferFrom(users.recipient, users.alice, defaultStreamIds[0]); + sablierV2Linear.safeTransferFrom(users.recipient, users.alice, defaultStreamIds[1]); // Run the test. vm.expectRevert( @@ -180,7 +180,7 @@ contract SablierV2Linear__CancelAll is SablierV2LinearUnitTest { } /// @dev it should revert. - function testCannotCancelAll__RecipientNotOwnerSomeStreams() + function testCannotCancelAll__OriginalRecipientTransferredOnwershipSomeStreams() external OnlyExistentStreams AllStreamsCancelable @@ -188,7 +188,7 @@ contract SablierV2Linear__CancelAll is SablierV2LinearUnitTest { CallerRecipientAllStreams { // Transfer one of the streams to eve. - sablierV2Linear.safeTransferFrom(users.recipient, users.eve, defaultStreamIds[0]); + sablierV2Linear.safeTransferFrom(users.recipient, users.alice, defaultStreamIds[0]); // Run the test. vm.expectRevert( @@ -197,7 +197,7 @@ contract SablierV2Linear__CancelAll is SablierV2LinearUnitTest { sablierV2Linear.cancelAll(defaultStreamIds); } - modifier RecipientOwnerAllStreams() { + modifier OriginalRecipientAllStreams() { _; } @@ -208,7 +208,7 @@ contract SablierV2Linear__CancelAll is SablierV2LinearUnitTest { AllStreamsCancelable CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams { // Warp to the end of the stream. vm.warp(daiStream.stopTime); @@ -231,7 +231,7 @@ contract SablierV2Linear__CancelAll is SablierV2LinearUnitTest { AllStreamsCancelable CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams { // Warp to the end of the stream. vm.warp(daiStream.stopTime); @@ -255,7 +255,7 @@ contract SablierV2Linear__CancelAll is SablierV2LinearUnitTest { AllStreamsCancelable CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams { // Warp to 2,600 seconds after the start time (26% of the default stream duration). vm.warp(daiStream.startTime + TIME_OFFSET); @@ -278,7 +278,7 @@ contract SablierV2Linear__CancelAll is SablierV2LinearUnitTest { AllStreamsCancelable CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams { // Warp to 2,600 seconds after the start time (26% of the default stream duration). vm.warp(daiStream.startTime + TIME_OFFSET); @@ -301,7 +301,7 @@ contract SablierV2Linear__CancelAll is SablierV2LinearUnitTest { AllStreamsCancelable CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams { // Use the first default stream as the ongoing daiStream. uint256 ongoingStreamId = defaultStreamIds[0]; @@ -341,7 +341,7 @@ contract SablierV2Linear__CancelAll is SablierV2LinearUnitTest { AllStreamsCancelable CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams { // Use the first default stream as the ongoing daiStream. uint256 ongoingStreamId = defaultStreamIds[0]; diff --git a/test/unit/sablier-v2-linear/cancel-all/cancelAll.tree b/test/unit/sablier-v2-linear/cancel-all/cancelAll.tree index 6128956b1..ca21d443e 100644 --- a/test/unit/sablier-v2-linear/cancel-all/cancelAll.tree +++ b/test/unit/sablier-v2-linear/cancel-all/cancelAll.tree @@ -9,20 +9,20 @@ cancelAll.t.sol ├── when some of the streams are non-cancelable │ └── it should cancel and delete the cancelable streams └── when all streams are cancelable - ├── when the caller is neither the sender nor authorized of any stream + ├── when the caller is not authorized for any stream │ └── it should revert - ├── when the caller is neither the sender nor authorized of some of the streams + ├── when the caller is not authorized for some streams │ └── it should revert ├── when the caller is the sender of all streams │ └── it should cancel and delete the streams - ├── when the caller is an approved third-party for all the streams + ├── when the caller is an approved operator for all streams │ └── it should cancel and delete the streams └── when the caller is the recipient of all streams - ├── when the recipient transferred all the streams and does not own any + ├── when the original recipient transferred ownership of all streams │ └── it should revert - ├── when the recipient transferred some of the streams and does not own all of them + ├── when the original recipient transferred ownership of some of the streams │ └── it should revert - └── when the recipient owns all the streams + └── when the original recipient did not transfer ownership of any stream ├── when all streams are ended │ ├── it should cancel and delete the streams │ └── it should emit multiple Cancel events diff --git a/test/unit/sablier-v2-linear/cancel/cancel.t.sol b/test/unit/sablier-v2-linear/cancel/cancel.t.sol index 94e37e7da..042601c32 100644 --- a/test/unit/sablier-v2-linear/cancel/cancel.t.sol +++ b/test/unit/sablier-v2-linear/cancel/cancel.t.sol @@ -74,7 +74,7 @@ contract SablierV2Linear__Cancel is SablierV2LinearUnitTest { } /// @dev it should cancel and delete the stream. - function testCancel__CallerApprovedThirdParty() external StreamExistent StreamCancelable CallerAuthorized { + function testCancel__CallerApprovedOperator() external StreamExistent StreamCancelable CallerAuthorized { // Approve Alice for the stream. sablierV2Linear.approve(users.alice, daiStreamId); @@ -93,15 +93,15 @@ contract SablierV2Linear__Cancel is SablierV2LinearUnitTest { } /// @dev it should revert. - function testCannotCancel__RecipientNotOwner() + function testCannotCancel__OriginalRecipientTransferredOwnership() external StreamExistent StreamCancelable CallerAuthorized CallerRecipient { - // Transfer the stream to eve. - sablierV2Linear.safeTransferFrom(users.recipient, users.eve, daiStreamId); + // Transfer the stream to Alice. + sablierV2Linear.safeTransferFrom(users.recipient, users.alice, daiStreamId); // Run the test. vm.expectRevert( @@ -110,7 +110,7 @@ contract SablierV2Linear__Cancel is SablierV2LinearUnitTest { sablierV2Linear.cancel(daiStreamId); } - modifier RecipientOwner() { + modifier OriginalRecipient() { _; } @@ -121,7 +121,7 @@ contract SablierV2Linear__Cancel is SablierV2LinearUnitTest { StreamCancelable CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient { // Warp to the end of the stream. vm.warp(daiStream.stopTime); @@ -140,7 +140,7 @@ contract SablierV2Linear__Cancel is SablierV2LinearUnitTest { StreamCancelable CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient { // Warp to the end of the stream. vm.warp(daiStream.stopTime); @@ -159,7 +159,7 @@ contract SablierV2Linear__Cancel is SablierV2LinearUnitTest { StreamCancelable CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient { // Warp to 2,600 seconds after the start time (26% of the default stream duration). vm.warp(daiStream.startTime + TIME_OFFSET); @@ -178,7 +178,7 @@ contract SablierV2Linear__Cancel is SablierV2LinearUnitTest { StreamCancelable CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient { // Warp to 2,600 seconds after the start time (26% of the default stream duration). vm.warp(daiStream.startTime + TIME_OFFSET); diff --git a/test/unit/sablier-v2-linear/cancel/cancel.tree b/test/unit/sablier-v2-linear/cancel/cancel.tree index 28eea1c05..756c5774d 100644 --- a/test/unit/sablier-v2-linear/cancel/cancel.tree +++ b/test/unit/sablier-v2-linear/cancel/cancel.tree @@ -5,19 +5,20 @@ cancel.t.sol ├── when the stream is non-cancelable │ └── it should revert └── when the stream is cancelable - ├── when the caller is neither the sender nor authorized + ├── when the caller is not authorized │ └── it should revert - ├── when the caller is the sender - │ └── it should cancel and delete the stream - ├── when the caller is an approved third-party - │ └── it should cancel and delete the stream - └── when the caller is the recipient - ├── when the recipient transferred the stream and does not own it - │ └── it should revert - └── when the recipient owns the stream - ├── when the stream ended - │ ├── it should cancel and delete the stream - │ └── it should emit a Cancel event - └── when the stream did not end - ├── it should cancel and delete the stream - └── it should emit a Cancel event + └── when the caller is authorized + ├── when the caller is the sender + │ └── it should cancel and delete the stream + ├── when the caller is an approved operator + │ └── it should cancel and delete the stream + └── when the caller is the recipient + ├── when the original recipient transferred ownership of the stream + │ └── it should revert + └── when the original recipient did not transfer ownership of the stream + ├── when the stream ended + │ ├── it should cancel and delete the stream + │ └── it should emit a Cancel event + └── when the stream did not end + ├── it should cancel and delete the stream + └── it should emit a Cancel event diff --git a/test/unit/sablier-v2-linear/create-with-duration/createWithDuration.t.sol b/test/unit/sablier-v2-linear/create-with-duration/createWithDuration.t.sol index 48595c7e5..bcaccbc7c 100644 --- a/test/unit/sablier-v2-linear/create-with-duration/createWithDuration.t.sol +++ b/test/unit/sablier-v2-linear/create-with-duration/createWithDuration.t.sol @@ -97,9 +97,6 @@ contract SablierV2Linear__CreateWithDuration is SablierV2LinearUnitTest { daiStream.cancelable ); - address actualRecipient = sablierV2Linear.getRecipient(daiStreamId); - assertEq(actualRecipient, users.recipient); - ISablierV2Linear.Stream memory actualStream = sablierV2Linear.getStream(daiStreamId); assertEq(actualStream.sender, daiStream.sender); assertEq(actualStream.depositAmount, daiStream.depositAmount); @@ -109,5 +106,8 @@ contract SablierV2Linear__CreateWithDuration is SablierV2LinearUnitTest { assertEq(actualStream.stopTime, stopTime); assertEq(actualStream.cancelable, daiStream.cancelable); assertEq(actualStream.withdrawnAmount, daiStream.withdrawnAmount); + + address actualRecipient = sablierV2Linear.getRecipient(daiStreamId); + assertEq(actualRecipient, users.recipient); } } diff --git a/test/unit/sablier-v2-linear/create/create.t.sol b/test/unit/sablier-v2-linear/create/create.t.sol index f25232b0c..5a4dce538 100644 --- a/test/unit/sablier-v2-linear/create/create.t.sol +++ b/test/unit/sablier-v2-linear/create/create.t.sol @@ -85,9 +85,6 @@ contract SablierV2Linear__Create is SablierV2LinearUnitTest { daiStream.cancelable ); - address actualRecipient = sablierV2Linear.getRecipient(daiStreamId); - assertEq(actualRecipient, users.recipient); - ISablierV2Linear.Stream memory actualStream = sablierV2Linear.getStream(daiStreamId); assertEq(actualStream.sender, daiStream.sender); assertEq(actualStream.depositAmount, daiStream.depositAmount); @@ -97,6 +94,9 @@ contract SablierV2Linear__Create is SablierV2LinearUnitTest { assertEq(actualStream.stopTime, stopTime); assertEq(actualStream.cancelable, daiStream.cancelable); assertEq(actualStream.withdrawnAmount, daiStream.withdrawnAmount); + + address actualRecipient = sablierV2Linear.getRecipient(daiStreamId); + assertEq(actualRecipient, users.recipient); } modifier StartTimeLessThanStopTime() { @@ -150,9 +150,6 @@ contract SablierV2Linear__Create is SablierV2LinearUnitTest { daiStream.cancelable ); - address actualRecipient = sablierV2Linear.getRecipient(daiStreamId); - assertEq(actualRecipient, users.recipient); - ISablierV2Linear.Stream memory actualStream = sablierV2Linear.getStream(daiStreamId); assertEq(actualStream.sender, daiStream.sender); assertEq(actualStream.depositAmount, daiStream.depositAmount); @@ -162,6 +159,9 @@ contract SablierV2Linear__Create is SablierV2LinearUnitTest { assertEq(actualStream.stopTime, daiStream.stopTime); assertEq(actualStream.cancelable, daiStream.cancelable); assertEq(actualStream.withdrawnAmount, daiStream.withdrawnAmount); + + address actualRecipient = sablierV2Linear.getRecipient(daiStreamId); + assertEq(actualRecipient, users.recipient); } modifier StartTimeLessThanCliffTime() { @@ -217,9 +217,6 @@ contract SablierV2Linear__Create is SablierV2LinearUnitTest { daiStream.cancelable ); - address actualRecipient = sablierV2Linear.getRecipient(daiStreamId); - assertEq(actualRecipient, users.recipient); - ISablierV2Linear.Stream memory actualStream = sablierV2Linear.getStream(daiStreamId); assertEq(actualStream.sender, daiStream.sender); assertEq(actualStream.depositAmount, daiStream.depositAmount); @@ -229,6 +226,9 @@ contract SablierV2Linear__Create is SablierV2LinearUnitTest { assertEq(actualStream.stopTime, daiStream.stopTime); assertEq(actualStream.cancelable, daiStream.cancelable); assertEq(actualStream.withdrawnAmount, daiStream.withdrawnAmount); + + address actualRecipient = sablierV2Linear.getRecipient(daiStreamId); + assertEq(actualRecipient, users.recipient); } modifier CliffLessThanStopTime() { @@ -285,9 +285,6 @@ contract SablierV2Linear__Create is SablierV2LinearUnitTest { daiStream.cancelable ); - address actualRecipient = sablierV2Linear.getRecipient(daiStreamId); - assertEq(actualRecipient, users.recipient); - ISablierV2Linear.Stream memory actualStream = sablierV2Linear.getStream(daiStreamId); assertEq(actualStream.sender, daiStream.sender); assertEq(actualStream.depositAmount, daiStream.depositAmount); @@ -297,6 +294,9 @@ contract SablierV2Linear__Create is SablierV2LinearUnitTest { assertEq(actualStream.stopTime, daiStream.stopTime); assertEq(actualStream.cancelable, daiStream.cancelable); assertEq(actualStream.withdrawnAmount, daiStream.withdrawnAmount); + + address actualRecipient = sablierV2Linear.getRecipient(daiStreamId); + assertEq(actualRecipient, users.recipient); } modifier TokenCompliant() { diff --git a/test/unit/sablier-v2-linear/withdraw-all-to/withdrawAllTo.t.sol b/test/unit/sablier-v2-linear/withdraw-all-to/withdrawAllTo.t.sol index 520955464..bfdd09d82 100644 --- a/test/unit/sablier-v2-linear/withdraw-all-to/withdrawAllTo.t.sol +++ b/test/unit/sablier-v2-linear/withdraw-all-to/withdrawAllTo.t.sol @@ -195,14 +195,14 @@ contract SablierV2Linear__WithdrawAllTo is SablierV2LinearUnitTest { } /// @dev it should make the withdrawals and update the withdrawn amounts. - function testWithdrawAllTo__CallerApprovedThirdPartyAllStreams() + function testWithdrawAllTo__CallerApprovedOperatorAllStreams() external ToNonZeroAddress ArraysEqual OnlyExistentStreams CallerAuthorizedAllStreams { - // Approve Alice for all the streams. + // Approve Alice for all streams. sablierV2Linear.setApprovalForAll(users.alice, true); // Make Alice the `msg.sender` in this test case. @@ -230,7 +230,7 @@ contract SablierV2Linear__WithdrawAllTo is SablierV2LinearUnitTest { } /// @dev it should revert. - function testCannotWithdrawAllTo__RecipientNotOwnerAllStreams() + function testCannotWithdrawAllTo__OriginalRecipientTransferredOwnershipAllStreams() external ToNonZeroAddress ArraysEqual @@ -250,7 +250,7 @@ contract SablierV2Linear__WithdrawAllTo is SablierV2LinearUnitTest { } /// @dev it should revert. - function testCannotWithdrawAllTo__RecipientNotOwnerSomeStreams() + function testCannotWithdrawAllTo__OriginalRecipientTransferredOnwershipSomeStreams() external ToNonZeroAddress ArraysEqual @@ -268,7 +268,7 @@ contract SablierV2Linear__WithdrawAllTo is SablierV2LinearUnitTest { sablierV2Linear.withdrawAllTo(defaultStreamIds, toAlice, defaultAmounts); } - modifier RecipientOwnerAllStreams() { + modifier OriginalRecipientAllStreams() { _; } @@ -280,7 +280,7 @@ contract SablierV2Linear__WithdrawAllTo is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams { // Warp to 2,600 seconds after the start time (26% of the default stream duration). vm.warp(daiStream.startTime + TIME_OFFSET); @@ -303,7 +303,7 @@ contract SablierV2Linear__WithdrawAllTo is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams AllAmountsNotZero { // Warp to 2,600 seconds after the start time (26% of the default stream duration). @@ -336,7 +336,7 @@ contract SablierV2Linear__WithdrawAllTo is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams AllAmountsNotZero AllAmountsLessThanOrEqualToWithdrawableAmounts { @@ -370,7 +370,7 @@ contract SablierV2Linear__WithdrawAllTo is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams AllAmountsNotZero AllAmountsLessThanOrEqualToWithdrawableAmounts ToThirdParty @@ -398,7 +398,7 @@ contract SablierV2Linear__WithdrawAllTo is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams AllAmountsNotZero AllAmountsLessThanOrEqualToWithdrawableAmounts ToThirdParty @@ -424,7 +424,7 @@ contract SablierV2Linear__WithdrawAllTo is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams AllAmountsNotZero AllAmountsLessThanOrEqualToWithdrawableAmounts ToThirdParty @@ -454,7 +454,7 @@ contract SablierV2Linear__WithdrawAllTo is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams AllAmountsNotZero AllAmountsLessThanOrEqualToWithdrawableAmounts ToThirdParty @@ -479,7 +479,7 @@ contract SablierV2Linear__WithdrawAllTo is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams AllAmountsNotZero AllAmountsLessThanOrEqualToWithdrawableAmounts ToThirdParty @@ -530,7 +530,7 @@ contract SablierV2Linear__WithdrawAllTo is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams AllAmountsNotZero AllAmountsLessThanOrEqualToWithdrawableAmounts ToThirdParty diff --git a/test/unit/sablier-v2-linear/withdraw-all-to/withdrawAllTo.tree b/test/unit/sablier-v2-linear/withdraw-all-to/withdrawAllTo.tree index d27a19343..dbe729e4d 100644 --- a/test/unit/sablier-v2-linear/withdraw-all-to/withdrawAllTo.tree +++ b/test/unit/sablier-v2-linear/withdraw-all-to/withdrawAllTo.tree @@ -10,7 +10,7 @@ withdrawAllTo.t.sol ├── when the stream ids array points to some non existent streams │ └── it should make the withdrawals for the existent streams └── when the stream ids array points only to existent streams - ├── when the caller is unauthorized for all the streams + ├── when the caller is unauthorized for all streams │ ├── when the caller is the sender │ │ └── it should revert │ └── when the caller is an unauthorized third-party @@ -20,15 +20,15 @@ withdrawAllTo.t.sol │ │ └── it should revert │ └── when the caller is an unauthorized third-party │ └── it should revert - └── when the caller is authorized for all the streams - ├── when the caller is an approved third-party of all streams + └── when the caller is authorized for all streams + ├── when the caller is an approved operator of all streams │ └── it should make the withdrawals and update the withdrawn amounts └── when the caller is the recipient of all streams - ├── when the recipient transferred all the streams and does not own any + ├── when the original recipient transferred ownership of all streams │ └── it should revert - ├── when the recipient transferred some of the streams and does not own all of them + ├── when the original recipient transferred ownership of some of the streams │ └── it should revert - └── when the recipient owns all the streams + └── when the original recipient did not transfer ownership of any stream ├── when some amounts are zero │ └── it should revert └── when all amounts are not zero diff --git a/test/unit/sablier-v2-linear/withdraw-all/withdrawAll.t.sol b/test/unit/sablier-v2-linear/withdraw-all/withdrawAll.t.sol index 46cbe243e..ba4a210b3 100644 --- a/test/unit/sablier-v2-linear/withdraw-all/withdrawAll.t.sol +++ b/test/unit/sablier-v2-linear/withdraw-all/withdrawAll.t.sol @@ -145,17 +145,17 @@ contract SablierV2Linear__WithdrawAll is SablierV2LinearUnitTest { } /// @dev it should make the withdrawals and update the withdrawn amounts. - function testWithdrawAll__CallerApprovedThirdPartyAllStreams() + function testWithdrawAll__CallerApprovedOperatorAllStreams() external ArraysEqual OnlyExistentStreams CallerAuthorizedAllStreams { - // Approve Alice for all the streams. - sablierV2Linear.setApprovalForAll(users.alice, true); + // Approve the operator for all streams. + sablierV2Linear.setApprovalForAll(users.operator, true); - // Make Alice the `msg.sender` in this test case. - changePrank(users.alice); + // Make the operator the `msg.sender` in this test case. + changePrank(users.operator); // Warp to 2,600 seconds after the start time (26% of the default stream duration). vm.warp(daiStream.startTime + TIME_OFFSET); @@ -179,16 +179,16 @@ contract SablierV2Linear__WithdrawAll is SablierV2LinearUnitTest { } /// @dev it should revert. - function testCannotWithdrawAllTo__RecipientNotOwnerAllStreams() + function testCannotWithdrawAllTo__OriginalRecipientTransferredOwnershipAllStreams() external ArraysEqual OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams { - // Transfer the streams to eve. - sablierV2Linear.safeTransferFrom(users.recipient, users.eve, defaultStreamIds[0]); - sablierV2Linear.safeTransferFrom(users.recipient, users.eve, defaultStreamIds[1]); + // Transfer the streams to Alice. + sablierV2Linear.safeTransferFrom(users.recipient, users.alice, defaultStreamIds[0]); + sablierV2Linear.safeTransferFrom(users.recipient, users.alice, defaultStreamIds[1]); // Run the test. vm.expectRevert( @@ -198,7 +198,7 @@ contract SablierV2Linear__WithdrawAll is SablierV2LinearUnitTest { } /// @dev it should revert. - function testCannotWithdrawAll__RecipientNotOwnerSomeStreams() + function testCannotWithdrawAll__OriginalRecipientTransferredOnwershipSomeStreams() external ArraysEqual OnlyExistentStreams @@ -206,7 +206,7 @@ contract SablierV2Linear__WithdrawAll is SablierV2LinearUnitTest { CallerRecipientAllStreams { // Transfer one of the streams to eve. - sablierV2Linear.safeTransferFrom(users.recipient, users.eve, defaultStreamIds[0]); + sablierV2Linear.safeTransferFrom(users.recipient, users.alice, defaultStreamIds[0]); // Run the test. vm.expectRevert( @@ -215,7 +215,7 @@ contract SablierV2Linear__WithdrawAll is SablierV2LinearUnitTest { sablierV2Linear.withdrawAll(defaultStreamIds, defaultAmounts); } - modifier RecipientOwnerAllStreams() { + modifier OriginalRecipientAllStreams() { _; } @@ -226,7 +226,7 @@ contract SablierV2Linear__WithdrawAll is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams { // Warp to 2,600 seconds after the start time (26% of the default stream duration). vm.warp(daiStream.startTime + TIME_OFFSET); @@ -248,7 +248,7 @@ contract SablierV2Linear__WithdrawAll is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams AllAmountsNotZero { // Warp to 2,600 seconds after the start time (26% of the default stream duration). @@ -280,7 +280,7 @@ contract SablierV2Linear__WithdrawAll is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams AllAmountsNotZero AllAmountsLessThanOrEqualToWithdrawableAmounts { @@ -306,7 +306,7 @@ contract SablierV2Linear__WithdrawAll is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams AllAmountsNotZero AllAmountsLessThanOrEqualToWithdrawableAmounts { @@ -329,7 +329,7 @@ contract SablierV2Linear__WithdrawAll is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams AllAmountsNotZero AllAmountsLessThanOrEqualToWithdrawableAmounts { @@ -357,7 +357,7 @@ contract SablierV2Linear__WithdrawAll is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams AllAmountsNotZero AllAmountsLessThanOrEqualToWithdrawableAmounts { @@ -379,7 +379,7 @@ contract SablierV2Linear__WithdrawAll is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams AllAmountsNotZero AllAmountsLessThanOrEqualToWithdrawableAmounts { @@ -428,7 +428,7 @@ contract SablierV2Linear__WithdrawAll is SablierV2LinearUnitTest { OnlyExistentStreams CallerAuthorizedAllStreams CallerRecipientAllStreams - RecipientOwnerAllStreams + OriginalRecipientAllStreams AllAmountsNotZero AllAmountsLessThanOrEqualToWithdrawableAmounts { diff --git a/test/unit/sablier-v2-linear/withdraw-all/withdrawAll.tree b/test/unit/sablier-v2-linear/withdraw-all/withdrawAll.tree index c59859a21..ee53648fc 100644 --- a/test/unit/sablier-v2-linear/withdraw-all/withdrawAll.tree +++ b/test/unit/sablier-v2-linear/withdraw-all/withdrawAll.tree @@ -7,20 +7,20 @@ withdrawAll.t.sol ├── when the stream ids array points to some non existent streams │ └── it should make the withdrawals for the existent streams └── when the stream ids array points only to existent streams - ├── when the caller is neither the sender nor authorized of any stream + ├── when the caller is not authorized for any stream │ └── it should revert - ├── when the caller is neither the sender nor authorized of some of the streams + ├── when the caller is not authorized for some streams │ └── it should revert ├── when the caller is the sender of all streams │ └── it should make the withdrawals and update the withdrawn amounts - ├── when the caller is an approved third-party of all the streams + ├── when the caller is an approved operator of all streams │ └── it should make the withdrawals and update the withdrawn amounts └── when the caller is the recipient of all streams - ├── when the recipient transferred all the streams and does not own any + ├── when the original recipient transferred ownership of all streams │ └── it should revert - ├── when the recipient transferred some of the streams and does not own all of them + ├── when the original recipient transferred ownership of some of the streams │ └── it should revert - └── when the recipient owns all the streams + └── when the original recipient did not transfer ownership of any stream ├── when some amounts are zero │ └── it should revert └── when all amounts are not zero diff --git a/test/unit/sablier-v2-linear/withdraw-to/withdrawTo.t.sol b/test/unit/sablier-v2-linear/withdraw-to/withdrawTo.t.sol index 3be2f01da..30eda23d4 100644 --- a/test/unit/sablier-v2-linear/withdraw-to/withdrawTo.t.sol +++ b/test/unit/sablier-v2-linear/withdraw-to/withdrawTo.t.sol @@ -29,8 +29,8 @@ contract SablierV2Linear__WithdrawTo is SablierV2LinearUnitTest { function testCannotWithdrawTo__StreamNonExistent() external { uint256 nonStreamId = 1729; vm.expectRevert(abi.encodeWithSelector(ISablierV2.SablierV2__StreamNonExistent.selector, nonStreamId)); - uint256 withdrawAmountZero = 0; - sablierV2Linear.withdrawTo(nonStreamId, toAlice, withdrawAmountZero); + uint256 withdrawAmount = 0; + sablierV2Linear.withdrawTo(nonStreamId, toAlice, withdrawAmount); } modifier StreamExistent() { @@ -41,8 +41,8 @@ contract SablierV2Linear__WithdrawTo is SablierV2LinearUnitTest { function testCannotWithdrawTo__ToZeroAddress() external StreamExistent { vm.expectRevert(abi.encodeWithSelector(ISablierV2.SablierV2__WithdrawZeroAddress.selector)); address toZero = address(0); - uint256 withdrawAmountZero = 0; - sablierV2Linear.withdrawTo(daiStreamId, toZero, withdrawAmountZero); + uint256 withdrawAmount = 0; + sablierV2Linear.withdrawTo(daiStreamId, toZero, withdrawAmount); } modifier ToNonZeroAddress() { @@ -56,8 +56,8 @@ contract SablierV2Linear__WithdrawTo is SablierV2LinearUnitTest { // Run the test. vm.expectRevert(abi.encodeWithSelector(ISablierV2.SablierV2__Unauthorized.selector, daiStreamId, users.sender)); - uint256 withdrawAmountZero = 0; - sablierV2Linear.withdrawTo(daiStreamId, toAlice, withdrawAmountZero); + uint256 withdrawAmount = 0; + sablierV2Linear.withdrawTo(daiStreamId, toAlice, withdrawAmount); } /// @dev it should revert. @@ -67,8 +67,8 @@ contract SablierV2Linear__WithdrawTo is SablierV2LinearUnitTest { // Run the test. vm.expectRevert(abi.encodeWithSelector(ISablierV2.SablierV2__Unauthorized.selector, daiStreamId, users.eve)); - uint256 withdrawAmountZero = 0; - sablierV2Linear.withdrawTo(daiStreamId, toAlice, withdrawAmountZero); + uint256 withdrawAmount = 0; + sablierV2Linear.withdrawTo(daiStreamId, toAlice, withdrawAmount); } modifier CallerAuthorized() { @@ -76,12 +76,12 @@ contract SablierV2Linear__WithdrawTo is SablierV2LinearUnitTest { } /// @dev it should make the withdrawal. - function testWithdrawTo__CallerApprovedThirdParty() external StreamExistent ToNonZeroAddress CallerAuthorized { - // Approve Alice for the stream. - sablierV2Linear.approve(users.alice, daiStreamId); + function testWithdrawTo__CallerApprovedOperator() external StreamExistent ToNonZeroAddress CallerAuthorized { + // Approve the operator to handle the stream. + sablierV2Linear.approve(users.operator, daiStreamId); - // Make Alice the `msg.sender` in this test case. - changePrank(users.alice); + // Make the operator the `msg.sender` in this test case. + changePrank(users.operator); // Warp to 2,600 seconds after the start time (26% of the default stream duration). vm.warp(daiStream.startTime + TIME_OFFSET); @@ -99,18 +99,15 @@ contract SablierV2Linear__WithdrawTo is SablierV2LinearUnitTest { } /// @dev it should revert. - function testCannotWithdraw__RecipientNotOwner() + function testCannotWithdraw__OriginalRecipientTransferredOwnership() external StreamExistent ToNonZeroAddress CallerAuthorized CallerRecipient { - // Transfer the stream to eve. - sablierV2Linear.safeTransferFrom(users.recipient, users.eve, daiStreamId); - - // Warp to the end of the stream. - vm.warp(daiStream.stopTime); + // Transfer the stream to Alice. + sablierV2Linear.safeTransferFrom(users.recipient, users.alice, daiStreamId); // Run the test. vm.expectRevert( @@ -119,7 +116,7 @@ contract SablierV2Linear__WithdrawTo is SablierV2LinearUnitTest { sablierV2Linear.withdrawTo(daiStreamId, toAlice, daiStream.depositAmount); } - modifier RecipientOwner() { + modifier OriginalRecipient() { _; } @@ -130,7 +127,7 @@ contract SablierV2Linear__WithdrawTo is SablierV2LinearUnitTest { ToNonZeroAddress CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient { vm.expectRevert(abi.encodeWithSelector(ISablierV2.SablierV2__WithdrawAmountZero.selector, daiStreamId)); uint256 withdrawAmountZero = 0; @@ -148,7 +145,7 @@ contract SablierV2Linear__WithdrawTo is SablierV2LinearUnitTest { ToNonZeroAddress CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient WithdrawAmountNotZero { uint256 withdrawAmountMaxUint256 = UINT256_MAX; @@ -175,7 +172,7 @@ contract SablierV2Linear__WithdrawTo is SablierV2LinearUnitTest { ToNonZeroAddress CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient WithdrawAmountNotZero WithdrawAmountLessThanOrEqualToWithdrawableAmount { @@ -201,7 +198,7 @@ contract SablierV2Linear__WithdrawTo is SablierV2LinearUnitTest { ToNonZeroAddress CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient WithdrawAmountNotZero WithdrawAmountLessThanOrEqualToWithdrawableAmount ToThirdParty @@ -223,7 +220,7 @@ contract SablierV2Linear__WithdrawTo is SablierV2LinearUnitTest { ToNonZeroAddress CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient WithdrawAmountNotZero WithdrawAmountLessThanOrEqualToWithdrawableAmount ToThirdParty @@ -244,7 +241,7 @@ contract SablierV2Linear__WithdrawTo is SablierV2LinearUnitTest { ToNonZeroAddress CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient WithdrawAmountNotZero WithdrawAmountLessThanOrEqualToWithdrawableAmount ToThirdParty @@ -267,7 +264,7 @@ contract SablierV2Linear__WithdrawTo is SablierV2LinearUnitTest { ToNonZeroAddress CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient WithdrawAmountNotZero WithdrawAmountLessThanOrEqualToWithdrawableAmount ToThirdParty diff --git a/test/unit/sablier-v2-linear/withdraw-to/withdrawTo.tree b/test/unit/sablier-v2-linear/withdraw-to/withdrawTo.tree index e84398d35..a311ff6b6 100644 --- a/test/unit/sablier-v2-linear/withdraw-to/withdrawTo.tree +++ b/test/unit/sablier-v2-linear/withdraw-to/withdrawTo.tree @@ -11,12 +11,12 @@ withdrawTo.t.sol │ └── when the caller is an unauthorized third-party │ └── it should revert └── when the caller is authorized - ├── when the caller is an approved third-party + ├── when the caller is an approved operator │ └── it should make the withdrawal and update the withdrawn amount └── when the caller is the recipient - ├── when the recipient transferred the stream and does not own it + ├── when the original recipient transferred ownership of the stream │ └── it should revert - └── when the recipient owns the stream + └── when the original recipient did not transfer ownership of the stream ├── when the withdraw amount is zero │ └── it should revert └── when the withdraw amount is not zero diff --git a/test/unit/sablier-v2-linear/withdraw/withdraw.t.sol b/test/unit/sablier-v2-linear/withdraw/withdraw.t.sol index b9f0a6a4d..d6f96c763 100644 --- a/test/unit/sablier-v2-linear/withdraw/withdraw.t.sol +++ b/test/unit/sablier-v2-linear/withdraw/withdraw.t.sol @@ -40,8 +40,8 @@ contract SablierV2Linear__Withdraw is SablierV2LinearUnitTest { // Run the test. vm.expectRevert(abi.encodeWithSelector(ISablierV2.SablierV2__Unauthorized.selector, daiStreamId, users.eve)); - uint256 withdrawAmountZero = 0; - sablierV2Linear.withdraw(daiStreamId, withdrawAmountZero); + uint256 withdrawAmount = 0; + sablierV2Linear.withdraw(daiStreamId, withdrawAmount); } modifier CallerAuthorized() { @@ -65,12 +65,12 @@ contract SablierV2Linear__Withdraw is SablierV2LinearUnitTest { } /// @dev it should make the withdrawal and update the withdrawn amount. - function testWithdraw__CallerApprovedThirdParty() external StreamExistent CallerAuthorized { - // Approve Alice for the stream. - sablierV2Linear.approve(users.alice, daiStreamId); + function testWithdraw__CallerApprovedOperator() external StreamExistent CallerAuthorized { + // Approve the operator to handle the stream. + sablierV2Linear.approve(users.operator, daiStreamId); - // Make Alice the `msg.sender` in this test case. - changePrank(users.alice); + // Make the operator the `msg.sender` in this test case. + changePrank(users.operator); // Warp to 2,600 seconds after the start time (26% of the default stream duration). vm.warp(daiStream.startTime + TIME_OFFSET); @@ -88,12 +88,14 @@ contract SablierV2Linear__Withdraw is SablierV2LinearUnitTest { } /// @dev it should revert. - function testCannotWithdraw__RecipientNotOwner() external StreamExistent CallerAuthorized CallerRecipient { - // Transfer the stream to eve. - sablierV2Linear.safeTransferFrom(users.recipient, users.eve, daiStreamId); - - // Warp to the end of the stream. - vm.warp(daiStream.stopTime); + function testCannotWithdraw__OriginalRecipientTransferredOwnership() + external + StreamExistent + CallerAuthorized + CallerRecipient + { + // Transfer the stream to Alice. + sablierV2Linear.safeTransferFrom(users.recipient, users.alice, daiStreamId); // Run the test. vm.expectRevert( @@ -102,7 +104,7 @@ contract SablierV2Linear__Withdraw is SablierV2LinearUnitTest { sablierV2Linear.withdraw(daiStreamId, daiStream.depositAmount); } - modifier RecipientOwner() { + modifier OriginalRecipient() { _; } @@ -112,7 +114,7 @@ contract SablierV2Linear__Withdraw is SablierV2LinearUnitTest { StreamExistent CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient { vm.expectRevert(abi.encodeWithSelector(ISablierV2.SablierV2__WithdrawAmountZero.selector, daiStreamId)); uint256 withdrawAmountZero = 0; @@ -129,7 +131,7 @@ contract SablierV2Linear__Withdraw is SablierV2LinearUnitTest { StreamExistent CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient WithdrawAmountNotZero { uint256 withdrawAmountMaxUint256 = UINT256_MAX; @@ -155,7 +157,7 @@ contract SablierV2Linear__Withdraw is SablierV2LinearUnitTest { StreamExistent CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient WithdrawAmountNotZero WithdrawAmountLessThanOrEqualToWithdrawableAmount { @@ -175,7 +177,7 @@ contract SablierV2Linear__Withdraw is SablierV2LinearUnitTest { StreamExistent CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient WithdrawAmountNotZero WithdrawAmountLessThanOrEqualToWithdrawableAmount { @@ -194,7 +196,7 @@ contract SablierV2Linear__Withdraw is SablierV2LinearUnitTest { StreamExistent CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient WithdrawAmountNotZero WithdrawAmountLessThanOrEqualToWithdrawableAmount { @@ -215,7 +217,7 @@ contract SablierV2Linear__Withdraw is SablierV2LinearUnitTest { StreamExistent CallerAuthorized CallerRecipient - RecipientOwner + OriginalRecipient WithdrawAmountNotZero WithdrawAmountLessThanOrEqualToWithdrawableAmount { diff --git a/test/unit/sablier-v2-linear/withdraw/withdraw.tree b/test/unit/sablier-v2-linear/withdraw/withdraw.tree index 30ac058d4..98a6ed72c 100644 --- a/test/unit/sablier-v2-linear/withdraw/withdraw.tree +++ b/test/unit/sablier-v2-linear/withdraw/withdraw.tree @@ -2,25 +2,26 @@ withdraw.t.sol ├── when the stream does not exist │ └── it should revert └── when the stream exists - ├── when the caller is neither the sender nor authorized + ├── when the caller is not authorized │ └── it should revert - ├── when the caller is the sender - │ └── it should make the withdrawal and update the withdrawn amount - ├── when the caller is an approved third-party - │ └── it should make the withdrawal and update the withdrawn amount - └── when the caller is the recipient - ├── when the recipient transferred the stream and does not own it - │ └── it should revert - └── when the recipient owns the stream - ├── when the withdraw amount is zero + └── when the caller is authorized + ├── when the caller is the sender + │ └── it should make the withdrawal and update the withdrawn amount + ├── when the caller is an approved operator + │ └── it should make the withdrawal and update the withdrawn amount + └── when the caller is the recipient + ├── when the original recipient transferred ownership of the stream │ └── it should revert - └── when the withdraw amount is not zero - ├── when the amount is greater than the withdrawable amount + └── when the original recipient did not transfer ownership of the stream + ├── when the withdraw amount is zero │ └── it should revert - └── when the amount is less than or equal to the withdrawable amount - ├── when the stream ended - │ ├── it should make the withdrawal and delete the stream - │ └── it should emit a Withdraw event - └── when the stream did not end - ├── it should make the withdrawal and update the withdrawn amount - └── it should emit a Withdraw event + └── when the withdraw amount is not zero + ├── when the amount is greater than the withdrawable amount + │ └── it should revert + └── when the amount is less than or equal to the withdrawable amount + ├── when the stream ended + │ ├── it should make the withdrawal and delete the stream + │ └── it should emit a Withdraw event + └── when the stream did not end + ├── it should make the withdrawal and update the withdrawn amount + └── it should emit a Withdraw event diff --git a/test/unit/sablier-v2-pro/create-with-duration/createWithDuration.tree b/test/unit/sablier-v2-pro/create-with-duration/createWithDuration.tree index c98336348..f602a2bae 100644 --- a/test/unit/sablier-v2-pro/create-with-duration/createWithDuration.tree +++ b/test/unit/sablier-v2-pro/create-with-duration/createWithDuration.tree @@ -5,12 +5,12 @@ createWithDuration.t.sol ├── when the segment deltas count are not equal │ └── it should revert └── when the segment deltas count are equal - ├── when the segment milestone calculations overflow uint256 - │ ├── when the start time is greater than the calculated stop time - │ │ └── it should revert - │ ├── when the start time is greater than the calculated first segment milestone - │ │ └── it should revert - │ └── when the segment milestones are not ordered - │ └── it should revert - └── when the segment milestone calculations do not overflow uint256 - └── it should create the stream with duration + ├── when the segment milestone calculations overflow uint256 + │ ├── when the start time is greater than the calculated stop time + │ │ └── it should revert + │ ├── when the start time is greater than the calculated first segment milestone + │ │ └── it should revert + │ └── when the segment milestones are not ordered + │ └── it should revert + └── when the segment milestone calculations do not overflow uint256 + └── it should create the stream with duration diff --git a/test/unit/sablier-v2-pro/create/create.t.sol b/test/unit/sablier-v2-pro/create/create.t.sol index 65f6abd6d..04faff5bd 100644 --- a/test/unit/sablier-v2-pro/create/create.t.sol +++ b/test/unit/sablier-v2-pro/create/create.t.sol @@ -231,9 +231,6 @@ contract SablierV2Pro__Create is SablierV2ProUnitTest { daiStream.cancelable ); - address actualRecipient = sablierV2Pro.getRecipient(daiStreamId); - assertEq(actualRecipient, users.recipient); - ISablierV2Pro.Stream memory actualStream = sablierV2Pro.getStream(daiStreamId); assertEq(actualStream.sender, daiStream.sender); assertEq(actualStream.depositAmount, depositAmount); @@ -244,6 +241,9 @@ contract SablierV2Pro__Create is SablierV2ProUnitTest { assertEq(actualStream.segmentMilestones, segmentMilestones); assertEq(actualStream.cancelable, daiStream.cancelable); assertEq(actualStream.withdrawnAmount, daiStream.withdrawnAmount); + + address actualRecipient = sablierV2Pro.getRecipient(daiStreamId); + assertEq(actualRecipient, users.recipient); } modifier StartTimeLessThanStopTime() { @@ -450,9 +450,6 @@ contract SablierV2Pro__Create is SablierV2ProUnitTest { daiStream.cancelable ); - address actualRecipient = sablierV2Pro.getRecipient(daiStreamId); - assertEq(actualRecipient, users.recipient); - ISablierV2Pro.Stream memory actualStream = sablierV2Pro.getStream(daiStreamId); assertEq(actualStream.sender, daiStream.sender); assertEq(actualStream.depositAmount, daiStream.depositAmount); @@ -461,6 +458,9 @@ contract SablierV2Pro__Create is SablierV2ProUnitTest { assertEq(actualStream.stopTime, daiStream.stopTime); assertEq(actualStream.cancelable, daiStream.cancelable); assertEq(actualStream.withdrawnAmount, daiStream.withdrawnAmount); + + address actualRecipient = sablierV2Pro.getRecipient(daiStreamId); + assertEq(actualRecipient, users.recipient); } modifier TokenCompliant() { diff --git a/test/unit/sablier-v2-pro/create/create.tree b/test/unit/sablier-v2-pro/create/create.tree index 7e05cdedd..4528d8f88 100644 --- a/test/unit/sablier-v2-pro/create/create.tree +++ b/test/unit/sablier-v2-pro/create/create.tree @@ -5,7 +5,7 @@ create.t.sol ├── when the deposit amount is zero │ └── it should revert └── when the deposit amount is not zero - ├── when one of the segment count is zero + ├── when one of the segment counts is zero │ └── it should revert └── when all segment counts are not zero ├── when one of the segment counts is out of bounds