diff --git a/benchmark/BatchLockup.Gas.t.sol b/benchmark/BatchLockup.Gas.t.sol index 8a655d755..243591e04 100644 --- a/benchmark/BatchLockup.Gas.t.sol +++ b/benchmark/BatchLockup.Gas.t.sol @@ -58,7 +58,7 @@ contract BatchLockup_Gas_Test is Benchmark_Test { //////////////////////////////////////////////////////////////////////////*/ function gasCreateWithDurationsLD(uint256 batchSize, uint256 segmentsCount) internal { - LockupDynamic.CreateWithDurations memory createParams = defaults.createWithDurationsBrokerNullLD(); + LockupDynamic.CreateWithDurations memory createParams = defaults.createWithDurationsBrokerNull(); createParams.totalAmount = uint128(AMOUNT_PER_ITEM * segmentsCount); createParams.segments = _generateSegmentsWithDuration(segmentsCount); BatchLockup.CreateWithDurationsLD[] memory params = BatchLockupBuilder.fillBatch(createParams, batchSize); @@ -82,7 +82,7 @@ contract BatchLockup_Gas_Test is Benchmark_Test { } function gasCreateWithTimestampsLD(uint256 batchSize, uint256 segmentsCount) internal { - LockupDynamic.CreateWithTimestamps memory createParams = defaults.createWithTimestampsBrokerNullLD(); + LockupDynamic.CreateWithTimestamps memory createParams = defaults.createWithTimestampsBrokerNull(); createParams.startTime = getBlockTimestamp(); createParams.totalAmount = uint128(AMOUNT_PER_ITEM * segmentsCount); createParams.segments = _generateSegments(segmentsCount); @@ -108,7 +108,7 @@ contract BatchLockup_Gas_Test is Benchmark_Test { function gasCreateWithDurationsLL(uint256 batchSize) internal { BatchLockup.CreateWithDurationsLL[] memory params = - BatchLockupBuilder.fillBatch({ params: defaults.createWithDurationsBrokerNullLL(), batchSize: batchSize }); + BatchLockupBuilder.fillBatch({ params: defaults.createWithDurationsBrokerNull(), batchSize: batchSize }); uint256 initialGas = gasleft(); batchLockup.createWithDurationsLL(lockupLinear, dai, params); @@ -124,7 +124,7 @@ contract BatchLockup_Gas_Test is Benchmark_Test { function gasCreateWithTimestampsLL(uint256 batchSize) internal { BatchLockup.CreateWithTimestampsLL[] memory params = - BatchLockupBuilder.fillBatch({ params: defaults.createWithTimestampsBrokerNullLL(), batchSize: batchSize }); + BatchLockupBuilder.fillBatch({ params: defaults.createWithTimestampsBrokerNull(), batchSize: batchSize }); uint256 initialGas = gasleft(); batchLockup.createWithTimestampsLL(lockupLinear, dai, params); @@ -139,7 +139,7 @@ contract BatchLockup_Gas_Test is Benchmark_Test { } function gasCreateWithDurationsLT(uint256 batchSize, uint256 tranchesCount) internal { - LockupTranched.CreateWithDurations memory createParams = defaults.createWithDurationsBrokerNullLT(); + LockupTranched.CreateWithDurations memory createParams = defaults.createWithDurationsBrokerNull(); createParams.totalAmount = uint128(AMOUNT_PER_ITEM * tranchesCount); createParams.tranches = _generateTranchesWithDuration(tranchesCount); BatchLockup.CreateWithDurationsLT[] memory params = BatchLockupBuilder.fillBatch(createParams, batchSize); @@ -163,7 +163,7 @@ contract BatchLockup_Gas_Test is Benchmark_Test { } function gasCreateWithTimestampsLT(uint256 batchSize, uint256 tranchesCount) internal { - LockupTranched.CreateWithTimestamps memory createParams = defaults.createWithTimestampsBrokerNullLT(); + LockupTranched.CreateWithTimestamps memory createParams = defaults.createWithTimestampsBrokerNull(); createParams.startTime = getBlockTimestamp(); createParams.totalAmount = uint128(AMOUNT_PER_ITEM * tranchesCount); createParams.tranches = _generateTranches(tranchesCount); diff --git a/benchmark/LockupTranched.Gas.t.sol b/benchmark/LockupTranched.Gas.t.sol index 665bf9def..0a087df83 100644 --- a/benchmark/LockupTranched.Gas.t.sol +++ b/benchmark/LockupTranched.Gas.t.sol @@ -180,7 +180,7 @@ contract LockupTranched_Gas_Test is Benchmark_Test { uint128 depositAmount = AMOUNT_PER_SEGMENT * totalTranches; - params = defaults.createWithDurationsLT(); + params = defaults.createWithDurations(); params.broker.fee = brokerFee; params.totalAmount = _calculateTotalAmount(depositAmount, brokerFee); params.tranches = tranches_; diff --git a/test/core/fork/LockupDynamic.t.sol b/test/core/fork/LockupDynamic.t.sol index d57675e4d..ffa16c56a 100644 --- a/test/core/fork/LockupDynamic.t.sol +++ b/test/core/fork/LockupDynamic.t.sol @@ -184,9 +184,7 @@ abstract contract LockupDynamic_Fork_Test is Fork_Test { vars.isCancelable = vars.isSettled ? false : true; // Assert that the stream has been created. - assertEq(lockup.getDepositedAmount(vars.streamId), vars.createAmounts.deposit); - assertEq(lockup.getRefundedAmount(vars.streamId), 0); - assertEq(lockup.getWithdrawnAmount(vars.streamId), 0); + assertEq(lockup.getDepositedAmount(vars.streamId), vars.createAmounts.deposit, "depositedAmount"); assertEq(lockup.getAsset(vars.streamId), FORK_ASSET, "asset"); assertEq(lockup.getEndTime(vars.streamId), vars.timestamps.end, "endTime"); assertEq(lockup.isCancelable(vars.streamId), vars.isCancelable, "isCancelable"); diff --git a/test/core/fork/LockupLinear.t.sol b/test/core/fork/LockupLinear.t.sol index 4bb340519..c9e18093a 100644 --- a/test/core/fork/LockupLinear.t.sol +++ b/test/core/fork/LockupLinear.t.sol @@ -193,11 +193,9 @@ abstract contract LockupLinear_Fork_Test is Fork_Test { vars.isCancelable = vars.isSettled ? false : true; // Assert that the stream has been created. - assertEq(lockup.getDepositedAmount(vars.streamId), vars.createAmounts.deposit); - assertEq(lockup.getRefundedAmount(vars.streamId), 0); - assertEq(lockup.getWithdrawnAmount(vars.streamId), 0); + assertEq(lockup.getDepositedAmount(vars.streamId), vars.createAmounts.deposit, "depositedAmount"); assertEq(lockup.getAsset(vars.streamId), FORK_ASSET, "asset"); - assertEq(lockup.getCliff(vars.streamId), params.timestamps.cliff, "cliffTime"); + assertEq(lockup.getCliffTime(vars.streamId), params.timestamps.cliff, "cliffTime"); assertEq(lockup.getEndTime(vars.streamId), params.timestamps.end, "endTime"); assertEq(lockup.isCancelable(vars.streamId), vars.isCancelable, "isCancelable"); assertEq(lockup.isDepleted(vars.streamId), false, "isDepleted"); diff --git a/test/core/fork/LockupTranched.t.sol b/test/core/fork/LockupTranched.t.sol index 2bc1d9914..905275722 100644 --- a/test/core/fork/LockupTranched.t.sol +++ b/test/core/fork/LockupTranched.t.sol @@ -184,9 +184,7 @@ abstract contract LockupTranched_Fork_Test is Fork_Test { vars.isCancelable = vars.isSettled ? false : true; // Assert that the stream has been created. - assertEq(lockup.getDepositedAmount(vars.streamId), vars.createAmounts.deposit); - assertEq(lockup.getRefundedAmount(vars.streamId), 0); - assertEq(lockup.getWithdrawnAmount(vars.streamId), 0); + assertEq(lockup.getDepositedAmount(vars.streamId), vars.createAmounts.deposit, "depositedAmount"); assertEq(lockup.getAsset(vars.streamId), FORK_ASSET, "asset"); assertEq(lockup.getEndTime(vars.streamId), vars.timestamps.end, "endTime"); assertEq(lockup.isCancelable(vars.streamId), vars.isCancelable, "isCancelable"); diff --git a/test/core/fork/NFTDescriptor.t.sol b/test/core/fork/NFTDescriptor.t.sol index b0bd89c1a..30c958c77 100644 --- a/test/core/fork/NFTDescriptor.t.sol +++ b/test/core/fork/NFTDescriptor.t.sol @@ -260,7 +260,9 @@ contract NFTDescriptor_Fork_Test is Fork_Test { /// Given enough fuzz runs, all the following scenarios will be fuzzed: /// - Multiple values of streamId. function testForkFuzz_TokenURI_Lockup_v1_3_0(uint256 streamId) external loadDeployments_v1_3_0 { - streamId = _bound(streamId, 1, lockup.nextStreamId() - 1); + // TODO: Uncomment it after the deployment. + // streamId = _bound(streamId, 1, lockup.nextStreamId() - 1); + streamId = 1; // Set the new NFT descriptor for the previous version of Lockup. resetPrank({ msgSender: lockup.admin() }); diff --git a/test/core/integration/Integration.t.sol b/test/core/integration/Integration.t.sol index dd821fb87..d28f5c786 100644 --- a/test/core/integration/Integration.t.sol +++ b/test/core/integration/Integration.t.sol @@ -1,11 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.22 <0.9.0; -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; - -import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; import { Errors } from "src/core/libraries/Errors.sol"; -import { Broker } from "src/core/types/DataTypes.sol"; import { Base_Test } from "../../Base.t.sol"; import { @@ -22,17 +18,32 @@ abstract contract Integration_Test is Base_Test { VARIABLES //////////////////////////////////////////////////////////////////////////*/ + // Various stream IDs to be used across the tests. + // Default stream ID. uint256 internal defaultStreamId; + // A stream ID with a different sender and recipient. + uint256 internal differentSenderRecipientStreamId; + // A stream ID with an early end time. + uint256 internal earlyEndtimeStreamId; + // A stream ID with the same sender and recipient. + uint256 internal identicalSenderRecipientStreamId; + // A non-cancelable stream ID. + uint256 internal notCancelableStreamId; + // A non-transferable stream ID. uint256 internal notTransferableStreamId; + // A stream with a recipient contract that implements {ISablierLockupRecipient}. + uint256 internal recipientContractStreamId; + // A stream with a recipient contract that returns invalid selector bytes on the hook call. + uint256 internal recipientInvalidSelectorStreamId; + // A stream with a reentrant contract as the recipient. + uint256 internal recipientReentrantStreamId; + // Astream with a reverting contract as the stream's recipient. + uint256 internal recipientRevertStreamId; /*////////////////////////////////////////////////////////////////////////// TEST CONTRACTS //////////////////////////////////////////////////////////////////////////*/ - /// @dev A test contract that is meant to be overridden by the implementing contract, which will be - /// either {SablierLockupDynamic}, {SablierLockupLinear} or {SablierLockupTranched}. - ISablierLockup internal lockup; - RecipientInterfaceIDIncorrect internal recipientInterfaceIDIncorrect; RecipientInterfaceIDMissing internal recipientInterfaceIDMissing; RecipientInvalidSelector internal recipientInvalidSelector; @@ -67,52 +78,4 @@ abstract contract Integration_Test is Base_Test { assertFalse(success, "delegatecall success"); assertEq(returnData, abi.encodeWithSelector(Errors.DelegateCall.selector), "delegatecall return data"); } - - /*////////////////////////////////////////////////////////////////////////// - HELPERS - //////////////////////////////////////////////////////////////////////////*/ - - /// @dev Creates the default stream. - function createDefaultStream() internal virtual returns (uint256 streamId); - - /// @dev Creates the default stream but make it not cancelable. - function createDefaultStreamNotCancelable() internal virtual returns (uint256 streamId); - - /// @dev Creates the default stream with the NFT transfer disabled. - function createDefaultStreamNotTransferable() internal virtual returns (uint256 streamId); - - /// @dev Creates the default stream with the provided address. - function createDefaultStreamWithAsset(IERC20 asset) internal virtual returns (uint256 streamId); - - /// @dev Creates the default stream with the provided broker. - function createDefaultStreamWithBroker(Broker memory broker) internal virtual returns (uint256 streamId); - - /// @dev Creates the default stream with the provided end time. - function createDefaultStreamWithEndTime(uint40 endTime) internal virtual returns (uint256 streamId); - - /// @dev Creates the default stream with the provided user as the recipient and the sender. - function createDefaultStreamWithIdenticalUsers(address user) internal returns (uint256 streamId) { - return createDefaultStreamWithUsers({ recipient: user, sender: user }); - } - - /// @dev Creates the default stream with the provided recipient. - function createDefaultStreamWithRecipient(address recipient) internal virtual returns (uint256 streamId); - - /// @dev Creates the default stream with the provided sender. - function createDefaultStreamWithSender(address sender) internal virtual returns (uint256 streamId); - - /// @dev Creates the default stream with the provided start time. - function createDefaultStreamWithStartTime(uint40 startTime) internal virtual returns (uint256 streamId); - - /// @dev Creates the default stream with the provided total amount. - function createDefaultStreamWithTotalAmount(uint128 totalAmount) internal virtual returns (uint256 streamId); - - /// @dev Creates the default stream with the provided sender and recipient. - function createDefaultStreamWithUsers( - address recipient, - address sender - ) - internal - virtual - returns (uint256 streamId); } diff --git a/test/core/integration/concrete/lockup-linear/constructor.t.sol b/test/core/integration/concrete/constructor.t.sol similarity index 51% rename from test/core/integration/concrete/lockup-linear/constructor.t.sol rename to test/core/integration/concrete/constructor.t.sol index 6ebbc6295..d016095c7 100644 --- a/test/core/integration/concrete/lockup-linear/constructor.t.sol +++ b/test/core/integration/concrete/constructor.t.sol @@ -4,39 +4,47 @@ pragma solidity >=0.8.22 <0.9.0; import { UD60x18 } from "@prb/math/src/UD60x18.sol"; import { IAdminable } from "src/core/interfaces/IAdminable.sol"; -import { SablierLockupLinear } from "src/core/SablierLockupLinear.sol"; +import { SablierLockup } from "src/core/SablierLockup.sol"; -import { LockupLinear_Integration_Shared_Test } from "./LockupLinear.t.sol"; +import { Integration_Test } from "../Integration.t.sol"; -contract Constructor_LockupLinear_Integration_Concrete_Test is LockupLinear_Integration_Shared_Test { +contract Constructor_Integration_Concrete_Test is Integration_Test { function test_Constructor() external { // Expect the relevant event to be emitted. vm.expectEmit(); emit IAdminable.TransferAdmin({ oldAdmin: address(0), newAdmin: users.admin }); // Construct the contract. - SablierLockupLinear constructedLockupLinear = - new SablierLockupLinear({ initialAdmin: users.admin, initialNFTDescriptor: nftDescriptor }); + SablierLockup constructedLockup = new SablierLockup({ + initialAdmin: users.admin, + initialNFTDescriptor: nftDescriptor, + maxCount: defaults.MAX_COUNT() + }); // {SablierLockup.constant} - UD60x18 actualMaxBrokerFee = constructedLockupLinear.MAX_BROKER_FEE(); + UD60x18 actualMaxBrokerFee = constructedLockup.MAX_BROKER_FEE(); UD60x18 expectedMaxBrokerFee = UD60x18.wrap(0.1e18); assertEq(actualMaxBrokerFee, expectedMaxBrokerFee, "MAX_BROKER_FEE"); // {SablierLockup.constructor} - address actualAdmin = constructedLockupLinear.admin(); + address actualAdmin = constructedLockup.admin(); address expectedAdmin = users.admin; assertEq(actualAdmin, expectedAdmin, "admin"); - uint256 actualStreamId = constructedLockupLinear.nextStreamId(); + uint256 actualStreamId = constructedLockup.nextStreamId(); uint256 expectedStreamId = 1; assertEq(actualStreamId, expectedStreamId, "nextStreamId"); - address actualNFTDescriptor = address(constructedLockupLinear.nftDescriptor()); + address actualNFTDescriptor = address(constructedLockup.nftDescriptor()); address expectedNFTDescriptor = address(nftDescriptor); assertEq(actualNFTDescriptor, expectedNFTDescriptor, "nftDescriptor"); // {SablierLockup.supportsInterface} - assertTrue(constructedLockupLinear.supportsInterface(0x49064906), "ERC-4906 interface ID"); + assertTrue(constructedLockup.supportsInterface(0x49064906), "ERC-4906 interface ID"); + + // {SablierLockup.constructor} + uint256 actualMaxCount = constructedLockup.MAX_COUNT(); + uint256 expectedMaxCount = defaults.MAX_COUNT(); + assertEq(actualMaxCount, expectedMaxCount, "MAX_COUNT"); } } diff --git a/test/core/integration/concrete/lockup/allow-to-hook/allowToHook.t.sol b/test/core/integration/concrete/lockup-base/allow-to-hook/allowToHook.t.sol similarity index 85% rename from test/core/integration/concrete/lockup/allow-to-hook/allowToHook.t.sol rename to test/core/integration/concrete/lockup-base/allow-to-hook/allowToHook.t.sol index 2b50092e5..2e2b71d56 100644 --- a/test/core/integration/concrete/lockup/allow-to-hook/allowToHook.t.sol +++ b/test/core/integration/concrete/lockup-base/allow-to-hook/allowToHook.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.22 <0.9.0; -import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; +import { ISablierLockupBase } from "src/core/interfaces/ISablierLockupBase.sol"; import { Errors } from "src/core/libraries/Errors.sol"; import { Integration_Test } from "../../../Integration.t.sol"; @@ -18,7 +18,7 @@ abstract contract AllowToHook_Integration_Concrete_Test is Integration_Test { function test_RevertWhen_ProvidedAddressNotContract() external whenCallerAdmin { address eoa = vm.addr({ privateKey: 1 }); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_AllowToHookZeroCodeSize.selector, eoa)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_AllowToHookZeroCodeSize.selector, eoa)); lockup.allowToHook(eoa); } @@ -30,7 +30,7 @@ abstract contract AllowToHook_Integration_Concrete_Test is Integration_Test { // Incorrect interface ID. address recipient = address(recipientInterfaceIDIncorrect); vm.expectRevert( - abi.encodeWithSelector(Errors.SablierLockup_AllowToHookUnsupportedInterface.selector, recipient) + abi.encodeWithSelector(Errors.SablierLockupBase_AllowToHookUnsupportedInterface.selector, recipient) ); lockup.allowToHook(recipient); @@ -43,7 +43,7 @@ abstract contract AllowToHook_Integration_Concrete_Test is Integration_Test { function test_WhenProvidedAddressReturnsInterfaceId() external whenCallerAdmin whenProvidedAddressContract { // It should emit a {AllowToHook} event. vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.AllowToHook(users.admin, address(recipientGood)); + emit ISablierLockupBase.AllowToHook(users.admin, address(recipientGood)); // Allow the provided address to hook. lockup.allowToHook(address(recipientGood)); diff --git a/test/core/integration/concrete/lockup/allow-to-hook/allowToHook.tree b/test/core/integration/concrete/lockup-base/allow-to-hook/allowToHook.tree similarity index 100% rename from test/core/integration/concrete/lockup/allow-to-hook/allowToHook.tree rename to test/core/integration/concrete/lockup-base/allow-to-hook/allowToHook.tree diff --git a/test/core/integration/concrete/lockup/batch/batch.t.sol b/test/core/integration/concrete/lockup-base/batch/batch.t.sol similarity index 90% rename from test/core/integration/concrete/lockup/batch/batch.t.sol rename to test/core/integration/concrete/lockup-base/batch/batch.t.sol index 55ec13ca4..97dc7b246 100644 --- a/test/core/integration/concrete/lockup/batch/batch.t.sol +++ b/test/core/integration/concrete/lockup-base/batch/batch.t.sol @@ -21,7 +21,8 @@ abstract contract Batch_Integration_Concrete_Test is Integration_Test { calls[0] = abi.encodeCall(lockup.getDepositedAmount, (nonExistentStreamId)); bytes memory expectedRevertData = abi.encodeWithSelector( - Errors.BatchError.selector, abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nonExistentStreamId) + Errors.BatchError.selector, + abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nonExistentStreamId) ); vm.expectRevert(expectedRevertData); diff --git a/test/core/integration/concrete/lockup/batch/batch.tree b/test/core/integration/concrete/lockup-base/batch/batch.tree similarity index 100% rename from test/core/integration/concrete/lockup/batch/batch.tree rename to test/core/integration/concrete/lockup-base/batch/batch.tree diff --git a/test/core/integration/concrete/lockup/burn/burn.t.sol b/test/core/integration/concrete/lockup-base/burn/burn.t.sol similarity index 86% rename from test/core/integration/concrete/lockup/burn/burn.t.sol rename to test/core/integration/concrete/lockup-base/burn/burn.t.sol index 7d77032e8..339ea6401 100644 --- a/test/core/integration/concrete/lockup/burn/burn.t.sol +++ b/test/core/integration/concrete/lockup-base/burn/burn.t.sol @@ -3,38 +3,38 @@ pragma solidity >=0.8.22 <0.9.0; import { IERC721Errors } from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol"; import { IERC4906 } from "@openzeppelin/contracts/interfaces/IERC4906.sol"; -import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; +import { ISablierLockupBase } from "src/core/interfaces/ISablierLockupBase.sol"; import { Errors } from "src/core/libraries/Errors.sol"; import { Integration_Test } from "./../../../Integration.t.sol"; abstract contract Burn_Integration_Concrete_Test is Integration_Test { function test_RevertWhen_DelegateCall() external { - bytes memory callData = abi.encodeCall(ISablierLockup.burn, defaultStreamId); + bytes memory callData = abi.encodeCall(ISablierLockupBase.burn, defaultStreamId); (bool success, bytes memory returnData) = address(lockup).delegatecall(callData); expectRevertDueToDelegateCall(success, returnData); } function test_RevertGiven_Null() external whenNoDelegateCall { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.burn(nullStreamId); } function test_RevertGiven_PENDINGStatus() external whenNoDelegateCall givenNotNull givenNotDepletedStream { vm.warp({ newTimestamp: getBlockTimestamp() - 1 seconds }); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_StreamNotDepleted.selector, defaultStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_StreamNotDepleted.selector, defaultStreamId)); lockup.burn(defaultStreamId); } function test_RevertGiven_STREAMINGStatus() external whenNoDelegateCall givenNotNull givenNotDepletedStream { vm.warp({ newTimestamp: defaults.WARP_26_PERCENT() }); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_StreamNotDepleted.selector, defaultStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_StreamNotDepleted.selector, defaultStreamId)); lockup.burn(defaultStreamId); } function test_RevertGiven_SETTLEDStatus() external whenNoDelegateCall givenNotNull givenNotDepletedStream { vm.warp({ newTimestamp: defaults.END_TIME() }); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_StreamNotDepleted.selector, defaultStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_StreamNotDepleted.selector, defaultStreamId)); lockup.burn(defaultStreamId); } @@ -43,7 +43,7 @@ abstract contract Burn_Integration_Concrete_Test is Integration_Test { resetPrank({ msgSender: users.sender }); lockup.cancel(defaultStreamId); resetPrank({ msgSender: users.recipient }); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_StreamNotDepleted.selector, defaultStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_StreamNotDepleted.selector, defaultStreamId)); lockup.burn(defaultStreamId); } @@ -55,7 +55,9 @@ abstract contract Burn_Integration_Concrete_Test is Integration_Test { whenCallerNotRecipient { resetPrank({ msgSender: users.eve }); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Unauthorized.selector, defaultStreamId, users.eve)); + vm.expectRevert( + abi.encodeWithSelector(Errors.SablierLockupBase_Unauthorized.selector, defaultStreamId, users.eve) + ); lockup.burn(defaultStreamId); } @@ -68,7 +70,7 @@ abstract contract Burn_Integration_Concrete_Test is Integration_Test { { resetPrank({ msgSender: users.sender }); vm.expectRevert( - abi.encodeWithSelector(Errors.SablierLockup_Unauthorized.selector, defaultStreamId, users.sender) + abi.encodeWithSelector(Errors.SablierLockupBase_Unauthorized.selector, defaultStreamId, users.sender) ); lockup.burn(defaultStreamId); } diff --git a/test/core/integration/concrete/lockup/burn/burn.tree b/test/core/integration/concrete/lockup-base/burn/burn.tree similarity index 100% rename from test/core/integration/concrete/lockup/burn/burn.tree rename to test/core/integration/concrete/lockup-base/burn/burn.tree diff --git a/test/core/integration/concrete/lockup/cancel-multiple/cancelMultiple.t.sol b/test/core/integration/concrete/lockup-base/cancel-multiple/cancelMultiple.t.sol similarity index 58% rename from test/core/integration/concrete/lockup/cancel-multiple/cancelMultiple.t.sol rename to test/core/integration/concrete/lockup-base/cancel-multiple/cancelMultiple.t.sol index eef8148c6..e60618768 100644 --- a/test/core/integration/concrete/lockup/cancel-multiple/cancelMultiple.t.sol +++ b/test/core/integration/concrete/lockup-base/cancel-multiple/cancelMultiple.t.sol @@ -3,19 +3,18 @@ pragma solidity >=0.8.22 <0.9.0; import { Solarray } from "solarray/src/Solarray.sol"; -import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; +import { ISablierLockupBase } from "src/core/interfaces/ISablierLockupBase.sol"; import { Errors } from "src/core/libraries/Errors.sol"; import { Lockup } from "src/core/types/DataTypes.sol"; -import { CancelMultiple_Integration_Shared_Test } from "../../../shared/lockup/cancelMultiple.t.sol"; +import { Integration_Test } from "../../../Integration.t.sol"; -abstract contract CancelMultiple_Integration_Concrete_Test is CancelMultiple_Integration_Shared_Test { - function setUp() public virtual override { - CancelMultiple_Integration_Shared_Test.setUp(); - } +abstract contract CancelMultiple_Integration_Concrete_Test is Integration_Test { + uint40 internal originalTime; + uint256[] internal cancelMultipleStreamIds; function test_RevertWhen_DelegateCall() external { - bytes memory callData = abi.encodeCall(ISablierLockup.cancelMultiple, (testStreamIds)); + bytes memory callData = abi.encodeCall(ISablierLockupBase.cancelMultiple, (cancelMultipleStreamIds)); (bool success, bytes memory returnData) = address(lockup).delegatecall(callData); expectRevertDueToDelegateCall(success, returnData); } @@ -28,8 +27,8 @@ abstract contract CancelMultiple_Integration_Concrete_Test is CancelMultiple_Int function test_RevertGiven_AtleastOneNullStream() external whenNoDelegateCall whenNonZeroArrayLength { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); - lockup.cancelMultiple({ streamIds: Solarray.uint256s(testStreamIds[0], nullStreamId) }); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); + lockup.cancelMultiple({ streamIds: Solarray.uint256s(cancelMultipleStreamIds[0], nullStreamId) }); } function test_RevertGiven_AtleastOneColdStream() @@ -38,10 +37,9 @@ abstract contract CancelMultiple_Integration_Concrete_Test is CancelMultiple_Int whenNonZeroArrayLength givenNoNullStreams { - uint256 earlyStreamId = createDefaultStreamWithEndTime({ endTime: defaults.CLIFF_TIME() + 1 seconds }); vm.warp({ newTimestamp: defaults.CLIFF_TIME() + 1 seconds }); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_StreamSettled.selector, earlyStreamId)); - lockup.cancelMultiple({ streamIds: Solarray.uint256s(testStreamIds[0], earlyStreamId) }); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_StreamSettled.selector, earlyEndtimeStreamId)); + lockup.cancelMultiple({ streamIds: Solarray.uint256s(cancelMultipleStreamIds[0], earlyEndtimeStreamId) }); } function test_RevertWhen_CallerUnauthorizedForAny() @@ -56,9 +54,11 @@ abstract contract CancelMultiple_Integration_Concrete_Test is CancelMultiple_Int // Run the test. vm.expectRevert( - abi.encodeWithSelector(Errors.SablierLockup_Unauthorized.selector, testStreamIds[0], users.recipient) + abi.encodeWithSelector( + Errors.SablierLockupBase_Unauthorized.selector, cancelMultipleStreamIds[0], users.recipient + ) ); - lockup.cancelMultiple(testStreamIds); + lockup.cancelMultiple(cancelMultipleStreamIds); } function test_RevertGiven_AtleastOneNonCancelableStream() @@ -69,11 +69,10 @@ abstract contract CancelMultiple_Integration_Concrete_Test is CancelMultiple_Int givenNoColdStreams whenCallerAuthorizedForAll { - uint256 notCancelableStreamId = createDefaultStreamNotCancelable(); vm.expectRevert( - abi.encodeWithSelector(Errors.SablierLockup_StreamNotCancelable.selector, notCancelableStreamId) + abi.encodeWithSelector(Errors.SablierLockupBase_StreamNotCancelable.selector, notCancelableStreamId) ); - lockup.cancelMultiple({ streamIds: Solarray.uint256s(testStreamIds[0], notCancelableStreamId) }); + lockup.cancelMultiple({ streamIds: Solarray.uint256s(cancelMultipleStreamIds[0], notCancelableStreamId) }); } function test_GivenNoNonCancelableStreams() @@ -88,15 +87,15 @@ abstract contract CancelMultiple_Integration_Concrete_Test is CancelMultiple_Int vm.warp({ newTimestamp: defaults.WARP_26_PERCENT() }); // It should refund the sender. - uint128 senderAmount0 = lockup.refundableAmountOf(testStreamIds[0]); + uint128 senderAmount0 = lockup.refundableAmountOf(cancelMultipleStreamIds[0]); expectCallToTransfer({ to: users.sender, value: senderAmount0 }); - uint128 senderAmount1 = lockup.refundableAmountOf(testStreamIds[1]); + uint128 senderAmount1 = lockup.refundableAmountOf(cancelMultipleStreamIds[1]); expectCallToTransfer({ to: users.sender, value: senderAmount1 }); // It should emit {CancelLockupStream} events for all streams. vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.CancelLockupStream({ - streamId: testStreamIds[0], + emit ISablierLockupBase.CancelLockupStream({ + streamId: cancelMultipleStreamIds[0], sender: users.sender, recipient: users.recipient, asset: dai, @@ -104,8 +103,8 @@ abstract contract CancelMultiple_Integration_Concrete_Test is CancelMultiple_Int recipientAmount: defaults.DEPOSIT_AMOUNT() - senderAmount0 }); vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.CancelLockupStream({ - streamId: testStreamIds[1], + emit ISablierLockupBase.CancelLockupStream({ + streamId: cancelMultipleStreamIds[1], sender: users.sender, recipient: users.recipient, asset: dai, @@ -114,24 +113,24 @@ abstract contract CancelMultiple_Integration_Concrete_Test is CancelMultiple_Int }); // Cancel the streams. - lockup.cancelMultiple(testStreamIds); + lockup.cancelMultiple(cancelMultipleStreamIds); // It should mark the streams as canceled. Lockup.Status expectedStatus = Lockup.Status.CANCELED; - assertEq(lockup.statusOf(testStreamIds[0]), expectedStatus, "status0"); - assertEq(lockup.statusOf(testStreamIds[1]), expectedStatus, "status1"); + assertEq(lockup.statusOf(cancelMultipleStreamIds[0]), expectedStatus, "status0"); + assertEq(lockup.statusOf(cancelMultipleStreamIds[1]), expectedStatus, "status1"); // It should make the streams as non cancelable. - assertFalse(lockup.isCancelable(testStreamIds[0]), "isCancelable0"); - assertFalse(lockup.isCancelable(testStreamIds[1]), "isCancelable1"); + assertFalse(lockup.isCancelable(cancelMultipleStreamIds[0]), "isCancelable0"); + assertFalse(lockup.isCancelable(cancelMultipleStreamIds[1]), "isCancelable1"); // It should update the refunded amounts. - assertEq(lockup.getRefundedAmount(testStreamIds[0]), senderAmount0, "refundedAmount0"); - assertEq(lockup.getRefundedAmount(testStreamIds[1]), senderAmount1, "refundedAmount1"); + assertEq(lockup.getRefundedAmount(cancelMultipleStreamIds[0]), senderAmount0, "refundedAmount0"); + assertEq(lockup.getRefundedAmount(cancelMultipleStreamIds[1]), senderAmount1, "refundedAmount1"); // It should not burn the NFT for all streams. address expectedNFTOwner = users.recipient; - assertEq(lockup.getRecipient(testStreamIds[0]), expectedNFTOwner, "NFT owner0"); - assertEq(lockup.getRecipient(testStreamIds[1]), expectedNFTOwner, "NFT owner1"); + assertEq(lockup.getRecipient(cancelMultipleStreamIds[0]), expectedNFTOwner, "NFT owner0"); + assertEq(lockup.getRecipient(cancelMultipleStreamIds[1]), expectedNFTOwner, "NFT owner1"); } } diff --git a/test/core/integration/concrete/lockup/cancel-multiple/cancelMultiple.tree b/test/core/integration/concrete/lockup-base/cancel-multiple/cancelMultiple.tree similarity index 100% rename from test/core/integration/concrete/lockup/cancel-multiple/cancelMultiple.tree rename to test/core/integration/concrete/lockup-base/cancel-multiple/cancelMultiple.tree diff --git a/test/core/integration/concrete/lockup/cancel/cancel.t.sol b/test/core/integration/concrete/lockup-base/cancel/cancel.t.sol similarity index 71% rename from test/core/integration/concrete/lockup/cancel/cancel.t.sol rename to test/core/integration/concrete/lockup-base/cancel/cancel.t.sol index 19794e7e3..2c2c32811 100644 --- a/test/core/integration/concrete/lockup/cancel/cancel.t.sol +++ b/test/core/integration/concrete/lockup-base/cancel/cancel.t.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.22 <0.9.0; import { IERC4906 } from "@openzeppelin/contracts/interfaces/IERC4906.sol"; -import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; +import { ISablierLockupBase } from "src/core/interfaces/ISablierLockupBase.sol"; import { ISablierLockupRecipient } from "src/core/interfaces/ISablierLockupRecipient.sol"; import { Errors } from "src/core/libraries/Errors.sol"; import { Lockup } from "src/core/types/DataTypes.sol"; @@ -12,34 +12,34 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract Cancel_Integration_Concrete_Test is Integration_Test { function test_RevertWhen_DelegateCall() external { - bytes memory callData = abi.encodeCall(ISablierLockup.cancel, defaultStreamId); + bytes memory callData = abi.encodeCall(ISablierLockupBase.cancel, defaultStreamId); (bool success, bytes memory returnData) = address(lockup).delegatecall(callData); expectRevertDueToDelegateCall(success, returnData); } function test_RevertGiven_Null() external whenNoDelegateCall { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.cancel(nullStreamId); } function test_RevertGiven_DEPLETEDStatus() external whenNoDelegateCall givenNotNull givenColdStream { vm.warp({ newTimestamp: defaults.END_TIME() }); lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_StreamDepleted.selector, defaultStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_StreamDepleted.selector, defaultStreamId)); lockup.cancel(defaultStreamId); } function test_RevertGiven_CANCELEDStatus() external whenNoDelegateCall givenNotNull givenColdStream { vm.warp({ newTimestamp: defaults.CLIFF_TIME() }); lockup.cancel(defaultStreamId); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_StreamCanceled.selector, defaultStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_StreamCanceled.selector, defaultStreamId)); lockup.cancel(defaultStreamId); } function test_RevertGiven_SETTLEDStatus() external whenNoDelegateCall givenNotNull givenColdStream { vm.warp({ newTimestamp: defaults.END_TIME() }); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_StreamSettled.selector, defaultStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_StreamSettled.selector, defaultStreamId)); lockup.cancel(defaultStreamId); } @@ -54,7 +54,9 @@ abstract contract Cancel_Integration_Concrete_Test is Integration_Test { resetPrank({ msgSender: users.eve }); // Run the test. - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Unauthorized.selector, defaultStreamId, users.eve)); + vm.expectRevert( + abi.encodeWithSelector(Errors.SablierLockupBase_Unauthorized.selector, defaultStreamId, users.eve) + ); lockup.cancel(defaultStreamId); } @@ -70,7 +72,7 @@ abstract contract Cancel_Integration_Concrete_Test is Integration_Test { // Run the test. vm.expectRevert( - abi.encodeWithSelector(Errors.SablierLockup_Unauthorized.selector, defaultStreamId, users.recipient) + abi.encodeWithSelector(Errors.SablierLockupBase_Unauthorized.selector, defaultStreamId, users.recipient) ); lockup.cancel(defaultStreamId); } @@ -82,9 +84,10 @@ abstract contract Cancel_Integration_Concrete_Test is Integration_Test { givenWarmStream whenCallerSender { - uint256 streamId = createDefaultStreamNotCancelable(); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_StreamNotCancelable.selector, streamId)); - lockup.cancel(streamId); + vm.expectRevert( + abi.encodeWithSelector(Errors.SablierLockupBase_StreamNotCancelable.selector, notCancelableStreamId) + ); + lockup.cancel(notCancelableStreamId); } function test_GivenPENDINGStatus() @@ -120,25 +123,23 @@ abstract contract Cancel_Integration_Concrete_Test is Integration_Test { givenCancelableStream givenSTREAMINGStatus { - // Create the stream with a recipient contract that implements {ISablierLockupRecipient}. - uint256 streamId = createDefaultStreamWithRecipient(address(recipientGood)); - // It should not make Sablier run the recipient hook. - uint128 senderAmount = lockup.refundableAmountOf(streamId); - uint128 recipientAmount = lockup.withdrawableAmountOf(streamId); + uint128 senderAmount = lockup.refundableAmountOf(recipientContractStreamId); + uint128 recipientAmount = lockup.withdrawableAmountOf(recipientContractStreamId); vm.expectCall({ callee: address(recipientGood), data: abi.encodeCall( - ISablierLockupRecipient.onSablierLockupCancel, (streamId, users.sender, senderAmount, recipientAmount) + ISablierLockupRecipient.onSablierLockupCancel, + (recipientContractStreamId, users.sender, senderAmount, recipientAmount) ), count: 0 }); // Cancel the stream. - lockup.cancel(streamId); + lockup.cancel(recipientContractStreamId); // It should mark the stream as canceled. - Lockup.Status actualStatus = lockup.statusOf(streamId); + Lockup.Status actualStatus = lockup.statusOf(recipientContractStreamId); Lockup.Status expectedStatus = Lockup.Status.CANCELED; assertEq(actualStatus, expectedStatus); } @@ -158,14 +159,11 @@ abstract contract Cancel_Integration_Concrete_Test is Integration_Test { lockup.allowToHook(address(recipientReverting)); resetPrank({ msgSender: users.sender }); - // Create the stream with a reverting contract as the stream's recipient. - uint256 streamId = createDefaultStreamWithRecipient(address(recipientReverting)); - // It should revert. vm.expectRevert("You shall not pass"); // Cancel the stream. - lockup.cancel(streamId); + lockup.cancel(recipientRevertStreamId); } function test_RevertWhen_RecipientReturnsInvalidSelector() @@ -184,16 +182,15 @@ abstract contract Cancel_Integration_Concrete_Test is Integration_Test { lockup.allowToHook(address(recipientInvalidSelector)); resetPrank({ msgSender: users.sender }); - // Create the stream with a recipient contract that returns invalid selector bytes on the hook call. - uint256 streamId = createDefaultStreamWithRecipient(address(recipientInvalidSelector)); - // It should revert. vm.expectRevert( - abi.encodeWithSelector(Errors.SablierLockup_InvalidHookSelector.selector, address(recipientInvalidSelector)) + abi.encodeWithSelector( + Errors.SablierLockupBase_InvalidHookSelector.selector, address(recipientInvalidSelector) + ) ); // Cancel the stream. - lockup.cancel(streamId); + lockup.cancel(recipientInvalidSelectorStreamId); } function test_WhenReentrancy() @@ -213,35 +210,35 @@ abstract contract Cancel_Integration_Concrete_Test is Integration_Test { lockup.allowToHook(address(recipientReentrant)); resetPrank({ msgSender: users.sender }); - // Create the stream with a reentrant contract as the recipient. - uint256 streamId = createDefaultStreamWithRecipient(address(recipientReentrant)); - // It should make Sablier run the recipient hook. - uint128 senderAmount = lockup.refundableAmountOf(streamId); - uint128 recipientAmount = lockup.withdrawableAmountOf(streamId); + uint128 senderAmount = lockup.refundableAmountOf(recipientReentrantStreamId); + uint128 recipientAmount = lockup.withdrawableAmountOf(recipientReentrantStreamId); vm.expectCall( address(recipientReentrant), abi.encodeCall( - ISablierLockupRecipient.onSablierLockupCancel, (streamId, users.sender, senderAmount, recipientAmount) + ISablierLockupRecipient.onSablierLockupCancel, + (recipientReentrantStreamId, users.sender, senderAmount, recipientAmount) ) ); // It should perform a reentrancy call to the Lockup contract. vm.expectCall( address(lockup), - abi.encodeCall(ISablierLockup.withdraw, (streamId, address(recipientReentrant), recipientAmount)) + abi.encodeCall( + ISablierLockupBase.withdraw, (recipientReentrantStreamId, address(recipientReentrant), recipientAmount) + ) ); // Cancel the stream. - lockup.cancel(streamId); + lockup.cancel(recipientReentrantStreamId); // It should mark the stream as depleted. The reentrant recipient withdrew all the funds. - Lockup.Status actualStatus = lockup.statusOf(streamId); + Lockup.Status actualStatus = lockup.statusOf(recipientReentrantStreamId); Lockup.Status expectedStatus = Lockup.Status.DEPLETED; assertEq(actualStatus, expectedStatus); // It should make the withdrawal via the reentrancy. - uint128 actualWithdrawnAmount = lockup.getWithdrawnAmount(streamId); + uint128 actualWithdrawnAmount = lockup.getWithdrawnAmount(recipientReentrantStreamId); assertEq(actualWithdrawnAmount, recipientAmount, "withdrawnAmount"); } @@ -262,49 +259,47 @@ abstract contract Cancel_Integration_Concrete_Test is Integration_Test { lockup.allowToHook(address(recipientGood)); resetPrank({ msgSender: users.sender }); - // Create the stream. - uint256 streamId = createDefaultStreamWithRecipient(address(recipientGood)); - // It should refund the sender. - uint128 senderAmount = lockup.refundableAmountOf(streamId); + uint128 senderAmount = lockup.refundableAmountOf(recipientContractStreamId); expectCallToTransfer({ to: users.sender, value: senderAmount }); // It should make Sablier run the recipient hook. - uint128 recipientAmount = lockup.withdrawableAmountOf(streamId); + uint128 recipientAmount = lockup.withdrawableAmountOf(recipientContractStreamId); vm.expectCall( address(recipientGood), abi.encodeCall( - ISablierLockupRecipient.onSablierLockupCancel, (streamId, users.sender, senderAmount, recipientAmount) + ISablierLockupRecipient.onSablierLockupCancel, + (recipientContractStreamId, users.sender, senderAmount, recipientAmount) ) ); // It should emit {MetadataUpdate} and {CancelLockupStream} events. vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.CancelLockupStream( - streamId, users.sender, address(recipientGood), dai, senderAmount, recipientAmount + emit ISablierLockupBase.CancelLockupStream( + recipientContractStreamId, users.sender, address(recipientGood), dai, senderAmount, recipientAmount ); vm.expectEmit({ emitter: address(lockup) }); - emit IERC4906.MetadataUpdate({ _tokenId: streamId }); + emit IERC4906.MetadataUpdate({ _tokenId: recipientContractStreamId }); // Cancel the stream. - lockup.cancel(streamId); + lockup.cancel(recipientContractStreamId); // It should mark the stream as canceled. - Lockup.Status actualStatus = lockup.statusOf(streamId); + Lockup.Status actualStatus = lockup.statusOf(recipientContractStreamId); Lockup.Status expectedStatus = Lockup.Status.CANCELED; assertEq(actualStatus, expectedStatus); // It should make the stream as non cancelable. - bool isCancelable = lockup.isCancelable(streamId); + bool isCancelable = lockup.isCancelable(recipientContractStreamId); assertFalse(isCancelable, "isCancelable"); // It should update the refunded amount. - uint128 actualRefundedAmount = lockup.getRefundedAmount(streamId); + uint128 actualRefundedAmount = lockup.getRefundedAmount(recipientContractStreamId); uint128 expectedRefundedAmount = senderAmount; assertEq(actualRefundedAmount, expectedRefundedAmount, "refundedAmount"); // It should not burn the NFT. - address actualNFTOwner = lockup.ownerOf({ tokenId: streamId }); + address actualNFTOwner = lockup.ownerOf({ tokenId: recipientContractStreamId }); address expectedNFTOwner = address(recipientGood); assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } diff --git a/test/core/integration/concrete/lockup/cancel/cancel.tree b/test/core/integration/concrete/lockup-base/cancel/cancel.tree similarity index 100% rename from test/core/integration/concrete/lockup/cancel/cancel.tree rename to test/core/integration/concrete/lockup-base/cancel/cancel.tree diff --git a/test/core/integration/concrete/lockup/get-asset/getAsset.t.sol b/test/core/integration/concrete/lockup-base/get-asset/getAsset.t.sol similarity index 77% rename from test/core/integration/concrete/lockup/get-asset/getAsset.t.sol rename to test/core/integration/concrete/lockup-base/get-asset/getAsset.t.sol index 582620243..94321637c 100644 --- a/test/core/integration/concrete/lockup/get-asset/getAsset.t.sol +++ b/test/core/integration/concrete/lockup-base/get-asset/getAsset.t.sol @@ -9,13 +9,12 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract GetAsset_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.getAsset(nullStreamId); } - function test_GivenNotNull() external { - uint256 streamId = createDefaultStream(); - IERC20 actualAsset = lockup.getAsset(streamId); + function test_GivenNotNull() external view { + IERC20 actualAsset = lockup.getAsset(defaultStreamId); IERC20 expectedAsset = dai; assertEq(actualAsset, expectedAsset, "asset"); } diff --git a/test/core/integration/concrete/lockup/get-asset/getAsset.tree b/test/core/integration/concrete/lockup-base/get-asset/getAsset.tree similarity index 100% rename from test/core/integration/concrete/lockup/get-asset/getAsset.tree rename to test/core/integration/concrete/lockup-base/get-asset/getAsset.tree diff --git a/test/core/integration/concrete/lockup/get-deposited-amount/getDepositedAmount.t.sol b/test/core/integration/concrete/lockup-base/get-deposited-amount/getDepositedAmount.t.sol similarity index 83% rename from test/core/integration/concrete/lockup/get-deposited-amount/getDepositedAmount.t.sol rename to test/core/integration/concrete/lockup-base/get-deposited-amount/getDepositedAmount.t.sol index ed091abc0..dd24ce14e 100644 --- a/test/core/integration/concrete/lockup/get-deposited-amount/getDepositedAmount.t.sol +++ b/test/core/integration/concrete/lockup-base/get-deposited-amount/getDepositedAmount.t.sol @@ -8,13 +8,12 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract GetDepositedAmount_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.getDepositedAmount(nullStreamId); } - function test_GivenNotNull() external { - uint256 streamId = createDefaultStream(); - uint128 actualDepositedAmount = lockup.getDepositedAmount(streamId); + function test_GivenNotNull() external view { + uint128 actualDepositedAmount = lockup.getDepositedAmount(defaultStreamId); uint128 expectedDepositedAmount = defaults.DEPOSIT_AMOUNT(); assertEq(actualDepositedAmount, expectedDepositedAmount, "depositedAmount"); } diff --git a/test/core/integration/concrete/lockup/get-deposited-amount/getDepositedAmount.tree b/test/core/integration/concrete/lockup-base/get-deposited-amount/getDepositedAmount.tree similarity index 100% rename from test/core/integration/concrete/lockup/get-deposited-amount/getDepositedAmount.tree rename to test/core/integration/concrete/lockup-base/get-deposited-amount/getDepositedAmount.tree diff --git a/test/core/integration/concrete/lockup/get-end-time/getEndTime.t.sol b/test/core/integration/concrete/lockup-base/get-end-time/getEndTime.t.sol similarity index 75% rename from test/core/integration/concrete/lockup/get-end-time/getEndTime.t.sol rename to test/core/integration/concrete/lockup-base/get-end-time/getEndTime.t.sol index 475347b27..6635d9b2f 100644 --- a/test/core/integration/concrete/lockup/get-end-time/getEndTime.t.sol +++ b/test/core/integration/concrete/lockup-base/get-end-time/getEndTime.t.sol @@ -8,13 +8,12 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract GetEndTime_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.getEndTime(nullStreamId); } - function test_GivenNotNull() external { - uint256 streamId = createDefaultStream(); - uint40 actualEndTime = lockup.getEndTime(streamId); + function test_GivenNotNull() external view { + uint40 actualEndTime = lockup.getEndTime(defaultStreamId); uint40 expectedEndTime = defaults.END_TIME(); assertEq(actualEndTime, expectedEndTime, "endTime"); } diff --git a/test/core/integration/concrete/lockup/get-end-time/getEndTime.tree b/test/core/integration/concrete/lockup-base/get-end-time/getEndTime.tree similarity index 100% rename from test/core/integration/concrete/lockup/get-end-time/getEndTime.tree rename to test/core/integration/concrete/lockup-base/get-end-time/getEndTime.tree diff --git a/test/core/integration/concrete/lockup/get-recipient/getRecipient.t.sol b/test/core/integration/concrete/lockup-base/get-recipient/getRecipient.t.sol similarity index 100% rename from test/core/integration/concrete/lockup/get-recipient/getRecipient.t.sol rename to test/core/integration/concrete/lockup-base/get-recipient/getRecipient.t.sol diff --git a/test/core/integration/concrete/lockup/get-recipient/getRecipient.tree b/test/core/integration/concrete/lockup-base/get-recipient/getRecipient.tree similarity index 100% rename from test/core/integration/concrete/lockup/get-recipient/getRecipient.tree rename to test/core/integration/concrete/lockup-base/get-recipient/getRecipient.tree diff --git a/test/core/integration/concrete/lockup/get-refunded-amount/getRefundedAmount.t.sol b/test/core/integration/concrete/lockup-base/get-refunded-amount/getRefundedAmount.t.sol similarity index 98% rename from test/core/integration/concrete/lockup/get-refunded-amount/getRefundedAmount.t.sol rename to test/core/integration/concrete/lockup-base/get-refunded-amount/getRefundedAmount.t.sol index 6692d5b09..2ff0a6f07 100644 --- a/test/core/integration/concrete/lockup/get-refunded-amount/getRefundedAmount.t.sol +++ b/test/core/integration/concrete/lockup-base/get-refunded-amount/getRefundedAmount.t.sol @@ -8,7 +8,7 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract GetRefundedAmount_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.getRefundedAmount(nullStreamId); } diff --git a/test/core/integration/concrete/lockup/get-refunded-amount/getRefundedAmount.tree b/test/core/integration/concrete/lockup-base/get-refunded-amount/getRefundedAmount.tree similarity index 100% rename from test/core/integration/concrete/lockup/get-refunded-amount/getRefundedAmount.tree rename to test/core/integration/concrete/lockup-base/get-refunded-amount/getRefundedAmount.tree diff --git a/test/core/integration/concrete/lockup/get-sender/getSender.t.sol b/test/core/integration/concrete/lockup-base/get-sender/getSender.t.sol similarity index 75% rename from test/core/integration/concrete/lockup/get-sender/getSender.t.sol rename to test/core/integration/concrete/lockup-base/get-sender/getSender.t.sol index 05834d7c8..e5bc8fa18 100644 --- a/test/core/integration/concrete/lockup/get-sender/getSender.t.sol +++ b/test/core/integration/concrete/lockup-base/get-sender/getSender.t.sol @@ -8,13 +8,12 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract GetSender_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.getSender(nullStreamId); } - function test_GivenNotNull() external { - uint256 streamId = createDefaultStream(); - address actualSender = lockup.getSender(streamId); + function test_GivenNotNull() external view { + address actualSender = lockup.getSender(defaultStreamId); address expectedSender = users.sender; assertEq(actualSender, expectedSender, "sender"); } diff --git a/test/core/integration/concrete/lockup/get-sender/getSender.tree b/test/core/integration/concrete/lockup-base/get-sender/getSender.tree similarity index 100% rename from test/core/integration/concrete/lockup/get-sender/getSender.tree rename to test/core/integration/concrete/lockup-base/get-sender/getSender.tree diff --git a/test/core/integration/concrete/lockup/get-start-time/getStartTime.t.sol b/test/core/integration/concrete/lockup-base/get-start-time/getStartTime.t.sol similarity index 89% rename from test/core/integration/concrete/lockup/get-start-time/getStartTime.t.sol rename to test/core/integration/concrete/lockup-base/get-start-time/getStartTime.t.sol index 8ea7e1fd4..6f46697f7 100644 --- a/test/core/integration/concrete/lockup/get-start-time/getStartTime.t.sol +++ b/test/core/integration/concrete/lockup-base/get-start-time/getStartTime.t.sol @@ -8,13 +8,13 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract GetStartTime_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.getStartTime(nullStreamId); } function test_GivenNotNull() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.getStartTime(nullStreamId); } } diff --git a/test/core/integration/concrete/lockup/get-start-time/getStartTime.tree b/test/core/integration/concrete/lockup-base/get-start-time/getStartTime.tree similarity index 100% rename from test/core/integration/concrete/lockup/get-start-time/getStartTime.tree rename to test/core/integration/concrete/lockup-base/get-start-time/getStartTime.tree diff --git a/test/core/integration/concrete/lockup/get-withdrawn-amount/getWithdrawnAmount.t.sol b/test/core/integration/concrete/lockup-base/get-withdrawn-amount/getWithdrawnAmount.t.sol similarity index 97% rename from test/core/integration/concrete/lockup/get-withdrawn-amount/getWithdrawnAmount.t.sol rename to test/core/integration/concrete/lockup-base/get-withdrawn-amount/getWithdrawnAmount.t.sol index 65a3605e2..d9e115e43 100644 --- a/test/core/integration/concrete/lockup/get-withdrawn-amount/getWithdrawnAmount.t.sol +++ b/test/core/integration/concrete/lockup-base/get-withdrawn-amount/getWithdrawnAmount.t.sol @@ -8,7 +8,7 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract GetWithdrawnAmount_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.getWithdrawnAmount(nullStreamId); } diff --git a/test/core/integration/concrete/lockup/get-withdrawn-amount/getWithdrawnAmount.tree b/test/core/integration/concrete/lockup-base/get-withdrawn-amount/getWithdrawnAmount.tree similarity index 100% rename from test/core/integration/concrete/lockup/get-withdrawn-amount/getWithdrawnAmount.tree rename to test/core/integration/concrete/lockup-base/get-withdrawn-amount/getWithdrawnAmount.tree diff --git a/test/core/integration/concrete/lockup/is-allowed-to-hook/isAllowedToHook.t.sol b/test/core/integration/concrete/lockup-base/is-allowed-to-hook/isAllowedToHook.t.sol similarity index 100% rename from test/core/integration/concrete/lockup/is-allowed-to-hook/isAllowedToHook.t.sol rename to test/core/integration/concrete/lockup-base/is-allowed-to-hook/isAllowedToHook.t.sol diff --git a/test/core/integration/concrete/lockup/is-allowed-to-hook/isAllowedToHook.tree b/test/core/integration/concrete/lockup-base/is-allowed-to-hook/isAllowedToHook.tree similarity index 100% rename from test/core/integration/concrete/lockup/is-allowed-to-hook/isAllowedToHook.tree rename to test/core/integration/concrete/lockup-base/is-allowed-to-hook/isAllowedToHook.tree diff --git a/test/core/integration/concrete/lockup/is-cancelable/isCancelable.t.sol b/test/core/integration/concrete/lockup-base/is-cancelable/isCancelable.t.sol similarity index 80% rename from test/core/integration/concrete/lockup/is-cancelable/isCancelable.t.sol rename to test/core/integration/concrete/lockup-base/is-cancelable/isCancelable.t.sol index 0c9024ea1..01edb1133 100644 --- a/test/core/integration/concrete/lockup/is-cancelable/isCancelable.t.sol +++ b/test/core/integration/concrete/lockup-base/is-cancelable/isCancelable.t.sol @@ -8,7 +8,7 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract IsCancelable_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.isCancelable(nullStreamId); } @@ -23,9 +23,8 @@ abstract contract IsCancelable_Integration_Concrete_Test is Integration_Test { assertTrue(isCancelable, "isCancelable"); } - function test_GivenNonCancelableStream() external givenNotNull givenWarmStream { - uint256 streamId = createDefaultStreamNotCancelable(); - bool isCancelable = lockup.isCancelable(streamId); + function test_GivenNonCancelableStream() external view givenNotNull givenWarmStream { + bool isCancelable = lockup.isCancelable(notCancelableStreamId); assertFalse(isCancelable, "isCancelable"); } } diff --git a/test/core/integration/concrete/lockup/is-cancelable/isCancelable.tree b/test/core/integration/concrete/lockup-base/is-cancelable/isCancelable.tree similarity index 100% rename from test/core/integration/concrete/lockup/is-cancelable/isCancelable.tree rename to test/core/integration/concrete/lockup-base/is-cancelable/isCancelable.tree diff --git a/test/core/integration/concrete/lockup/is-cold/isCold.t.sol b/test/core/integration/concrete/lockup-base/is-cold/isCold.t.sol similarity index 97% rename from test/core/integration/concrete/lockup/is-cold/isCold.t.sol rename to test/core/integration/concrete/lockup-base/is-cold/isCold.t.sol index da1a1a2bc..4835d6970 100644 --- a/test/core/integration/concrete/lockup/is-cold/isCold.t.sol +++ b/test/core/integration/concrete/lockup-base/is-cold/isCold.t.sol @@ -8,7 +8,7 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract IsCold_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.isCold(nullStreamId); } diff --git a/test/core/integration/concrete/lockup/is-cold/isCold.tree b/test/core/integration/concrete/lockup-base/is-cold/isCold.tree similarity index 100% rename from test/core/integration/concrete/lockup/is-cold/isCold.tree rename to test/core/integration/concrete/lockup-base/is-cold/isCold.tree diff --git a/test/core/integration/concrete/lockup/is-depleted/isDepleted.t.sol b/test/core/integration/concrete/lockup-base/is-depleted/isDepleted.t.sol similarity index 96% rename from test/core/integration/concrete/lockup/is-depleted/isDepleted.t.sol rename to test/core/integration/concrete/lockup-base/is-depleted/isDepleted.t.sol index 3ce146c15..9468190a0 100644 --- a/test/core/integration/concrete/lockup/is-depleted/isDepleted.t.sol +++ b/test/core/integration/concrete/lockup-base/is-depleted/isDepleted.t.sol @@ -8,7 +8,7 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract IsDepleted_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.isDepleted(nullStreamId); } diff --git a/test/core/integration/concrete/lockup/is-depleted/isDepleted.tree b/test/core/integration/concrete/lockup-base/is-depleted/isDepleted.tree similarity index 100% rename from test/core/integration/concrete/lockup/is-depleted/isDepleted.tree rename to test/core/integration/concrete/lockup-base/is-depleted/isDepleted.tree diff --git a/test/core/integration/concrete/lockup/is-stream/isStream.t.sol b/test/core/integration/concrete/lockup-base/is-stream/isStream.t.sol similarity index 100% rename from test/core/integration/concrete/lockup/is-stream/isStream.t.sol rename to test/core/integration/concrete/lockup-base/is-stream/isStream.t.sol diff --git a/test/core/integration/concrete/lockup/is-stream/isStream.tree b/test/core/integration/concrete/lockup-base/is-stream/isStream.tree similarity index 100% rename from test/core/integration/concrete/lockup/is-stream/isStream.tree rename to test/core/integration/concrete/lockup-base/is-stream/isStream.tree diff --git a/test/core/integration/concrete/lockup/is-transferable/isTransferable.t.sol b/test/core/integration/concrete/lockup-base/is-transferable/isTransferable.t.sol similarity index 95% rename from test/core/integration/concrete/lockup/is-transferable/isTransferable.t.sol rename to test/core/integration/concrete/lockup-base/is-transferable/isTransferable.t.sol index 890f9fbec..baf9b663c 100644 --- a/test/core/integration/concrete/lockup/is-transferable/isTransferable.t.sol +++ b/test/core/integration/concrete/lockup-base/is-transferable/isTransferable.t.sol @@ -8,7 +8,7 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract IsTransferable_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.isTransferable(nullStreamId); } diff --git a/test/core/integration/concrete/lockup/is-transferable/isTransferable.tree b/test/core/integration/concrete/lockup-base/is-transferable/isTransferable.tree similarity index 100% rename from test/core/integration/concrete/lockup/is-transferable/isTransferable.tree rename to test/core/integration/concrete/lockup-base/is-transferable/isTransferable.tree diff --git a/test/core/integration/concrete/lockup/is-warm/isWarm.t.sol b/test/core/integration/concrete/lockup-base/is-warm/isWarm.t.sol similarity index 97% rename from test/core/integration/concrete/lockup/is-warm/isWarm.t.sol rename to test/core/integration/concrete/lockup-base/is-warm/isWarm.t.sol index 989b2c5a8..744265945 100644 --- a/test/core/integration/concrete/lockup/is-warm/isWarm.t.sol +++ b/test/core/integration/concrete/lockup-base/is-warm/isWarm.t.sol @@ -8,7 +8,7 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract IsWarm_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.isWarm(nullStreamId); } diff --git a/test/core/integration/concrete/lockup/is-warm/isWarm.tree b/test/core/integration/concrete/lockup-base/is-warm/isWarm.tree similarity index 100% rename from test/core/integration/concrete/lockup/is-warm/isWarm.tree rename to test/core/integration/concrete/lockup-base/is-warm/isWarm.tree diff --git a/test/core/integration/concrete/lockup/refundable-amount-of/refundableAmountOf.t.sol b/test/core/integration/concrete/lockup-base/refundable-amount-of/refundableAmountOf.t.sol similarity index 96% rename from test/core/integration/concrete/lockup/refundable-amount-of/refundableAmountOf.t.sol rename to test/core/integration/concrete/lockup-base/refundable-amount-of/refundableAmountOf.t.sol index 37ab4a643..d1389baa1 100644 --- a/test/core/integration/concrete/lockup/refundable-amount-of/refundableAmountOf.t.sol +++ b/test/core/integration/concrete/lockup-base/refundable-amount-of/refundableAmountOf.t.sol @@ -8,14 +8,13 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract RefundableAmountOf_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.refundableAmountOf(nullStreamId); } function test_GivenNonCancelableStream() external givenNotNull { - uint256 streamId = createDefaultStreamNotCancelable(); vm.warp({ newTimestamp: defaults.CLIFF_TIME() }); - uint128 actualRefundableAmount = lockup.refundableAmountOf(streamId); + uint128 actualRefundableAmount = lockup.refundableAmountOf(notCancelableStreamId); uint128 expectedRefundableAmount = 0; assertEq(actualRefundableAmount, expectedRefundableAmount, "refundableAmount"); } diff --git a/test/core/integration/concrete/lockup/refundable-amount-of/refundableAmountOf.tree b/test/core/integration/concrete/lockup-base/refundable-amount-of/refundableAmountOf.tree similarity index 100% rename from test/core/integration/concrete/lockup/refundable-amount-of/refundableAmountOf.tree rename to test/core/integration/concrete/lockup-base/refundable-amount-of/refundableAmountOf.tree diff --git a/test/core/integration/concrete/lockup/renounce/renounce.t.sol b/test/core/integration/concrete/lockup-base/renounce/renounce.t.sol similarity index 77% rename from test/core/integration/concrete/lockup/renounce/renounce.t.sol rename to test/core/integration/concrete/lockup-base/renounce/renounce.t.sol index 685af48f9..6f6cf60c9 100644 --- a/test/core/integration/concrete/lockup/renounce/renounce.t.sol +++ b/test/core/integration/concrete/lockup-base/renounce/renounce.t.sol @@ -3,49 +3,53 @@ pragma solidity >=0.8.22 <0.9.0; import { IERC4906 } from "@openzeppelin/contracts/interfaces/IERC4906.sol"; -import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; +import { ISablierLockupBase } from "src/core/interfaces/ISablierLockupBase.sol"; import { Errors } from "src/core/libraries/Errors.sol"; import { Integration_Test } from "../../../Integration.t.sol"; abstract contract Renounce_Integration_Concrete_Test is Integration_Test { + uint256 internal streamId; + function test_RevertWhen_DelegateCall() external { - bytes memory callData = abi.encodeCall(ISablierLockup.renounce, defaultStreamId); + bytes memory callData = abi.encodeCall(ISablierLockupBase.renounce, defaultStreamId); (bool success, bytes memory returnData) = address(lockup).delegatecall(callData); expectRevertDueToDelegateCall(success, returnData); } function test_RevertGiven_Null() external whenNoDelegateCall { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.renounce(nullStreamId); } function test_RevertGiven_DEPLETEDStatus() external whenNoDelegateCall givenNotNull givenColdStream { vm.warp({ newTimestamp: defaults.END_TIME() }); lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_StreamDepleted.selector, defaultStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_StreamDepleted.selector, defaultStreamId)); lockup.renounce(defaultStreamId); } function test_RevertGiven_CANCELEDStatus() external whenNoDelegateCall givenNotNull givenColdStream { vm.warp({ newTimestamp: defaults.CLIFF_TIME() }); lockup.cancel(defaultStreamId); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_StreamCanceled.selector, defaultStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_StreamCanceled.selector, defaultStreamId)); lockup.renounce(defaultStreamId); } function test_RevertGiven_SETTLEDStatus() external whenNoDelegateCall givenNotNull givenColdStream { vm.warp({ newTimestamp: defaults.END_TIME() }); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_StreamSettled.selector, defaultStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_StreamSettled.selector, defaultStreamId)); lockup.renounce(defaultStreamId); } modifier givenWarmStreamRenounce() { vm.warp({ newTimestamp: defaults.START_TIME() - 1 seconds }); + streamId = defaultStreamId; _; vm.warp({ newTimestamp: defaults.START_TIME() }); + streamId = recipientContractStreamId; _; } @@ -54,7 +58,9 @@ abstract contract Renounce_Integration_Concrete_Test is Integration_Test { resetPrank({ msgSender: users.eve }); // Run the test. - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Unauthorized.selector, defaultStreamId, users.eve)); + vm.expectRevert( + abi.encodeWithSelector(Errors.SablierLockupBase_Unauthorized.selector, defaultStreamId, users.eve) + ); lockup.renounce(defaultStreamId); } @@ -65,12 +71,9 @@ abstract contract Renounce_Integration_Concrete_Test is Integration_Test { givenWarmStreamRenounce whenCallerSender { - // Create the not cancelable stream. - uint256 notCancelableStreamId = createDefaultStreamNotCancelable(); - // Run the test. vm.expectRevert( - abi.encodeWithSelector(Errors.SablierLockup_StreamNotCancelable.selector, notCancelableStreamId) + abi.encodeWithSelector(Errors.SablierLockupBase_StreamNotCancelable.selector, notCancelableStreamId) ); lockup.renounce(notCancelableStreamId); } @@ -82,12 +85,9 @@ abstract contract Renounce_Integration_Concrete_Test is Integration_Test { givenWarmStreamRenounce whenCallerSender { - // Create the stream with a contract as the stream's recipient. - uint256 streamId = createDefaultStreamWithRecipient(address(recipientGood)); - // It should emit {MetadataUpdate} and {RenounceLockupStream} events. vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.RenounceLockupStream(streamId); + emit ISablierLockupBase.RenounceLockupStream(streamId); vm.expectEmit({ emitter: address(lockup) }); emit IERC4906.MetadataUpdate({ _tokenId: streamId }); diff --git a/test/core/integration/concrete/lockup/renounce/renounce.tree b/test/core/integration/concrete/lockup-base/renounce/renounce.tree similarity index 100% rename from test/core/integration/concrete/lockup/renounce/renounce.tree rename to test/core/integration/concrete/lockup-base/renounce/renounce.tree diff --git a/test/core/integration/concrete/lockup/set-nft-descriptor/setNFTDescriptor.t.sol b/test/core/integration/concrete/lockup-base/set-nft-descriptor/setNFTDescriptor.t.sol similarity index 89% rename from test/core/integration/concrete/lockup/set-nft-descriptor/setNFTDescriptor.t.sol rename to test/core/integration/concrete/lockup-base/set-nft-descriptor/setNFTDescriptor.t.sol index c03772d5d..201077db0 100644 --- a/test/core/integration/concrete/lockup/set-nft-descriptor/setNFTDescriptor.t.sol +++ b/test/core/integration/concrete/lockup-base/set-nft-descriptor/setNFTDescriptor.t.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.22 <0.9.0; import { IERC4906 } from "@openzeppelin/contracts/interfaces/IERC4906.sol"; import { ILockupNFTDescriptor } from "src/core/interfaces/ILockupNFTDescriptor.sol"; -import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; +import { ISablierLockupBase } from "src/core/interfaces/ISablierLockupBase.sol"; import { Errors } from "src/core/libraries/Errors.sol"; import { LockupNFTDescriptor } from "src/core/LockupNFTDescriptor.sol"; import { Integration_Test } from "./../../../Integration.t.sol"; @@ -21,7 +21,7 @@ abstract contract SetNFTDescriptor_Integration_Concrete_Test is Integration_Test function test_WhenProvidedAddressMatchesCurrentNFTDescriptor() external whenCallerAdmin { // It should emit {SetNFTDescriptor} and {BatchMetadataUpdate} events. vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.SetNFTDescriptor(users.admin, nftDescriptor, nftDescriptor); + emit ISablierLockupBase.SetNFTDescriptor(users.admin, nftDescriptor, nftDescriptor); vm.expectEmit({ emitter: address(lockup) }); emit IERC4906.BatchMetadataUpdate({ _fromTokenId: 1, _toTokenId: lockup.nextStreamId() - 1 }); @@ -39,7 +39,7 @@ abstract contract SetNFTDescriptor_Integration_Concrete_Test is Integration_Test // It should emit {SetNFTDescriptor} and {BatchMetadataUpdate} events. vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.SetNFTDescriptor(users.admin, nftDescriptor, newNFTDescriptor); + emit ISablierLockupBase.SetNFTDescriptor(users.admin, nftDescriptor, newNFTDescriptor); vm.expectEmit({ emitter: address(lockup) }); emit IERC4906.BatchMetadataUpdate({ _fromTokenId: 1, _toTokenId: lockup.nextStreamId() - 1 }); diff --git a/test/core/integration/concrete/lockup/set-nft-descriptor/setNFTDescriptor.tree b/test/core/integration/concrete/lockup-base/set-nft-descriptor/setNFTDescriptor.tree similarity index 100% rename from test/core/integration/concrete/lockup/set-nft-descriptor/setNFTDescriptor.tree rename to test/core/integration/concrete/lockup-base/set-nft-descriptor/setNFTDescriptor.tree diff --git a/test/core/integration/concrete/lockup/status-of/statusOf.t.sol b/test/core/integration/concrete/lockup-base/status-of/statusOf.t.sol similarity index 98% rename from test/core/integration/concrete/lockup/status-of/statusOf.t.sol rename to test/core/integration/concrete/lockup-base/status-of/statusOf.t.sol index d25903f34..a1274447d 100644 --- a/test/core/integration/concrete/lockup/status-of/statusOf.t.sol +++ b/test/core/integration/concrete/lockup-base/status-of/statusOf.t.sol @@ -9,7 +9,7 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract StatusOf_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.statusOf(nullStreamId); } diff --git a/test/core/integration/concrete/lockup/status-of/statusOf.tree b/test/core/integration/concrete/lockup-base/status-of/statusOf.tree similarity index 100% rename from test/core/integration/concrete/lockup/status-of/statusOf.tree rename to test/core/integration/concrete/lockup-base/status-of/statusOf.tree diff --git a/test/core/integration/concrete/lockup/streamed-amount-of/streamedAmountOf.t.sol b/test/core/integration/concrete/lockup-base/streamed-amount-of/streamedAmountOf.t.sol similarity index 98% rename from test/core/integration/concrete/lockup/streamed-amount-of/streamedAmountOf.t.sol rename to test/core/integration/concrete/lockup-base/streamed-amount-of/streamedAmountOf.t.sol index b3f59917b..159411dc7 100644 --- a/test/core/integration/concrete/lockup/streamed-amount-of/streamedAmountOf.t.sol +++ b/test/core/integration/concrete/lockup-base/streamed-amount-of/streamedAmountOf.t.sol @@ -8,7 +8,7 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract StreamedAmountOf_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.streamedAmountOf(nullStreamId); } diff --git a/test/core/integration/concrete/lockup/streamed-amount-of/streamedAmountOf.tree b/test/core/integration/concrete/lockup-base/streamed-amount-of/streamedAmountOf.tree similarity index 100% rename from test/core/integration/concrete/lockup/streamed-amount-of/streamedAmountOf.tree rename to test/core/integration/concrete/lockup-base/streamed-amount-of/streamedAmountOf.tree diff --git a/test/core/integration/concrete/lockup/transfer-from/transferFrom.t.sol b/test/core/integration/concrete/lockup-base/transfer-from/transferFrom.t.sol similarity index 91% rename from test/core/integration/concrete/lockup/transfer-from/transferFrom.t.sol rename to test/core/integration/concrete/lockup-base/transfer-from/transferFrom.t.sol index e86f05d8a..c1274144a 100644 --- a/test/core/integration/concrete/lockup/transfer-from/transferFrom.t.sol +++ b/test/core/integration/concrete/lockup-base/transfer-from/transferFrom.t.sol @@ -15,7 +15,9 @@ abstract contract TransferFrom_Integration_Concrete_Test is Integration_Test { } function test_RevertGiven_NonTransferableStream() external { - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_NotTransferable.selector, notTransferableStreamId)); + vm.expectRevert( + abi.encodeWithSelector(Errors.SablierLockupBase_NotTransferable.selector, notTransferableStreamId) + ); lockup.transferFrom({ from: users.recipient, to: users.alice, tokenId: notTransferableStreamId }); } diff --git a/test/core/integration/concrete/lockup/transfer-from/transferFrom.tree b/test/core/integration/concrete/lockup-base/transfer-from/transferFrom.tree similarity index 100% rename from test/core/integration/concrete/lockup/transfer-from/transferFrom.tree rename to test/core/integration/concrete/lockup-base/transfer-from/transferFrom.tree diff --git a/test/core/integration/concrete/lockup/was-canceled/wasCanceled.t.sol b/test/core/integration/concrete/lockup-base/was-canceled/wasCanceled.t.sol similarity index 95% rename from test/core/integration/concrete/lockup/was-canceled/wasCanceled.t.sol rename to test/core/integration/concrete/lockup-base/was-canceled/wasCanceled.t.sol index 5035dcc60..f001550db 100644 --- a/test/core/integration/concrete/lockup/was-canceled/wasCanceled.t.sol +++ b/test/core/integration/concrete/lockup-base/was-canceled/wasCanceled.t.sol @@ -8,7 +8,7 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract WasCanceled_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.wasCanceled(nullStreamId); } diff --git a/test/core/integration/concrete/lockup/was-canceled/wasCanceled.tree b/test/core/integration/concrete/lockup-base/was-canceled/wasCanceled.tree similarity index 100% rename from test/core/integration/concrete/lockup/was-canceled/wasCanceled.tree rename to test/core/integration/concrete/lockup-base/was-canceled/wasCanceled.tree diff --git a/test/core/integration/concrete/lockup/withdraw-hooks/withdrawHooks.t.sol b/test/core/integration/concrete/lockup-base/withdraw-hooks/withdrawHooks.t.sol similarity index 68% rename from test/core/integration/concrete/lockup/withdraw-hooks/withdrawHooks.t.sol rename to test/core/integration/concrete/lockup-base/withdraw-hooks/withdrawHooks.t.sol index 67d586a1c..061552860 100644 --- a/test/core/integration/concrete/lockup/withdraw-hooks/withdrawHooks.t.sol +++ b/test/core/integration/concrete/lockup-base/withdraw-hooks/withdrawHooks.t.sol @@ -18,9 +18,6 @@ abstract contract WithdrawHooks_Integration_Concrete_Test is Integration_Test { } function test_GivenRecipientSameAsSender() external { - // Create a stream with identical sender and recipient. - uint256 streamId = createDefaultStreamWithIdenticalUsers(users.sender); - // Simulate the passage of time. vm.warp({ newTimestamp: defaults.WARP_26_PERCENT() }); @@ -28,19 +25,17 @@ abstract contract WithdrawHooks_Integration_Concrete_Test is Integration_Test { vm.expectCall({ callee: users.sender, data: abi.encodeCall( - ISablierLockupRecipient.onSablierLockupWithdraw, (streamId, users.sender, users.sender, withdrawAmount) + ISablierLockupRecipient.onSablierLockupWithdraw, + (identicalSenderRecipientStreamId, users.sender, users.sender, withdrawAmount) ), count: 0 }); // Make the withdrawal. - lockup.withdraw({ streamId: streamId, to: users.sender, amount: withdrawAmount }); + lockup.withdraw({ streamId: identicalSenderRecipientStreamId, to: users.sender, amount: withdrawAmount }); } function test_WhenCallerUnknown() external givenRecipientNotSameAsSender { - // Create the test stream. - uint256 streamId = createDefaultStreamWithUsers({ recipient: address(recipientGood), sender: users.sender }); - // Make the unknown address the caller in this test. address unknownCaller = address(0xCAFE); resetPrank({ msgSender: unknownCaller }); @@ -53,22 +48,23 @@ abstract contract WithdrawHooks_Integration_Concrete_Test is Integration_Test { callee: address(recipientGood), data: abi.encodeCall( ISablierLockupRecipient.onSablierLockupWithdraw, - (streamId, unknownCaller, address(recipientGood), withdrawAmount) + (differentSenderRecipientStreamId, unknownCaller, address(recipientGood), withdrawAmount) ), count: 1 }); // Make the withdrawal. - lockup.withdraw({ streamId: streamId, to: address(recipientGood), amount: withdrawAmount }); + lockup.withdraw({ + streamId: differentSenderRecipientStreamId, + to: address(recipientGood), + amount: withdrawAmount + }); } function test_WhenCallerApprovedThirdParty() external givenRecipientNotSameAsSender { - // Create the test stream. - uint256 streamId = createDefaultStreamWithUsers({ recipient: address(recipientGood), sender: users.sender }); - // Approve the operator to handle the stream. resetPrank({ msgSender: address(recipientGood) }); - lockup.approve({ to: users.operator, tokenId: streamId }); + lockup.approve({ to: users.operator, tokenId: differentSenderRecipientStreamId }); // Make the operator the caller in this test. resetPrank({ msgSender: users.operator }); @@ -81,19 +77,20 @@ abstract contract WithdrawHooks_Integration_Concrete_Test is Integration_Test { callee: address(recipientGood), data: abi.encodeCall( ISablierLockupRecipient.onSablierLockupWithdraw, - (streamId, users.operator, address(recipientGood), withdrawAmount) + (differentSenderRecipientStreamId, users.operator, address(recipientGood), withdrawAmount) ), count: 1 }); // Make the withdrawal. - lockup.withdraw({ streamId: streamId, to: address(recipientGood), amount: withdrawAmount }); + lockup.withdraw({ + streamId: differentSenderRecipientStreamId, + to: address(recipientGood), + amount: withdrawAmount + }); } function test_WhenCallerSender() external givenRecipientNotSameAsSender { - // Create the test stream. - uint256 streamId = createDefaultStreamWithUsers({ recipient: address(recipientGood), sender: users.sender }); - // Make the Sender the caller in this test. resetPrank({ msgSender: users.sender }); @@ -105,19 +102,20 @@ abstract contract WithdrawHooks_Integration_Concrete_Test is Integration_Test { callee: address(recipientGood), data: abi.encodeCall( ISablierLockupRecipient.onSablierLockupWithdraw, - (streamId, users.sender, address(recipientGood), withdrawAmount) + (differentSenderRecipientStreamId, users.sender, address(recipientGood), withdrawAmount) ), count: 1 }); // Make the withdrawal. - lockup.withdraw({ streamId: streamId, to: address(recipientGood), amount: withdrawAmount }); + lockup.withdraw({ + streamId: differentSenderRecipientStreamId, + to: address(recipientGood), + amount: withdrawAmount + }); } function test_WhenCallerRecipient() external givenRecipientNotSameAsSender { - // Create the test stream. - uint256 streamId = createDefaultStreamWithUsers({ recipient: address(recipientGood), sender: users.sender }); - // Make the recipient contract the caller in this test. resetPrank({ msgSender: address(recipientGood) }); @@ -129,12 +127,16 @@ abstract contract WithdrawHooks_Integration_Concrete_Test is Integration_Test { callee: address(recipientGood), data: abi.encodeCall( ISablierLockupRecipient.onSablierLockupWithdraw, - (streamId, address(recipientGood), address(recipientGood), withdrawAmount) + (differentSenderRecipientStreamId, address(recipientGood), address(recipientGood), withdrawAmount) ), count: 0 }); // Make the withdrawal. - lockup.withdraw({ streamId: streamId, to: address(recipientGood), amount: withdrawAmount }); + lockup.withdraw({ + streamId: differentSenderRecipientStreamId, + to: address(recipientGood), + amount: withdrawAmount + }); } } diff --git a/test/core/integration/concrete/lockup/withdraw-hooks/withdrawHooks.tree b/test/core/integration/concrete/lockup-base/withdraw-hooks/withdrawHooks.tree similarity index 100% rename from test/core/integration/concrete/lockup/withdraw-hooks/withdrawHooks.tree rename to test/core/integration/concrete/lockup-base/withdraw-hooks/withdrawHooks.tree diff --git a/test/core/integration/concrete/lockup/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol b/test/core/integration/concrete/lockup-base/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol similarity index 91% rename from test/core/integration/concrete/lockup/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol rename to test/core/integration/concrete/lockup-base/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol index 5b95075e3..dbdfe0f38 100644 --- a/test/core/integration/concrete/lockup/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol +++ b/test/core/integration/concrete/lockup-base/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol @@ -5,25 +5,28 @@ import { IERC721Errors } from "@openzeppelin/contracts/interfaces/draft-IERC6093 import { IERC4906 } from "@openzeppelin/contracts/interfaces/IERC4906.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; -import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; +import { ISablierLockupBase } from "src/core/interfaces/ISablierLockupBase.sol"; import { Errors } from "src/core/libraries/Errors.sol"; import { Integration_Test } from "./../../../Integration.t.sol"; abstract contract WithdrawMaxAndTransfer_Integration_Concrete_Test is Integration_Test { function test_RevertWhen_DelegateCall() external { - bytes memory callData = abi.encodeCall(ISablierLockup.withdrawMaxAndTransfer, (defaultStreamId, users.alice)); + bytes memory callData = + abi.encodeCall(ISablierLockupBase.withdrawMaxAndTransfer, (defaultStreamId, users.alice)); (bool success, bytes memory returnData) = address(lockup).delegatecall(callData); expectRevertDueToDelegateCall(success, returnData); } function test_RevertGiven_Null() external whenNoDelegateCall { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.withdrawMaxAndTransfer({ streamId: nullStreamId, newRecipient: users.recipient }); } function test_RevertGiven_NonTransferableStream() external whenCallerRecipient whenNoDelegateCall givenNotNull { - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_NotTransferable.selector, notTransferableStreamId)); + vm.expectRevert( + abi.encodeWithSelector(Errors.SablierLockupBase_NotTransferable.selector, notTransferableStreamId) + ); lockup.withdrawMaxAndTransfer({ streamId: notTransferableStreamId, newRecipient: users.recipient }); } @@ -79,7 +82,9 @@ abstract contract WithdrawMaxAndTransfer_Integration_Concrete_Test is Integratio resetPrank({ msgSender: users.eve }); // It should revert. - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Unauthorized.selector, defaultStreamId, users.eve)); + vm.expectRevert( + abi.encodeWithSelector(Errors.SablierLockupBase_Unauthorized.selector, defaultStreamId, users.eve) + ); lockup.withdrawMaxAndTransfer({ streamId: defaultStreamId, newRecipient: users.eve }); } @@ -105,7 +110,7 @@ abstract contract WithdrawMaxAndTransfer_Integration_Concrete_Test is Integratio // It should emit {Transfer} and {WithdrawFromLockupStream} events. vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.WithdrawFromLockupStream({ + emit ISablierLockupBase.WithdrawFromLockupStream({ streamId: defaultStreamId, to: users.recipient, amount: expectedWithdrawnAmount, @@ -148,7 +153,7 @@ abstract contract WithdrawMaxAndTransfer_Integration_Concrete_Test is Integratio // It should emit {Transfer}, {WithdrawFromLockupStream} and {MetadataUpdate} events. vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.WithdrawFromLockupStream({ + emit ISablierLockupBase.WithdrawFromLockupStream({ streamId: defaultStreamId, to: users.recipient, amount: expectedWithdrawnAmount, diff --git a/test/core/integration/concrete/lockup/withdraw-max-and-transfer/withdrawMaxAndTransfer.tree b/test/core/integration/concrete/lockup-base/withdraw-max-and-transfer/withdrawMaxAndTransfer.tree similarity index 100% rename from test/core/integration/concrete/lockup/withdraw-max-and-transfer/withdrawMaxAndTransfer.tree rename to test/core/integration/concrete/lockup-base/withdraw-max-and-transfer/withdrawMaxAndTransfer.tree diff --git a/test/core/integration/concrete/lockup/withdraw-max/withdrawMax.t.sol b/test/core/integration/concrete/lockup-base/withdraw-max/withdrawMax.t.sol similarity index 94% rename from test/core/integration/concrete/lockup/withdraw-max/withdrawMax.t.sol rename to test/core/integration/concrete/lockup-base/withdraw-max/withdrawMax.t.sol index f3303ce16..1d010c91f 100644 --- a/test/core/integration/concrete/lockup/withdraw-max/withdrawMax.t.sol +++ b/test/core/integration/concrete/lockup-base/withdraw-max/withdrawMax.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.22 <0.9.0; -import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; +import { ISablierLockupBase } from "src/core/interfaces/ISablierLockupBase.sol"; import { Lockup } from "src/core/types/DataTypes.sol"; import { Integration_Test } from "../../../Integration.t.sol"; @@ -16,7 +16,7 @@ abstract contract WithdrawMax_Integration_Concrete_Test is Integration_Test { // It should emit a {WithdrawFromLockupStream} event. vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.WithdrawFromLockupStream({ + emit ISablierLockupBase.WithdrawFromLockupStream({ streamId: defaultStreamId, to: users.recipient, amount: defaults.DEPOSIT_AMOUNT(), @@ -62,7 +62,7 @@ abstract contract WithdrawMax_Integration_Concrete_Test is Integration_Test { // It should emit a {WithdrawFromLockupStream} event. vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.WithdrawFromLockupStream({ + emit ISablierLockupBase.WithdrawFromLockupStream({ streamId: defaultStreamId, to: users.recipient, amount: expectedWithdrawnAmount, diff --git a/test/core/integration/concrete/lockup/withdraw-max/withdrawMax.tree b/test/core/integration/concrete/lockup-base/withdraw-max/withdrawMax.tree similarity index 100% rename from test/core/integration/concrete/lockup/withdraw-max/withdrawMax.tree rename to test/core/integration/concrete/lockup-base/withdraw-max/withdrawMax.tree diff --git a/test/core/integration/concrete/lockup/withdraw-multiple/withdrawMultiple.t.sol b/test/core/integration/concrete/lockup-base/withdraw-multiple/withdrawMultiple.t.sol similarity index 60% rename from test/core/integration/concrete/lockup/withdraw-multiple/withdrawMultiple.t.sol rename to test/core/integration/concrete/lockup-base/withdraw-multiple/withdrawMultiple.t.sol index 5f3b3e004..f937f9071 100644 --- a/test/core/integration/concrete/lockup/withdraw-multiple/withdrawMultiple.t.sol +++ b/test/core/integration/concrete/lockup-base/withdraw-multiple/withdrawMultiple.t.sol @@ -2,19 +2,21 @@ pragma solidity >=0.8.22 <0.9.0; import { Solarray } from "solarray/src/Solarray.sol"; -import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; +import { ISablierLockupBase } from "src/core/interfaces/ISablierLockupBase.sol"; import { Errors } from "src/core/libraries/Errors.sol"; import { Lockup } from "src/core/types/DataTypes.sol"; -import { WithdrawMultiple_Integration_Shared_Test } from "./../../../shared/lockup/withdrawMultiple.t.sol"; +import { Integration_Test } from "../../../Integration.t.sol"; -abstract contract WithdrawMultiple_Integration_Concrete_Test is WithdrawMultiple_Integration_Shared_Test { - function setUp() public virtual override { - WithdrawMultiple_Integration_Shared_Test.setUp(); - } +abstract contract WithdrawMultiple_Integration_Concrete_Test is Integration_Test { + address internal caller; + uint40 internal originalTime; + uint128[] internal testAmounts; + uint256[] internal withdrawMultipleStreamIds; function test_RevertWhen_DelegateCall() external { - bytes memory callData = abi.encodeCall(ISablierLockup.withdrawMultiple, (testStreamIds, testAmounts)); + bytes memory callData = + abi.encodeCall(ISablierLockupBase.withdrawMultiple, (withdrawMultipleStreamIds, testAmounts)); (bool success, bytes memory returnData) = address(lockup).delegatecall(callData); expectRevertDueToDelegateCall(success, returnData); } @@ -24,7 +26,7 @@ abstract contract WithdrawMultiple_Integration_Concrete_Test is WithdrawMultiple uint128[] memory amounts = new uint128[](1); vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockup_WithdrawArrayCountsNotEqual.selector, streamIds.length, amounts.length + Errors.SablierLockupBase_WithdrawArrayCountsNotEqual.selector, streamIds.length, amounts.length ) ); lockup.withdrawMultiple(streamIds, amounts); @@ -45,13 +47,14 @@ abstract contract WithdrawMultiple_Integration_Concrete_Test is WithdrawMultiple whenNonZeroArrayLength { uint256 nullStreamId = 1729; - uint256[] memory streamIds = Solarray.uint256s(testStreamIds[0], testStreamIds[1], nullStreamId); + uint256[] memory streamIds = + Solarray.uint256s(withdrawMultipleStreamIds[0], withdrawMultipleStreamIds[1], nullStreamId); // Simulate the passage of time. vm.warp({ newTimestamp: defaults.WARP_26_PERCENT() }); // It should revert. - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); // Withdraw from multiple streams. lockup.withdrawMultiple({ streamIds: streamIds, amounts: testAmounts }); @@ -68,13 +71,15 @@ abstract contract WithdrawMultiple_Integration_Concrete_Test is WithdrawMultiple vm.warp({ newTimestamp: defaults.END_TIME() }); // Deplete the first test stream. - lockup.withdrawMax({ streamId: testStreamIds[0], to: users.recipient }); + lockup.withdrawMax({ streamId: withdrawMultipleStreamIds[0], to: users.recipient }); // It should revert. - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_StreamDepleted.selector, testStreamIds[0])); + vm.expectRevert( + abi.encodeWithSelector(Errors.SablierLockupBase_StreamDepleted.selector, withdrawMultipleStreamIds[0]) + ); // Withdraw from multiple streams. - lockup.withdrawMultiple({ streamIds: testStreamIds, amounts: testAmounts }); + lockup.withdrawMultiple({ streamIds: withdrawMultipleStreamIds, amounts: testAmounts }); } function test_RevertWhen_AtleastOneZeroAmount() @@ -92,8 +97,10 @@ abstract contract WithdrawMultiple_Integration_Concrete_Test is WithdrawMultiple uint128[] memory amounts = Solarray.uint128s(defaults.WITHDRAW_AMOUNT(), 0, 0); // It should revert. - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_WithdrawAmountZero.selector, testStreamIds[1])); - lockup.withdrawMultiple({ streamIds: testStreamIds, amounts: amounts }); + vm.expectRevert( + abi.encodeWithSelector(Errors.SablierLockupBase_WithdrawAmountZero.selector, withdrawMultipleStreamIds[1]) + ); + lockup.withdrawMultiple({ streamIds: withdrawMultipleStreamIds, amounts: amounts }); } function test_RevertWhen_AtleastOneAmountOverdraws() @@ -109,16 +116,19 @@ abstract contract WithdrawMultiple_Integration_Concrete_Test is WithdrawMultiple vm.warp({ newTimestamp: defaults.WARP_26_PERCENT() }); // Run the test. - uint128 withdrawableAmount = lockup.withdrawableAmountOf(testStreamIds[2]); + uint128 withdrawableAmount = lockup.withdrawableAmountOf(withdrawMultipleStreamIds[2]); uint128[] memory amounts = Solarray.uint128s(testAmounts[0], testAmounts[1], MAX_UINT128); // It should revert. vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockup_Overdraw.selector, testStreamIds[2], MAX_UINT128, withdrawableAmount + Errors.SablierLockupBase_Overdraw.selector, + withdrawMultipleStreamIds[2], + MAX_UINT128, + withdrawableAmount ) ); - lockup.withdrawMultiple({ streamIds: testStreamIds, amounts: amounts }); + lockup.withdrawMultiple({ streamIds: withdrawMultipleStreamIds, amounts: amounts }); } function test_WhenNoAmountsOverdraw() @@ -131,11 +141,11 @@ abstract contract WithdrawMultiple_Integration_Concrete_Test is WithdrawMultiple whenNoZeroAmounts { // Simulate the passage of time. - vm.warp({ newTimestamp: earlyStopTime }); + vm.warp({ newTimestamp: defaults.WARP_26_PERCENT() }); // Cancel the 3rd stream. resetPrank({ msgSender: users.sender }); - lockup.cancel(testStreamIds[2]); + lockup.cancel(withdrawMultipleStreamIds[2]); // Run the test with the caller provided in {whenCallerAuthorizedAllStreams}. resetPrank({ msgSender: caller }); @@ -147,43 +157,43 @@ abstract contract WithdrawMultiple_Integration_Concrete_Test is WithdrawMultiple // It should emit multiple {WithdrawFromLockupStream} events. vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.WithdrawFromLockupStream({ - streamId: testStreamIds[0], + emit ISablierLockupBase.WithdrawFromLockupStream({ + streamId: withdrawMultipleStreamIds[0], to: users.recipient, asset: dai, amount: testAmounts[0] }); vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.WithdrawFromLockupStream({ - streamId: testStreamIds[1], + emit ISablierLockupBase.WithdrawFromLockupStream({ + streamId: withdrawMultipleStreamIds[1], to: users.recipient, asset: dai, amount: testAmounts[1] }); vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.WithdrawFromLockupStream({ - streamId: testStreamIds[2], + emit ISablierLockupBase.WithdrawFromLockupStream({ + streamId: withdrawMultipleStreamIds[2], to: users.recipient, asset: dai, amount: testAmounts[2] }); // Make the withdrawals. - lockup.withdrawMultiple({ streamIds: testStreamIds, amounts: testAmounts }); + lockup.withdrawMultiple({ streamIds: withdrawMultipleStreamIds, amounts: testAmounts }); // It should update the statuses. - assertEq(lockup.statusOf(testStreamIds[0]), Lockup.Status.STREAMING, "status0"); - assertEq(lockup.statusOf(testStreamIds[1]), Lockup.Status.DEPLETED, "status1"); - assertEq(lockup.statusOf(testStreamIds[2]), Lockup.Status.CANCELED, "status2"); + assertEq(lockup.statusOf(withdrawMultipleStreamIds[0]), Lockup.Status.STREAMING, "status0"); + assertEq(lockup.statusOf(withdrawMultipleStreamIds[1]), Lockup.Status.DEPLETED, "status1"); + assertEq(lockup.statusOf(withdrawMultipleStreamIds[2]), Lockup.Status.CANCELED, "status2"); // It should update the withdrawn amounts. - assertEq(lockup.getWithdrawnAmount(testStreamIds[0]), testAmounts[0], "withdrawnAmount0"); - assertEq(lockup.getWithdrawnAmount(testStreamIds[1]), testAmounts[1], "withdrawnAmount1"); - assertEq(lockup.getWithdrawnAmount(testStreamIds[2]), testAmounts[2], "withdrawnAmount2"); + assertEq(lockup.getWithdrawnAmount(withdrawMultipleStreamIds[0]), testAmounts[0], "withdrawnAmount0"); + assertEq(lockup.getWithdrawnAmount(withdrawMultipleStreamIds[1]), testAmounts[1], "withdrawnAmount1"); + assertEq(lockup.getWithdrawnAmount(withdrawMultipleStreamIds[2]), testAmounts[2], "withdrawnAmount2"); // Assert that the stream NFTs have not been burned. - assertEq(lockup.getRecipient(testStreamIds[0]), users.recipient, "NFT owner0"); - assertEq(lockup.getRecipient(testStreamIds[1]), users.recipient, "NFT owner1"); - assertEq(lockup.getRecipient(testStreamIds[2]), users.recipient, "NFT owner2"); + assertEq(lockup.getRecipient(withdrawMultipleStreamIds[0]), users.recipient, "NFT owner0"); + assertEq(lockup.getRecipient(withdrawMultipleStreamIds[1]), users.recipient, "NFT owner1"); + assertEq(lockup.getRecipient(withdrawMultipleStreamIds[2]), users.recipient, "NFT owner2"); } } diff --git a/test/core/integration/concrete/lockup/withdraw-multiple/withdrawMultiple.tree b/test/core/integration/concrete/lockup-base/withdraw-multiple/withdrawMultiple.tree similarity index 100% rename from test/core/integration/concrete/lockup/withdraw-multiple/withdrawMultiple.tree rename to test/core/integration/concrete/lockup-base/withdraw-multiple/withdrawMultiple.tree diff --git a/test/core/integration/concrete/lockup/withdraw/withdraw.t.sol b/test/core/integration/concrete/lockup-base/withdraw/withdraw.t.sol similarity index 85% rename from test/core/integration/concrete/lockup/withdraw/withdraw.t.sol rename to test/core/integration/concrete/lockup-base/withdraw/withdraw.t.sol index b6c2740b3..248cb2845 100644 --- a/test/core/integration/concrete/lockup/withdraw/withdraw.t.sol +++ b/test/core/integration/concrete/lockup-base/withdraw/withdraw.t.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.22 <0.9.0; import { IERC4906 } from "@openzeppelin/contracts/interfaces/IERC4906.sol"; -import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; +import { ISablierLockupBase } from "src/core/interfaces/ISablierLockupBase.sol"; import { ISablierLockupRecipient } from "src/core/interfaces/ISablierLockupRecipient.sol"; import { Errors } from "src/core/libraries/Errors.sol"; import { Lockup } from "src/core/types/DataTypes.sol"; @@ -16,7 +16,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test { function test_RevertWhen_DelegateCall() external { uint128 withdrawAmount = defaults.WITHDRAW_AMOUNT(); bytes memory callData = - abi.encodeCall(ISablierLockup.withdraw, (defaultStreamId, users.recipient, withdrawAmount)); + abi.encodeCall(ISablierLockupBase.withdraw, (defaultStreamId, users.recipient, withdrawAmount)); (bool success, bytes memory returnData) = address(lockup).delegatecall(callData); expectRevertDueToDelegateCall(success, returnData); } @@ -24,7 +24,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external whenNoDelegateCall { uint256 nullStreamId = 1729; uint128 withdrawAmount = defaults.WITHDRAW_AMOUNT(); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.withdraw({ streamId: nullStreamId, to: users.recipient, amount: withdrawAmount }); } @@ -33,13 +33,15 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test { lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); uint128 withdrawAmount = defaults.WITHDRAW_AMOUNT(); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_StreamDepleted.selector, defaultStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_StreamDepleted.selector, defaultStreamId)); lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: withdrawAmount }); } function test_RevertWhen_WithdrawalAddressZero() external whenNoDelegateCall givenNotNull givenNotDEPLETEDStatus { uint128 withdrawAmount = defaults.WITHDRAW_AMOUNT(); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_WithdrawToZeroAddress.selector, defaultStreamId)); + vm.expectRevert( + abi.encodeWithSelector(Errors.SablierLockupBase_WithdrawToZeroAddress.selector, defaultStreamId) + ); lockup.withdraw({ streamId: defaultStreamId, to: address(0), amount: withdrawAmount }); } @@ -50,7 +52,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test { givenNotDEPLETEDStatus whenWithdrawalAddressNotZero { - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_WithdrawAmountZero.selector, defaultStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_WithdrawAmountZero.selector, defaultStreamId)); lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: 0 }); } @@ -65,7 +67,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test { uint128 withdrawableAmount = 0; vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockup_Overdraw.selector, defaultStreamId, MAX_UINT128, withdrawableAmount + Errors.SablierLockupBase_Overdraw.selector, defaultStreamId, MAX_UINT128, withdrawableAmount ) ); lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: MAX_UINT128 }); @@ -120,7 +122,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test { // It should revert. vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockup_WithdrawalAddressNotRecipient.selector, defaultStreamId, caller, users.alice + Errors.SablierLockupBase_WithdrawalAddressNotRecipient.selector, defaultStreamId, caller, users.alice ) ); lockup.withdraw({ streamId: defaultStreamId, to: users.alice, amount: withdrawAmount }); @@ -146,7 +148,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test { // It should emit {WithdrawFromLockupStream} and {MetadataUpdate} events. vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.WithdrawFromLockupStream({ + emit ISablierLockupBase.WithdrawFromLockupStream({ streamId: defaultStreamId, to: users.alice, asset: dai, @@ -265,7 +267,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test { // It should emit {WithdrawFromLockupStream} and {MetadataUpdate} events. vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.WithdrawFromLockupStream({ + emit ISablierLockupBase.WithdrawFromLockupStream({ streamId: defaultStreamId, to: users.recipient, asset: dai, @@ -306,25 +308,22 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test { givenEndTimeInFuture givenNotCanceledStream { - // Create the stream with a recipient contract that implements {ISablierLockupRecipient}. - uint256 streamId = createDefaultStreamWithRecipient(address(recipientGood)); - // It should not make Sablier run the recipient hook. - uint128 withdrawAmount = lockup.withdrawableAmountOf(streamId); + uint128 withdrawAmount = lockup.withdrawableAmountOf(recipientContractStreamId); vm.expectCall({ callee: address(recipientGood), data: abi.encodeCall( ISablierLockupRecipient.onSablierLockupWithdraw, - (streamId, users.sender, address(recipientGood), withdrawAmount) + (recipientContractStreamId, users.sender, address(recipientGood), withdrawAmount) ), count: 0 }); // Make the withdrawal. - lockup.withdraw({ streamId: streamId, to: address(recipientGood), amount: withdrawAmount }); + lockup.withdraw({ streamId: recipientContractStreamId, to: address(recipientGood), amount: withdrawAmount }); // It should update the withdrawn amount. - uint128 actualWithdrawnAmount = lockup.getWithdrawnAmount(streamId); + uint128 actualWithdrawnAmount = lockup.getWithdrawnAmount(recipientContractStreamId); uint128 expectedWithdrawnAmount = withdrawAmount; assertEq(actualWithdrawnAmount, expectedWithdrawnAmount, "withdrawnAmount"); } @@ -348,15 +347,12 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test { lockup.allowToHook(address(recipientReverting)); resetPrank({ msgSender: users.sender }); - // Create the stream with a reverting contract as the stream's recipient. - uint256 streamId = createDefaultStreamWithRecipient(address(recipientReverting)); - // Expect a revert. uint128 withdrawAmount = defaults.WITHDRAW_AMOUNT(); vm.expectRevert("You shall not pass"); // Make the withdrawal. - lockup.withdraw({ streamId: streamId, to: address(recipientReverting), amount: withdrawAmount }); + lockup.withdraw({ streamId: recipientRevertStreamId, to: address(recipientReverting), amount: withdrawAmount }); } function test_RevertWhen_HookReturnsInvalidSelector() @@ -379,17 +375,20 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test { lockup.allowToHook(address(recipientInvalidSelector)); resetPrank({ msgSender: users.sender }); - // Create the stream with a recipient contract that returns invalid selector bytes on the hook call. - uint256 streamId = createDefaultStreamWithRecipient(address(recipientInvalidSelector)); - // Expect a revert. uint128 withdrawAmount = defaults.WITHDRAW_AMOUNT(); vm.expectRevert( - abi.encodeWithSelector(Errors.SablierLockup_InvalidHookSelector.selector, address(recipientInvalidSelector)) + abi.encodeWithSelector( + Errors.SablierLockupBase_InvalidHookSelector.selector, address(recipientInvalidSelector) + ) ); // Cancel the stream. - lockup.withdraw({ streamId: streamId, to: address(recipientInvalidSelector), amount: withdrawAmount }); + lockup.withdraw({ + streamId: recipientInvalidSelectorStreamId, + to: address(recipientInvalidSelector), + amount: withdrawAmount + }); } function test_WhenReentrancy() @@ -413,9 +412,6 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test { lockup.allowToHook(address(recipientReentrant)); resetPrank({ msgSender: users.sender }); - // Create the stream with a reentrant contract as the stream's recipient. - uint256 streamId = createDefaultStreamWithRecipient(address(recipientReentrant)); - // Halve the withdraw amount so that the recipient can re-entry and make another withdrawal. uint128 withdrawAmount = defaults.WITHDRAW_AMOUNT() / 2; @@ -424,20 +420,20 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test { address(recipientReentrant), abi.encodeCall( ISablierLockupRecipient.onSablierLockupWithdraw, - (streamId, users.sender, address(recipientReentrant), withdrawAmount) + (recipientReentrantStreamId, users.sender, address(recipientReentrant), withdrawAmount) ) ); // It should make multiple withdrawals. - lockup.withdraw({ streamId: streamId, to: address(recipientReentrant), amount: withdrawAmount }); + lockup.withdraw({ streamId: recipientReentrantStreamId, to: address(recipientReentrant), amount: withdrawAmount }); // Assert that the stream's status is still "STREAMING". - Lockup.Status actualStatus = lockup.statusOf(streamId); + Lockup.Status actualStatus = lockup.statusOf(recipientReentrantStreamId); Lockup.Status expectedStatus = Lockup.Status.STREAMING; assertEq(actualStatus, expectedStatus); // It should update the withdrawn amounts. - uint128 actualWithdrawnAmount = lockup.getWithdrawnAmount(streamId); + uint128 actualWithdrawnAmount = lockup.getWithdrawnAmount(recipientReentrantStreamId); uint128 expectedWithdrawnAmount = defaults.WITHDRAW_AMOUNT(); assertEq(actualWithdrawnAmount, expectedWithdrawnAmount, "withdrawnAmount"); } @@ -463,9 +459,6 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test { lockup.allowToHook(address(recipientGood)); resetPrank({ msgSender: users.sender }); - // Create the stream with a contract as the stream's recipient. - uint256 streamId = createDefaultStreamWithRecipient(address(recipientGood)); - // Set the withdraw amount to the default amount. uint128 withdrawAmount = defaults.WITHDRAW_AMOUNT(); @@ -477,31 +470,31 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test { address(recipientGood), abi.encodeCall( ISablierLockupRecipient.onSablierLockupWithdraw, - (streamId, users.sender, address(recipientGood), withdrawAmount) + (recipientContractStreamId, users.sender, address(recipientGood), withdrawAmount) ) ); // It should emit {WithdrawFromLockupStream} and {MetadataUpdate} events. vm.expectEmit({ emitter: address(lockup) }); - emit ISablierLockup.WithdrawFromLockupStream({ - streamId: streamId, + emit ISablierLockupBase.WithdrawFromLockupStream({ + streamId: recipientContractStreamId, to: address(recipientGood), asset: dai, amount: withdrawAmount }); vm.expectEmit({ emitter: address(lockup) }); - emit IERC4906.MetadataUpdate({ _tokenId: streamId }); + emit IERC4906.MetadataUpdate({ _tokenId: recipientContractStreamId }); // Make the withdrawal. - lockup.withdraw({ streamId: streamId, to: address(recipientGood), amount: withdrawAmount }); + lockup.withdraw({ streamId: recipientContractStreamId, to: address(recipientGood), amount: withdrawAmount }); // Assert that the stream's status is still "STREAMING". - Lockup.Status actualStatus = lockup.statusOf(streamId); + Lockup.Status actualStatus = lockup.statusOf(recipientContractStreamId); Lockup.Status expectedStatus = Lockup.Status.STREAMING; assertEq(actualStatus, expectedStatus); // It should update the withdrawn amount. - uint128 actualWithdrawnAmount = lockup.getWithdrawnAmount(streamId); + uint128 actualWithdrawnAmount = lockup.getWithdrawnAmount(recipientContractStreamId); uint128 expectedWithdrawnAmount = withdrawAmount; assertEq(actualWithdrawnAmount, expectedWithdrawnAmount, "withdrawnAmount"); } diff --git a/test/core/integration/concrete/lockup/withdraw/withdraw.tree b/test/core/integration/concrete/lockup-base/withdraw/withdraw.tree similarity index 100% rename from test/core/integration/concrete/lockup/withdraw/withdraw.tree rename to test/core/integration/concrete/lockup-base/withdraw/withdraw.tree diff --git a/test/core/integration/concrete/lockup/withdrawable-amount-of/withdrawableAmountOf.t.sol b/test/core/integration/concrete/lockup-base/withdrawable-amount-of/withdrawableAmountOf.t.sol similarity index 98% rename from test/core/integration/concrete/lockup/withdrawable-amount-of/withdrawableAmountOf.t.sol rename to test/core/integration/concrete/lockup-base/withdrawable-amount-of/withdrawableAmountOf.t.sol index 2a351c3cd..557fb633c 100644 --- a/test/core/integration/concrete/lockup/withdrawable-amount-of/withdrawableAmountOf.t.sol +++ b/test/core/integration/concrete/lockup-base/withdrawable-amount-of/withdrawableAmountOf.t.sol @@ -8,7 +8,7 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract WithdrawableAmountOf_Integration_Concrete_Test is Integration_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); lockup.withdrawableAmountOf(nullStreamId); } diff --git a/test/core/integration/concrete/lockup/withdrawable-amount-of/withdrawableAmountOf.tree b/test/core/integration/concrete/lockup-base/withdrawable-amount-of/withdrawableAmountOf.tree similarity index 100% rename from test/core/integration/concrete/lockup/withdrawable-amount-of/withdrawableAmountOf.tree rename to test/core/integration/concrete/lockup-base/withdrawable-amount-of/withdrawableAmountOf.tree diff --git a/test/core/integration/concrete/lockup-dynamic/LockupDynamic.t.sol b/test/core/integration/concrete/lockup-dynamic/LockupDynamic.t.sol index e81619a3f..d03f76b30 100644 --- a/test/core/integration/concrete/lockup-dynamic/LockupDynamic.t.sol +++ b/test/core/integration/concrete/lockup-dynamic/LockupDynamic.t.sol @@ -2,339 +2,388 @@ pragma solidity >=0.8.22 <0.9.0; import { Integration_Test } from "./../../Integration.t.sol"; -import { LockupDynamic_Integration_Shared_Test } from "./../../shared/lockup-dynamic/LockupDynamic.t.sol"; -import { AllowToHook_Integration_Concrete_Test } from "./../lockup/allow-to-hook/allowToHook.t.sol"; -import { Batch_Integration_Concrete_Test } from "./../lockup/batch/batch.t.sol"; -import { Burn_Integration_Concrete_Test } from "./../lockup/burn/burn.t.sol"; -import { CancelMultiple_Integration_Concrete_Test } from "./../lockup/cancel-multiple/cancelMultiple.t.sol"; -import { Cancel_Integration_Concrete_Test } from "./../lockup/cancel/cancel.t.sol"; -import { GetAsset_Integration_Concrete_Test } from "./../lockup/get-asset/getAsset.t.sol"; -import { GetDepositedAmount_Integration_Concrete_Test } from "./../lockup/get-deposited-amount/getDepositedAmount.t.sol"; -import { GetEndTime_Integration_Concrete_Test } from "./../lockup/get-end-time/getEndTime.t.sol"; -import { GetRecipient_Integration_Concrete_Test } from "./../lockup/get-recipient/getRecipient.t.sol"; -import { GetRefundedAmount_Integration_Concrete_Test } from "./../lockup/get-refunded-amount/getRefundedAmount.t.sol"; -import { GetSender_Integration_Concrete_Test } from "./../lockup/get-sender/getSender.t.sol"; -import { GetStartTime_Integration_Concrete_Test } from "./../lockup/get-start-time/getStartTime.t.sol"; -import { GetWithdrawnAmount_Integration_Concrete_Test } from "./../lockup/get-withdrawn-amount/getWithdrawnAmount.t.sol"; -import { IsAllowedToHook_Integration_Concrete_Test } from "./../lockup/is-allowed-to-hook/isAllowedToHook.t.sol"; -import { IsCancelable_Integration_Concrete_Test } from "./../lockup/is-cancelable/isCancelable.t.sol"; -import { IsCold_Integration_Concrete_Test } from "./../lockup/is-cold/isCold.t.sol"; -import { IsDepleted_Integration_Concrete_Test } from "./../lockup/is-depleted/isDepleted.t.sol"; -import { IsStream_Integration_Concrete_Test } from "./../lockup/is-stream/isStream.t.sol"; -import { IsTransferable_Integration_Concrete_Test } from "./../lockup/is-transferable/isTransferable.t.sol"; -import { IsWarm_Integration_Concrete_Test } from "./../lockup/is-warm/isWarm.t.sol"; -import { RefundableAmountOf_Integration_Concrete_Test } from "./../lockup/refundable-amount-of/refundableAmountOf.t.sol"; -import { Renounce_Integration_Concrete_Test } from "./../lockup/renounce/renounce.t.sol"; -import { SetNFTDescriptor_Integration_Concrete_Test } from "./../lockup/set-nft-descriptor/setNFTDescriptor.t.sol"; -import { StatusOf_Integration_Concrete_Test } from "./../lockup/status-of/statusOf.t.sol"; -import { TransferFrom_Integration_Concrete_Test } from "./../lockup/transfer-from/transferFrom.t.sol"; -import { WasCanceled_Integration_Concrete_Test } from "./../lockup/was-canceled/wasCanceled.t.sol"; -import { WithdrawHooks_Integration_Concrete_Test } from "./../lockup/withdraw-hooks/withdrawHooks.t.sol"; +import { Lockup_Create_Integration_Shared_Test } from "./../../shared/lockup/Lockup.t.sol"; +import { AllowToHook_Integration_Concrete_Test } from "./../lockup-base/allow-to-hook/allowToHook.t.sol"; +import { Batch_Integration_Concrete_Test } from "./../lockup-base/batch/batch.t.sol"; +import { Burn_Integration_Concrete_Test } from "./../lockup-base/burn/burn.t.sol"; +import { CancelMultiple_Integration_Concrete_Test } from "./../lockup-base/cancel-multiple/cancelMultiple.t.sol"; +import { Cancel_Integration_Concrete_Test } from "./../lockup-base/cancel/cancel.t.sol"; +import { GetAsset_Integration_Concrete_Test } from "./../lockup-base/get-asset/getAsset.t.sol"; +import { GetDepositedAmount_Integration_Concrete_Test } from + "./../lockup-base/get-deposited-amount/getDepositedAmount.t.sol"; +import { GetEndTime_Integration_Concrete_Test } from "./../lockup-base/get-end-time/getEndTime.t.sol"; +import { GetRecipient_Integration_Concrete_Test } from "./../lockup-base/get-recipient/getRecipient.t.sol"; +import { GetRefundedAmount_Integration_Concrete_Test } from + "./../lockup-base/get-refunded-amount/getRefundedAmount.t.sol"; +import { GetSender_Integration_Concrete_Test } from "./../lockup-base/get-sender/getSender.t.sol"; +import { GetStartTime_Integration_Concrete_Test } from "./../lockup-base/get-start-time/getStartTime.t.sol"; +import { GetWithdrawnAmount_Integration_Concrete_Test } from + "./../lockup-base/get-withdrawn-amount/getWithdrawnAmount.t.sol"; +import { IsAllowedToHook_Integration_Concrete_Test } from "./../lockup-base/is-allowed-to-hook/isAllowedToHook.t.sol"; +import { IsCancelable_Integration_Concrete_Test } from "./../lockup-base/is-cancelable/isCancelable.t.sol"; +import { IsCold_Integration_Concrete_Test } from "./../lockup-base/is-cold/isCold.t.sol"; +import { IsDepleted_Integration_Concrete_Test } from "./../lockup-base/is-depleted/isDepleted.t.sol"; +import { IsStream_Integration_Concrete_Test } from "./../lockup-base/is-stream/isStream.t.sol"; +import { IsTransferable_Integration_Concrete_Test } from "./../lockup-base/is-transferable/isTransferable.t.sol"; +import { IsWarm_Integration_Concrete_Test } from "./../lockup-base/is-warm/isWarm.t.sol"; +import { RefundableAmountOf_Integration_Concrete_Test } from + "./../lockup-base/refundable-amount-of/refundableAmountOf.t.sol"; +import { Renounce_Integration_Concrete_Test } from "./../lockup-base/renounce/renounce.t.sol"; +import { SetNFTDescriptor_Integration_Concrete_Test } from "./../lockup-base/set-nft-descriptor/setNFTDescriptor.t.sol"; +import { StatusOf_Integration_Concrete_Test } from "./../lockup-base/status-of/statusOf.t.sol"; +import { TransferFrom_Integration_Concrete_Test } from "./../lockup-base/transfer-from/transferFrom.t.sol"; +import { WasCanceled_Integration_Concrete_Test } from "./../lockup-base/was-canceled/wasCanceled.t.sol"; +import { WithdrawHooks_Integration_Concrete_Test } from "./../lockup-base/withdraw-hooks/withdrawHooks.t.sol"; import { WithdrawMaxAndTransfer_Integration_Concrete_Test } from - "./../lockup/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol"; -import { WithdrawMax_Integration_Concrete_Test } from "./../lockup/withdraw-max/withdrawMax.t.sol"; -import { WithdrawMultiple_Integration_Concrete_Test } from "./../lockup/withdraw-multiple/withdrawMultiple.t.sol"; -import { Withdraw_Integration_Concrete_Test } from "./../lockup/withdraw/withdraw.t.sol"; + "./../lockup-base/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol"; +import { WithdrawMax_Integration_Concrete_Test } from "./../lockup-base/withdraw-max/withdrawMax.t.sol"; +import { WithdrawMultiple_Integration_Concrete_Test } from "./../lockup-base/withdraw-multiple/withdrawMultiple.t.sol"; +import { Withdraw_Integration_Concrete_Test } from "./../lockup-base/withdraw/withdraw.t.sol"; + +abstract contract Lockup_Dynamic_Integration_Shared_Test is Lockup_Create_Integration_Shared_Test { + function setUp() public virtual override { + Lockup_Create_Integration_Shared_Test.setUp(); + + // Initialize streams IDs. + defaultStreamId = createDefaultStreamLD(); + differentSenderRecipientStreamId = + createDefaultStreamWithUsersLD({ recipient: address(recipientGood), sender: users.sender }); + earlyEndtimeStreamId = createDefaultStreamWithEndTimeLD({ endTime: defaults.CLIFF_TIME() + 1 seconds }); + identicalSenderRecipientStreamId = createDefaultStreamWithIdenticalUsersLD(users.sender); + notCancelableStreamId = createDefaultStreamNotCancelableLD(); + notTransferableStreamId = createDefaultStreamNotTransferableLD(); + recipientContractStreamId = createDefaultStreamWithRecipientLD(address(recipientGood)); + recipientInvalidSelectorStreamId = createDefaultStreamWithRecipientLD(address(recipientInvalidSelector)); + recipientReentrantStreamId = createDefaultStreamWithRecipientLD(address(recipientReentrant)); + recipientRevertStreamId = createDefaultStreamWithRecipientLD(address(recipientReverting)); + } +} /*////////////////////////////////////////////////////////////////////////// SHARED TESTS //////////////////////////////////////////////////////////////////////////*/ contract AllowToHook_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, AllowToHook_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract Batch_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, Batch_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract Burn_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, Burn_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract Cancel_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, Cancel_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract CancelMultiple_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, CancelMultiple_Integration_Concrete_Test { - function setUp() - public - virtual - override(LockupDynamic_Integration_Shared_Test, CancelMultiple_Integration_Concrete_Test) - { - LockupDynamic_Integration_Shared_Test.setUp(); - CancelMultiple_Integration_Concrete_Test.setUp(); + modifier whenCallerAuthorizedForAll() override { + _; + cancelMultipleStreamIds = WarpAndCreateStreamsForCancelMultipleLD({ warpTime: originalTime }); + _; + } + + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); + + originalTime = getBlockTimestamp(); + cancelMultipleStreamIds = WarpAndCreateStreamsForCancelMultipleLD({ warpTime: originalTime }); } } contract GetAsset_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, GetAsset_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract GetDepositedAmount_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, GetDepositedAmount_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract GetEndTime_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, GetEndTime_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract GetRecipient_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, GetRecipient_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract GetRefundedAmount_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, GetRefundedAmount_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract GetSender_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, GetSender_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract GetStartTime_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, GetStartTime_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract GetWithdrawnAmount_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, GetWithdrawnAmount_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract IsAllowedToHook_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, IsAllowedToHook_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract IsCancelable_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, IsCancelable_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract IsCold_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, IsCold_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract IsDepleted_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, IsDepleted_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract IsStream_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, IsStream_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract IsTransferable_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, IsTransferable_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract IsWarm_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, IsWarm_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract RefundableAmountOf_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, RefundableAmountOf_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract Renounce_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, Renounce_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract SetNFTDescriptor_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, SetNFTDescriptor_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract StatusOf_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, StatusOf_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract TransferFrom_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, TransferFrom_Integration_Concrete_Test { function setUp() public virtual - override(LockupDynamic_Integration_Shared_Test, TransferFrom_Integration_Concrete_Test) + override(Lockup_Dynamic_Integration_Shared_Test, TransferFrom_Integration_Concrete_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + Lockup_Dynamic_Integration_Shared_Test.setUp(); TransferFrom_Integration_Concrete_Test.setUp(); } } contract WasCanceled_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, WasCanceled_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract Withdraw_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, Withdraw_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract WithdrawHooks_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, WithdrawHooks_Integration_Concrete_Test { function setUp() public virtual - override(LockupDynamic_Integration_Shared_Test, WithdrawHooks_Integration_Concrete_Test) + override(Lockup_Dynamic_Integration_Shared_Test, WithdrawHooks_Integration_Concrete_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + Lockup_Dynamic_Integration_Shared_Test.setUp(); WithdrawHooks_Integration_Concrete_Test.setUp(); } } contract WithdrawMax_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, WithdrawMax_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract WithdrawMaxAndTransfer_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, WithdrawMaxAndTransfer_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } } contract WithdrawMultiple_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, WithdrawMultiple_Integration_Concrete_Test { - function setUp() - public - virtual - override(LockupDynamic_Integration_Shared_Test, WithdrawMultiple_Integration_Concrete_Test) - { - LockupDynamic_Integration_Shared_Test.setUp(); - WithdrawMultiple_Integration_Concrete_Test.setUp(); + /// @dev This modifier runs the test in three different modes: + /// - Stream's sender as caller + /// - Stream's recipient as caller + /// - Approved NFT operator as caller + modifier whenCallerAuthorizedAllStreams() override { + caller = users.sender; + _; + + WarpAndCreateStreamsWithdrawMultipleLD({ warpTime: originalTime }); + caller = users.recipient; + _; + + WarpAndCreateStreamsWithdrawMultipleLD({ warpTime: originalTime }); + caller = users.operator; + _; + } + + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); + + originalTime = getBlockTimestamp(); + + // Define the default amounts. + testAmounts = new uint128[](3); + testAmounts[0] = defaults.WITHDRAW_AMOUNT(); + testAmounts[1] = defaults.DEPOSIT_AMOUNT(); + testAmounts[2] = defaults.WITHDRAW_AMOUNT() / 2; + + withdrawMultipleStreamIds = WarpAndCreateStreamsWithdrawMultipleLD({ warpTime: originalTime }); } } diff --git a/test/core/integration/concrete/lockup-dynamic/constructor.t.sol b/test/core/integration/concrete/lockup-dynamic/constructor.t.sol deleted file mode 100644 index 4b966706d..000000000 --- a/test/core/integration/concrete/lockup-dynamic/constructor.t.sol +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.8.22 <0.9.0; - -import { UD60x18 } from "@prb/math/src/UD60x18.sol"; - -import { IAdminable } from "src/core/interfaces/IAdminable.sol"; -import { SablierLockupDynamic } from "src/core/SablierLockupDynamic.sol"; - -import { LockupDynamic_Integration_Shared_Test } from "./LockupDynamic.t.sol"; - -contract Constructor_LockupDynamic_Integration_Concrete_Test is LockupDynamic_Integration_Shared_Test { - function test_Constructor() external { - // Expect the relevant event to be emitted. - vm.expectEmit(); - emit IAdminable.TransferAdmin({ oldAdmin: address(0), newAdmin: users.admin }); - - // Construct the contract. - SablierLockupDynamic constructedLockupDynamic = new SablierLockupDynamic({ - initialAdmin: users.admin, - initialNFTDescriptor: nftDescriptor, - maxSegmentCount: defaults.MAX_SEGMENT_COUNT() - }); - - // {SablierLockup.constant} - UD60x18 actualMaxBrokerFee = constructedLockupDynamic.MAX_BROKER_FEE(); - UD60x18 expectedMaxBrokerFee = UD60x18.wrap(0.1e18); - assertEq(actualMaxBrokerFee, expectedMaxBrokerFee, "MAX_BROKER_FEE"); - - // {SablierLockup.constructor} - address actualAdmin = constructedLockupDynamic.admin(); - address expectedAdmin = users.admin; - assertEq(actualAdmin, expectedAdmin, "admin"); - - uint256 actualStreamId = constructedLockupDynamic.nextStreamId(); - uint256 expectedStreamId = 1; - assertEq(actualStreamId, expectedStreamId, "nextStreamId"); - - address actualNFTDescriptor = address(constructedLockupDynamic.nftDescriptor()); - address expectedNFTDescriptor = address(nftDescriptor); - assertEq(actualNFTDescriptor, expectedNFTDescriptor, "nftDescriptor"); - - // {SablierLockup.supportsInterface} - assertTrue(constructedLockupDynamic.supportsInterface(0x49064906), "ERC-4906 interface ID"); - - // {SablierLockupDynamic.constructor} - uint256 actualMaxSegmentCount = constructedLockupDynamic.MAX_SEGMENT_COUNT(); - uint256 expectedMaxSegmentCount = defaults.MAX_SEGMENT_COUNT(); - assertEq(actualMaxSegmentCount, expectedMaxSegmentCount, "MAX_SEGMENT_COUNT"); - } -} diff --git a/test/core/integration/concrete/lockup-dynamic/create-with-durations/createWithDurations.t.sol b/test/core/integration/concrete/lockup-dynamic/create-with-durations/createWithDurationsLD.t.sol similarity index 67% rename from test/core/integration/concrete/lockup-dynamic/create-with-durations/createWithDurations.t.sol rename to test/core/integration/concrete/lockup-dynamic/create-with-durations/createWithDurationsLD.t.sol index 0f560373f..6191ad777 100644 --- a/test/core/integration/concrete/lockup-dynamic/create-with-durations/createWithDurations.t.sol +++ b/test/core/integration/concrete/lockup-dynamic/create-with-durations/createWithDurationsLD.t.sol @@ -4,31 +4,32 @@ pragma solidity >=0.8.22 <0.9.0; import { IERC4906 } from "@openzeppelin/contracts/interfaces/IERC4906.sol"; import { ud2x18 } from "@prb/math/src/UD2x18.sol"; -import { ISablierLockupDynamic } from "src/core/interfaces/ISablierLockupDynamic.sol"; +import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; import { Errors } from "src/core/libraries/Errors.sol"; import { Lockup, LockupDynamic } from "src/core/types/DataTypes.sol"; -import { LockupDynamic_Integration_Shared_Test } from "../LockupDynamic.t.sol"; +import { Lockup_Dynamic_Integration_Shared_Test } from "./../LockupDynamic.t.sol"; -contract CreateWithDurations_LockupDynamic_Integration_Concrete_Test is LockupDynamic_Integration_Shared_Test { +contract CreateWithDurationsLD_Integration_Concrete_Test is Lockup_Dynamic_Integration_Shared_Test { uint256 internal streamId; function setUp() public virtual override { - LockupDynamic_Integration_Shared_Test.setUp(); - streamId = lockupDynamic.nextStreamId(); + Lockup_Dynamic_Integration_Shared_Test.setUp(); + streamId = lockup.nextStreamId(); } function test_RevertWhen_DelegateCall() external { - bytes memory callData = - abi.encodeCall(ISablierLockupDynamic.createWithDurations, defaults.createWithDurationsLD()); - (bool success, bytes memory returnData) = address(lockupDynamic).delegatecall(callData); + bytes memory callData = abi.encodeCall( + ISablierLockup.createWithDurationsLD, (defaults.createWithDurations(), defaults.segmentsWithDurations()) + ); + (bool success, bytes memory returnData) = address(lockup).delegatecall(callData); expectRevertDueToDelegateCall(success, returnData); } function test_RevertWhen_SegmentCountExceedsMaxValue() external whenNoDelegateCall { LockupDynamic.SegmentWithDuration[] memory segments = new LockupDynamic.SegmentWithDuration[](25_000); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupDynamic_SegmentCountTooHigh.selector, 25_000)); - createDefaultStreamWithDurations(segments); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_SegmentCountTooHigh.selector, 25_000)); + createDefaultStreamWithDurationsLD(segments); } function test_RevertWhen_FirstIndexHasZeroDuration() @@ -37,18 +38,18 @@ contract CreateWithDurations_LockupDynamic_Integration_Concrete_Test is LockupDy whenSegmentCountNotExceedMaxValue { uint40 startTime = getBlockTimestamp(); - LockupDynamic.SegmentWithDuration[] memory segments = defaults.createWithDurationsLD().segments; + LockupDynamic.SegmentWithDuration[] memory segments = defaults.segmentsWithDurations(); segments[1].duration = 0; uint256 index = 1; vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockupDynamic_SegmentTimestampsNotOrdered.selector, + Errors.SablierLockup_SegmentTimestampsNotOrdered.selector, index, startTime + segments[0].duration, startTime + segments[0].duration ) ); - createDefaultStreamWithDurations(segments); + createDefaultStreamWithDurationsLD(segments); } function test_RevertWhen_StartTimeExceedsFirstTimestamp() @@ -64,12 +65,12 @@ contract CreateWithDurations_LockupDynamic_Integration_Concrete_Test is LockupDy segments[0].duration = MAX_UINT40; vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockupDynamic_StartTimeNotLessThanFirstSegmentTimestamp.selector, + Errors.SablierLockup_StartTimeNotLessThanFirstSegmentTimestamp.selector, startTime, startTime + segments[0].duration ) ); - createDefaultStreamWithDurations(segments); + createDefaultStreamWithDurationsLD(segments); } } @@ -98,7 +99,7 @@ contract CreateWithDurations_LockupDynamic_Integration_Concrete_Test is LockupDy uint256 index = 1; vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockupDynamic_SegmentTimestampsNotOrdered.selector, + Errors.SablierLockup_SegmentTimestampsNotOrdered.selector, index, startTime + segments[0].duration, startTime + segments[0].duration + segments[1].duration @@ -106,7 +107,7 @@ contract CreateWithDurations_LockupDynamic_Integration_Concrete_Test is LockupDy ); // Create the stream. - createDefaultStreamWithDurations(segments); + createDefaultStreamWithDurationsLD(segments); } } @@ -121,8 +122,8 @@ contract CreateWithDurations_LockupDynamic_Integration_Concrete_Test is LockupDy // Declare the timestamps. uint40 blockTimestamp = getBlockTimestamp(); - LockupDynamic.Timestamps memory timestamps = - LockupDynamic.Timestamps({ start: blockTimestamp, end: blockTimestamp + defaults.TOTAL_DURATION() }); + Lockup.Timestamps memory timestamps = + Lockup.Timestamps({ start: blockTimestamp, cliff: 0, end: blockTimestamp + defaults.TOTAL_DURATION() }); // Adjust the segments. LockupDynamic.SegmentWithDuration[] memory segmentsWithDurations = defaults.segmentsWithDurations(); @@ -131,16 +132,16 @@ contract CreateWithDurations_LockupDynamic_Integration_Concrete_Test is LockupDy segments[1].timestamp = segments[0].timestamp + segmentsWithDurations[1].duration; // It should perform the ERC-20 transfers. - expectCallToTransferFrom({ from: funder, to: address(lockupDynamic), value: defaults.DEPOSIT_AMOUNT() }); + expectCallToTransferFrom({ from: funder, to: address(lockup), value: defaults.DEPOSIT_AMOUNT() }); // Expect the broker fee to be paid to the broker. expectCallToTransferFrom({ from: funder, to: users.broker, value: defaults.BROKER_FEE_AMOUNT() }); // It should emit {CreateLockupDynamicStream} and {MetadataUpdate} events. - vm.expectEmit({ emitter: address(lockupDynamic) }); + vm.expectEmit({ emitter: address(lockup) }); emit IERC4906.MetadataUpdate({ _tokenId: streamId }); - vm.expectEmit({ emitter: address(lockupDynamic) }); - emit ISablierLockupDynamic.CreateLockupDynamicStream({ + vm.expectEmit({ emitter: address(lockup) }); + emit ISablierLockup.CreateLockupDynamicStream({ streamId: streamId, funder: funder, sender: users.sender, @@ -155,28 +156,34 @@ contract CreateWithDurations_LockupDynamic_Integration_Concrete_Test is LockupDy }); // Create the stream. - createDefaultStreamWithDurations(); - - // It should create the stream. - LockupDynamic.StreamLD memory actualStream = lockupDynamic.getStream(streamId); - LockupDynamic.StreamLD memory expectedStream = defaults.lockupDynamicStream(); - expectedStream.endTime = timestamps.end; - expectedStream.segments = segments; - expectedStream.startTime = timestamps.start; - assertEq(actualStream, expectedStream); + createDefaultStreamWithDurationsLD(); + + // Assert that the stream has been created. + assertEq(lockup.getDepositedAmount(streamId), defaults.DEPOSIT_AMOUNT(), "depositedAmount"); + assertEq(lockup.getAsset(streamId), dai, "asset"); + assertEq(lockup.getEndTime(streamId), timestamps.end, "endTime"); + assertEq(lockup.isCancelable(streamId), true, "isCancelable"); + assertEq(lockup.isDepleted(streamId), false, "isDepleted"); + assertEq(lockup.isStream(streamId), true, "isStream"); + assertEq(lockup.isTransferable(streamId), true, "isTransferable"); + assertEq(lockup.getRecipient(streamId), users.recipient, "recipient"); + assertEq(lockup.getSender(streamId), users.sender, "sender"); + assertEq(lockup.getStartTime(streamId), timestamps.start, "startTime"); + assertEq(lockup.wasCanceled(streamId), false, "wasCanceled"); + assertEq(lockup.getSegments(streamId), segments, "segments"); // Assert that the stream's status is "STREAMING". - Lockup.Status actualStatus = lockupDynamic.statusOf(streamId); + Lockup.Status actualStatus = lockup.statusOf(streamId); Lockup.Status expectedStatus = Lockup.Status.STREAMING; assertEq(actualStatus, expectedStatus); // It should bump the next stream ID. - uint256 actualNextStreamId = lockupDynamic.nextStreamId(); + uint256 actualNextStreamId = lockup.nextStreamId(); uint256 expectedNextStreamId = streamId + 1; assertEq(actualNextStreamId, expectedNextStreamId, "nextStreamId"); // It should mint the NFT. - address actualNFTOwner = lockupDynamic.ownerOf({ tokenId: streamId }); + address actualNFTOwner = lockup.ownerOf({ tokenId: streamId }); address expectedNFTOwner = users.recipient; assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } diff --git a/test/core/integration/concrete/lockup-dynamic/create-with-durations/createWithDurations.tree b/test/core/integration/concrete/lockup-dynamic/create-with-durations/createWithDurationsLD.tree similarity index 94% rename from test/core/integration/concrete/lockup-dynamic/create-with-durations/createWithDurations.tree rename to test/core/integration/concrete/lockup-dynamic/create-with-durations/createWithDurationsLD.tree index 7d5286cc9..44d129842 100644 --- a/test/core/integration/concrete/lockup-dynamic/create-with-durations/createWithDurations.tree +++ b/test/core/integration/concrete/lockup-dynamic/create-with-durations/createWithDurationsLD.tree @@ -1,4 +1,4 @@ -CreateWithDurations_LockupDynamic_Integration_Concrete_Test +CreateWithDurationsLD_Integration_Concrete_Test ├── when delegate call │ └── it should revert └── when no delegate call diff --git a/test/core/integration/concrete/lockup-dynamic/create-with-timestamps/createWithTimestamps.t.sol b/test/core/integration/concrete/lockup-dynamic/create-with-timestamps/createWithTimestampsLD.t.sol similarity index 74% rename from test/core/integration/concrete/lockup-dynamic/create-with-timestamps/createWithTimestamps.t.sol rename to test/core/integration/concrete/lockup-dynamic/create-with-timestamps/createWithTimestampsLD.t.sol index 2be5379e7..3f37f084e 100644 --- a/test/core/integration/concrete/lockup-dynamic/create-with-timestamps/createWithTimestamps.t.sol +++ b/test/core/integration/concrete/lockup-dynamic/create-with-timestamps/createWithTimestampsLD.t.sol @@ -7,35 +7,36 @@ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { Address } from "@openzeppelin/contracts/utils/Address.sol"; import { UD60x18, ud } from "@prb/math/src/UD60x18.sol"; import { stdError } from "forge-std/src/StdError.sol"; -import { ISablierLockupDynamic } from "src/core/interfaces/ISablierLockupDynamic.sol"; +import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; import { Errors } from "src/core/libraries/Errors.sol"; import { Broker, Lockup, LockupDynamic } from "src/core/types/DataTypes.sol"; -import { LockupDynamic_Integration_Shared_Test } from "./../LockupDynamic.t.sol"; +import { Lockup_Dynamic_Integration_Shared_Test } from "./../LockupDynamic.t.sol"; -contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupDynamic_Integration_Shared_Test { +contract CreateWithTimestampsLD_LockupDynamic_Integration_Concrete_Test is Lockup_Dynamic_Integration_Shared_Test { uint256 internal streamId; function setUp() public virtual override { - LockupDynamic_Integration_Shared_Test.setUp(); - streamId = lockupDynamic.nextStreamId(); + Lockup_Dynamic_Integration_Shared_Test.setUp(); + streamId = lockup.nextStreamId(); } function test_RevertWhen_DelegateCall() external { - bytes memory callData = - abi.encodeCall(ISablierLockupDynamic.createWithTimestamps, defaults.createWithTimestampsLD()); - (bool success, bytes memory returnData) = address(lockupDynamic).delegatecall(callData); + bytes memory callData = abi.encodeCall( + ISablierLockup.createWithTimestampsLD, (defaults.createWithTimestamps(), defaults.segments()) + ); + (bool success, bytes memory returnData) = address(lockup).delegatecall(callData); expectRevertDueToDelegateCall(success, returnData); } function test_RevertWhen_SenderZeroAddress() external whenNoDelegateCall { vm.expectRevert(Errors.SablierLockup_SenderZeroAddress.selector); - createDefaultStreamWithSender(address(0)); + createDefaultStreamWithSenderLD(address(0)); } function test_RevertWhen_RecipientZeroAddress() external whenNoDelegateCall whenSenderNotZeroAddress { address recipient = address(0); vm.expectRevert(abi.encodeWithSelector(IERC721Errors.ERC721InvalidReceiver.selector, recipient)); - createDefaultStreamWithRecipient(recipient); + createDefaultStreamWithRecipientLD(recipient); } function test_RevertWhen_DepositAmountZero() @@ -48,7 +49,7 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD // is hard coded to 10%. vm.expectRevert(Errors.SablierLockup_DepositAmountZero.selector); uint128 totalAmount = 0; - createDefaultStreamWithTotalAmount(totalAmount); + createDefaultStreamWithTotalAmountLD(totalAmount); } function test_RevertWhen_StartTimeZero() @@ -59,7 +60,7 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD whenDepositAmountNotZero { vm.expectRevert(Errors.SablierLockup_StartTimeZero.selector); - createDefaultStreamWithStartTime(0); + createDefaultStreamWithStartTimeLD(0); } function test_RevertWhen_SegmentCountZero() @@ -71,8 +72,8 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD whenStartTimeNotZero { LockupDynamic.Segment[] memory segments; - vm.expectRevert(Errors.SablierLockupDynamic_SegmentCountZero.selector); - createDefaultStreamWithSegments(segments); + vm.expectRevert(Errors.SablierLockup_SegmentCountZero.selector); + createDefaultStreamWithSegmentsLD(segments); } function test_RevertWhen_SegmentCountExceedsMaxValue() @@ -84,10 +85,11 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD whenStartTimeNotZero whenSegmentCountNotZero { - uint256 segmentCount = defaults.MAX_SEGMENT_COUNT() + 1; + uint256 segmentCount = defaults.MAX_COUNT() + 1; LockupDynamic.Segment[] memory segments = new LockupDynamic.Segment[](segmentCount); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupDynamic_SegmentCountTooHigh.selector, segmentCount)); - createDefaultStreamWithSegments(segments); + segments[segmentCount - 1].timestamp = defaults.END_TIME(); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_SegmentCountTooHigh.selector, segmentCount)); + createDefaultStreamWithSegmentsLD(segments); } function test_RevertWhen_SegmentAmountsSumOverflows() @@ -104,7 +106,7 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD segments[0].amount = MAX_UINT128; segments[1].amount = 1; vm.expectRevert(stdError.arithmeticError); - createDefaultStreamWithSegments(segments); + createDefaultStreamWithSegmentsLD(segments); } function test_RevertWhen_StartTimeGreaterThanFirstTimestamp() @@ -125,14 +127,14 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD // Expect the relevant error to be thrown. vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockupDynamic_StartTimeNotLessThanFirstSegmentTimestamp.selector, + Errors.SablierLockup_StartTimeNotLessThanFirstSegmentTimestamp.selector, defaults.START_TIME(), segments[0].timestamp ) ); // Create the stream. - createDefaultStreamWithSegments(segments); + createDefaultStreamWithSegmentsLD(segments); } function test_RevertWhen_StartTimeEqualsFirstTimestamp() @@ -153,14 +155,14 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD // Expect the relevant error to be thrown. vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockupDynamic_StartTimeNotLessThanFirstSegmentTimestamp.selector, + Errors.SablierLockup_StartTimeNotLessThanFirstSegmentTimestamp.selector, defaults.START_TIME(), segments[0].timestamp ) ); // Create the stream. - createDefaultStreamWithSegments(segments); + createDefaultStreamWithSegmentsLD(segments); } function test_RevertWhen_TimestampsNotStrictlyIncreasing() @@ -179,11 +181,13 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD LockupDynamic.Segment[] memory segments = defaults.segments(); (segments[0].timestamp, segments[1].timestamp) = (segments[1].timestamp, segments[0].timestamp); + Lockup.CreateWithTimestamps memory params = defaults.createWithTimestamps(); + params.endTime = segments[1].timestamp; // Expect the relevant error to be thrown. uint256 index = 1; vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockupDynamic_SegmentTimestampsNotOrdered.selector, + Errors.SablierLockup_SegmentTimestampsNotOrdered.selector, index, segments[0].timestamp, segments[1].timestamp @@ -191,7 +195,7 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD ); // Create the stream. - createDefaultStreamWithSegments(segments); + lockup.createWithTimestampsLD(params, segments); } function test_RevertWhen_DepositAmountNotEqualSegmentAmountsSum() @@ -214,20 +218,22 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD uint128 depositAmount = defaultDepositAmount + 100; // Prepare the params. - LockupDynamic.CreateWithTimestamps memory params = defaults.createWithTimestampsBrokerNullLD(); + Lockup.CreateWithTimestamps memory params = defaults.createWithTimestampsBrokerNull(); params.totalAmount = depositAmount; + LockupDynamic.Segment[] memory segments = defaults.segments(); + // Expect the relevant error to be thrown. vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockupDynamic_DepositAmountNotEqualToSegmentAmountsSum.selector, + Errors.SablierLockup_DepositAmountNotEqualToSegmentAmountsSum.selector, depositAmount, defaultDepositAmount ) ); // Create the stream. - lockupDynamic.createWithTimestamps(params); + lockup.createWithTimestampsLD(params, segments); } function test_RevertWhen_BrokerFeeExceedsMaxValue() @@ -248,7 +254,7 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD vm.expectRevert( abi.encodeWithSelector(Errors.SablierLockup_BrokerFeeTooHigh.selector, brokerFee, MAX_BROKER_FEE) ); - createDefaultStreamWithBroker(Broker({ account: users.broker, fee: brokerFee })); + createDefaultStreamWithBrokerLD(Broker({ account: users.broker, fee: brokerFee })); } function test_RevertWhen_AssetNotContract() @@ -272,7 +278,7 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD // Run the test. vm.expectRevert(abi.encodeWithSelector(Address.AddressEmptyCode.selector, nonContract)); - createDefaultStreamWithAsset(IERC20(nonContract)); + createDefaultStreamWithAssetLD(IERC20(nonContract)); } function test_WhenAssetMissesERC20ReturnValue() @@ -291,7 +297,7 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD whenBrokerFeeNotExceedMaxValue whenAssetContract { - testCreateWithTimestamps(address(usdt)); + _testCreateWithTimestampsLD(address(usdt)); } function test_WhenAssetNotMissERC20ReturnValue() @@ -310,11 +316,10 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD whenBrokerFeeNotExceedMaxValue whenAssetContract { - testCreateWithTimestamps(address(dai)); + _testCreateWithTimestampsLD(address(dai)); } - /// @dev Shared logic between {test_CreateWithTimestamps_AssetMissingReturnValue} and {test_CreateWithTimestamps}. - function testCreateWithTimestamps(address asset) internal { + function _testCreateWithTimestampsLD(address asset) private { // Make the Sender the stream's funder. address funder = users.sender; @@ -322,7 +327,7 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD expectCallToTransferFrom({ asset: IERC20(asset), from: funder, - to: address(lockupDynamic), + to: address(lockup), value: defaults.DEPOSIT_AMOUNT() }); @@ -335,10 +340,10 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD }); // It should emit {CreateLockupDynamicStream} and {MetadataUpdate} events. - vm.expectEmit({ emitter: address(lockupDynamic) }); + vm.expectEmit({ emitter: address(lockup) }); emit IERC4906.MetadataUpdate({ _tokenId: streamId }); - vm.expectEmit({ emitter: address(lockupDynamic) }); - emit ISablierLockupDynamic.CreateLockupDynamicStream({ + vm.expectEmit({ emitter: address(lockup) }); + emit ISablierLockup.CreateLockupDynamicStream({ streamId: streamId, funder: funder, sender: users.sender, @@ -353,26 +358,34 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is LockupD }); // Create the stream. - streamId = createDefaultStreamWithAsset(IERC20(asset)); + streamId = createDefaultStreamWithAssetLD(IERC20(asset)); // It should create the stream. - LockupDynamic.StreamLD memory actualStream = lockupDynamic.getStream(streamId); - LockupDynamic.StreamLD memory expectedStream = defaults.lockupDynamicStream(); - expectedStream.asset = IERC20(asset); - assertEq(actualStream, expectedStream); + assertEq(lockup.getDepositedAmount(streamId), defaults.DEPOSIT_AMOUNT(), "depositedAmount"); + assertEq(lockup.getAsset(streamId), IERC20(asset), "asset"); + assertEq(lockup.getEndTime(streamId), defaults.END_TIME(), "endTime"); + assertEq(lockup.isCancelable(streamId), true, "isCancelable"); + assertEq(lockup.isDepleted(streamId), false, "isDepleted"); + assertEq(lockup.isStream(streamId), true, "isStream"); + assertEq(lockup.isTransferable(streamId), true, "isTransferable"); + assertEq(lockup.getRecipient(streamId), users.recipient, "recipient"); + assertEq(lockup.getSender(streamId), users.sender, "sender"); + assertEq(lockup.getStartTime(streamId), defaults.START_TIME(), "startTime"); + assertEq(lockup.wasCanceled(streamId), false, "wasCanceled"); + assertEq(lockup.getSegments(streamId), defaults.segments(), "segments"); // Assert that the stream's status is "PENDING". - Lockup.Status actualStatus = lockupDynamic.statusOf(streamId); + Lockup.Status actualStatus = lockup.statusOf(streamId); Lockup.Status expectedStatus = Lockup.Status.PENDING; assertEq(actualStatus, expectedStatus); // It should bump the next stream ID. - uint256 actualNextStreamId = lockupDynamic.nextStreamId(); + uint256 actualNextStreamId = lockup.nextStreamId(); uint256 expectedNextStreamId = streamId + 1; assertEq(actualNextStreamId, expectedNextStreamId, "nextStreamId"); // It should mint the NFT. - address actualNFTOwner = lockupDynamic.ownerOf({ tokenId: streamId }); + address actualNFTOwner = lockup.ownerOf({ tokenId: streamId }); address expectedNFTOwner = users.recipient; assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } diff --git a/test/core/integration/concrete/lockup-dynamic/create-with-timestamps/createWithTimestamps.tree b/test/core/integration/concrete/lockup-dynamic/create-with-timestamps/createWithTimestampsLD.tree similarity index 98% rename from test/core/integration/concrete/lockup-dynamic/create-with-timestamps/createWithTimestamps.tree rename to test/core/integration/concrete/lockup-dynamic/create-with-timestamps/createWithTimestampsLD.tree index 8b4a2bc17..a827ea774 100644 --- a/test/core/integration/concrete/lockup-dynamic/create-with-timestamps/createWithTimestamps.tree +++ b/test/core/integration/concrete/lockup-dynamic/create-with-timestamps/createWithTimestampsLD.tree @@ -1,4 +1,4 @@ -CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test +CreateWithTimestampsLD_Integration_Concrete_Test ├── when delegate call │ └── it should revert └── when no delegate call diff --git a/test/core/integration/concrete/lockup-dynamic/get-segments/getSegments.t.sol b/test/core/integration/concrete/lockup-dynamic/get-segments/getSegments.t.sol index 929b0a398..daa295ae5 100644 --- a/test/core/integration/concrete/lockup-dynamic/get-segments/getSegments.t.sol +++ b/test/core/integration/concrete/lockup-dynamic/get-segments/getSegments.t.sol @@ -3,18 +3,17 @@ pragma solidity >=0.8.22 <0.9.0; import { Errors } from "src/core/libraries/Errors.sol"; import { LockupDynamic } from "src/core/types/DataTypes.sol"; -import { LockupDynamic_Integration_Shared_Test } from "../LockupDynamic.t.sol"; +import { Lockup_Dynamic_Integration_Shared_Test } from "./../LockupDynamic.t.sol"; -contract GetSegments_LockupDynamic_Integration_Concrete_Test is LockupDynamic_Integration_Shared_Test { +contract GetSegments_LockupDynamic_Integration_Concrete_Test is Lockup_Dynamic_Integration_Shared_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); - lockupDynamic.getSegments(nullStreamId); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); + lockup.getSegments(nullStreamId); } function test_GivenNotNull() external { - uint256 streamId = createDefaultStream(); - LockupDynamic.Segment[] memory actualSegments = lockupDynamic.getSegments(streamId); + LockupDynamic.Segment[] memory actualSegments = lockup.getSegments(defaultStreamId); LockupDynamic.Segment[] memory expectedSegments = defaults.segments(); assertEq(actualSegments, expectedSegments, "segments"); } diff --git a/test/core/integration/concrete/lockup-dynamic/get-stream/getStream.t.sol b/test/core/integration/concrete/lockup-dynamic/get-stream/getStream.t.sol deleted file mode 100644 index 7b7da2991..000000000 --- a/test/core/integration/concrete/lockup-dynamic/get-stream/getStream.t.sol +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.8.22 <0.9.0; - -import { Errors } from "src/core/libraries/Errors.sol"; -import { LockupDynamic } from "src/core/types/DataTypes.sol"; - -import { LockupDynamic_Integration_Shared_Test } from "../LockupDynamic.t.sol"; - -contract GetStream_LockupDynamic_Integration_Concrete_Test is LockupDynamic_Integration_Shared_Test { - function test_RevertGiven_Null() external { - uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); - lockupDynamic.getStream(nullStreamId); - } - - function test_GivenSettledStream() external givenNotNull { - vm.warp({ newTimestamp: defaults.END_TIME() }); - - // It should return the stream struct. - LockupDynamic.StreamLD memory actualStream = lockupDynamic.getStream(defaultStreamId); - LockupDynamic.StreamLD memory expectedStream = defaults.lockupDynamicStream(); - // It should always return stream as non-cancelable. - expectedStream.isCancelable = false; - assertEq(actualStream, expectedStream); - } - - function test_GivenNotSettledStream() external givenNotNull { - uint256 streamId = createDefaultStream(); - - // It should return the stream struct. - LockupDynamic.StreamLD memory actualStream = lockupDynamic.getStream(streamId); - LockupDynamic.StreamLD memory expectedStream = defaults.lockupDynamicStream(); - assertEq(actualStream, expectedStream); - } -} diff --git a/test/core/integration/concrete/lockup-dynamic/get-stream/getStream.tree b/test/core/integration/concrete/lockup-dynamic/get-stream/getStream.tree deleted file mode 100644 index 2a410a0ba..000000000 --- a/test/core/integration/concrete/lockup-dynamic/get-stream/getStream.tree +++ /dev/null @@ -1,9 +0,0 @@ -GetStream_LockupDynamic_Integration_Concrete_Test -├── given null -│ └── it should revert -└── given not null - ├── given settled stream - │ ├── it should always return stream as non-cancelable - │ └── it should return the stream struct - └── given not settled stream - └── it should return the stream struct diff --git a/test/core/integration/concrete/lockup-dynamic/get-timestamps/getTimestamps.t.sol b/test/core/integration/concrete/lockup-dynamic/get-timestamps/getTimestamps.t.sol index 70e78ef9a..523d7b9f1 100644 --- a/test/core/integration/concrete/lockup-dynamic/get-timestamps/getTimestamps.t.sol +++ b/test/core/integration/concrete/lockup-dynamic/get-timestamps/getTimestamps.t.sol @@ -2,21 +2,20 @@ pragma solidity >=0.8.22 <0.9.0; import { Errors } from "src/core/libraries/Errors.sol"; -import { LockupDynamic } from "src/core/types/DataTypes.sol"; +import { Lockup } from "src/core/types/DataTypes.sol"; -import { LockupDynamic_Integration_Shared_Test } from "../LockupDynamic.t.sol"; +import { Lockup_Dynamic_Integration_Shared_Test } from "./../LockupDynamic.t.sol"; -contract GetTimestamps_LockupDynamic_Integration_Concrete_Test is LockupDynamic_Integration_Shared_Test { +contract GetTimestamps_LockupDynamic_Integration_Concrete_Test is Lockup_Dynamic_Integration_Shared_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); - lockupDynamic.getTimestamps(nullStreamId); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); + lockup.getTimestamps(nullStreamId); } function test_GivenNotNull() external { - uint256 streamId = createDefaultStream(); - LockupDynamic.Timestamps memory actualTimestamps = lockupDynamic.getTimestamps(streamId); - LockupDynamic.Timestamps memory expectedTimestamps = defaults.lockupDynamicTimestamps(); + Lockup.Timestamps memory actualTimestamps = lockup.getTimestamps(defaultStreamId); + Lockup.Timestamps memory expectedTimestamps = defaults.lockupDynamicTimestamps(); assertEq(actualTimestamps, expectedTimestamps); } } diff --git a/test/core/integration/concrete/lockup-dynamic/streamed-amount-of/streamedAmountOf.t.sol b/test/core/integration/concrete/lockup-dynamic/streamed-amount-of/streamedAmountOf.t.sol index 1e3112329..efdf49d8c 100644 --- a/test/core/integration/concrete/lockup-dynamic/streamed-amount-of/streamedAmountOf.t.sol +++ b/test/core/integration/concrete/lockup-dynamic/streamed-amount-of/streamedAmountOf.t.sol @@ -2,26 +2,27 @@ pragma solidity >=0.8.22 <0.9.0; import { LockupDynamic } from "src/core/types/DataTypes.sol"; -import { StreamedAmountOf_Integration_Concrete_Test } from "./../../lockup/streamed-amount-of/streamedAmountOf.t.sol"; -import { LockupDynamic_Integration_Shared_Test, Integration_Test } from "./../LockupDynamic.t.sol"; +import { StreamedAmountOf_Integration_Concrete_Test } from + "./../../lockup-base/streamed-amount-of/streamedAmountOf.t.sol"; +import { Lockup_Dynamic_Integration_Shared_Test, Integration_Test } from "./../LockupDynamic.t.sol"; contract StreamedAmountOf_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, StreamedAmountOf_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } function test_GivenStartTimeInPresent() external givenSTREAMINGStatus { vm.warp({ newTimestamp: defaults.START_TIME() }); - uint128 actualStreamedAmount = lockupDynamic.streamedAmountOf(defaultStreamId); + uint128 actualStreamedAmount = lockup.streamedAmountOf(defaultStreamId); assertEq(actualStreamedAmount, 0, "streamedAmount"); } function test_GivenEndTimeNotInFuture() external givenSTREAMINGStatus givenStartTimeInPast { vm.warp({ newTimestamp: defaults.END_TIME() + 1 }); - uint128 actualStreamedAmount = lockupDynamic.streamedAmountOf(defaultStreamId); + uint128 actualStreamedAmount = lockup.streamedAmountOf(defaultStreamId); uint128 expectedStreamedAmount = defaults.DEPOSIT_AMOUNT(); assertEq(actualStreamedAmount, expectedStreamedAmount, "streamedAmount"); } @@ -39,10 +40,10 @@ contract StreamedAmountOf_LockupDynamic_Integration_Concrete_Test is }); // Create the stream. - uint256 streamId = createDefaultStreamWithSegments(segments); + uint256 streamId = createDefaultStreamWithSegmentsLD(segments); // It should return the correct streamed amount. - uint128 actualStreamedAmount = lockupDynamic.streamedAmountOf(streamId); + uint128 actualStreamedAmount = lockup.streamedAmountOf(streamId); uint128 expectedStreamedAmount = 4472.13595499957941e18; // (0.2^0.5)*10,000 assertEq(actualStreamedAmount, expectedStreamedAmount, "streamedAmount"); } @@ -52,7 +53,7 @@ contract StreamedAmountOf_LockupDynamic_Integration_Concrete_Test is vm.warp({ newTimestamp: defaults.START_TIME() + defaults.CLIFF_DURATION() + 750 seconds }); // It should return the correct streamed amount. - uint128 actualStreamedAmount = lockupDynamic.streamedAmountOf(defaultStreamId); + uint128 actualStreamedAmount = lockup.streamedAmountOf(defaultStreamId); uint128 expectedStreamedAmount = defaults.segments()[0].amount + 2371.708245126284505e18; // ~7,500*0.1^{0.5} assertEq(actualStreamedAmount, expectedStreamedAmount, "streamedAmount"); } diff --git a/test/core/integration/concrete/lockup-dynamic/token-uri/tokenURI.t.sol b/test/core/integration/concrete/lockup-dynamic/token-uri/tokenURI.t.sol index f637d0392..bad82ce3a 100644 --- a/test/core/integration/concrete/lockup-dynamic/token-uri/tokenURI.t.sol +++ b/test/core/integration/concrete/lockup-dynamic/token-uri/tokenURI.t.sol @@ -7,7 +7,7 @@ import { console2 } from "forge-std/src/console2.sol"; import { StdStyle } from "forge-std/src/StdStyle.sol"; import { Base64 } from "solady/src/utils/Base64.sol"; -import { LockupDynamic_Integration_Shared_Test } from "../LockupDynamic.t.sol"; +import { Lockup_Dynamic_Integration_Shared_Test } from "../LockupDynamic.t.sol"; /// @dev Requirements for these tests to work: /// - The stream ID must be 1 @@ -16,12 +16,12 @@ import { LockupDynamic_Integration_Shared_Test } from "../LockupDynamic.t.sol"; /// - The contract deployer, i.e. the `sender` config option in `foundry.toml`, must have the default value /// 0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38 so that the deployed contracts have the same addresses as /// the values hard coded in the tests below -contract TokenURI_LockupDynamic_Integration_Concrete_Test is LockupDynamic_Integration_Shared_Test { - address internal constant LOCKUP_DYNAMIC = 0xDB25A7b768311dE128BBDa7B8426c3f9C74f3240; +contract TokenURI_LockupDynamic_Integration_Concrete_Test is Lockup_Dynamic_Integration_Shared_Test { + address internal constant LOCKUP = 0xDB25A7b768311dE128BBDa7B8426c3f9C74f3240; /// @dev To make these tests noninvasive, they are run only when the contract address matches the hard coded value. modifier skipOnMismatch() { - if (address(lockupDynamic) == LOCKUP_DYNAMIC) { + if (address(lockup) == LOCKUP) { _; } else { console2.log(StdStyle.yellow('Warning: "LockupDynamic.tokenURI" tests skipped due to address mismatch')); @@ -31,7 +31,7 @@ contract TokenURI_LockupDynamic_Integration_Concrete_Test is LockupDynamic_Integ function test_RevertGiven_NFTNotExist() external { uint256 nullStreamId = 1729; vm.expectRevert(abi.encodeWithSelector(IERC721Errors.ERC721NonexistentToken.selector, nullStreamId)); - lockupDynamic.tokenURI({ tokenId: nullStreamId }); + lockup.tokenURI({ tokenId: nullStreamId }); } /// @dev If you need to update the hard-coded token URI: @@ -40,7 +40,7 @@ contract TokenURI_LockupDynamic_Integration_Concrete_Test is LockupDynamic_Integ function test_WhenTokenURIDecoded() external skipOnMismatch givenNFTExists { vm.warp({ newTimestamp: defaults.START_TIME() + defaults.TOTAL_DURATION() / 4 }); - string memory tokenURI = lockupDynamic.tokenURI(defaultStreamId); + string memory tokenURI = lockup.tokenURI(defaultStreamId); tokenURI = vm.replace({ input: tokenURI, from: "data:application/json;base64,", to: "" }); string memory actualDecodedTokenURI = string(Base64.decode(tokenURI)); string memory expectedDecodedTokenURI = @@ -51,7 +51,7 @@ contract TokenURI_LockupDynamic_Integration_Concrete_Test is LockupDynamic_Integ function test_WhenTokenURINotDecoded() external skipOnMismatch givenNFTExists { vm.warp({ newTimestamp: defaults.START_TIME() + defaults.TOTAL_DURATION() / 4 }); - string memory actualTokenURI = lockupDynamic.tokenURI(defaultStreamId); + string memory actualTokenURI = lockup.tokenURI(defaultStreamId); string memory expectedTokenURI = "data:application/json;base64,eyJhdHRyaWJ1dG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ejQ4ZFhObElHaHlaV1k5SWlOTWIyZHZJaUI0UFNJeE56QWlJSGs5SWpFM01DSWdkSEpoYm5ObWIzSnRQU0p6WTJGc1pTZ3VOaWtpTHo0OGRYTmxJR2h5WldZOUlpTkliM1Z5WjJ4aGMzTWlJSGc5SWpFMU1DSWdlVDBpT1RBaUlIUnlZVzV6Wm05eWJUMGljbTkwWVhSbEtERXdLU0lnZEhKaGJuTm1iM0p0TFc5eWFXZHBiajBpTlRBd0lEVXdNQ0l2UGp4MWMyVWdhSEpsWmowaUkxQnliMmR5WlhOeklpQjRQU0l4TkRRaUlIazlJamM1TUNJdlBqeDFjMlVnYUhKbFpqMGlJMU4wWVhSMWN5SWdlRDBpTXpZNElpQjVQU0kzT1RBaUx6NDhkWE5sSUdoeVpXWTlJaU5CYlc5MWJuUWlJSGc5SWpVMk9DSWdlVDBpTnprd0lpOCtQSFZ6WlNCb2NtVm1QU0lqUkhWeVlYUnBiMjRpSUhnOUlqY3dOQ0lnZVQwaU56a3dJaTgrUEM5emRtYysifQ"; assertEq(actualTokenURI, expectedTokenURI, "token URI"); diff --git a/test/core/integration/concrete/lockup-dynamic/withdrawable-amount-of/withdrawableAmountOf.t.sol b/test/core/integration/concrete/lockup-dynamic/withdrawable-amount-of/withdrawableAmountOf.t.sol index 59f57c449..721b895c9 100644 --- a/test/core/integration/concrete/lockup-dynamic/withdrawable-amount-of/withdrawableAmountOf.t.sol +++ b/test/core/integration/concrete/lockup-dynamic/withdrawable-amount-of/withdrawableAmountOf.t.sol @@ -2,20 +2,20 @@ pragma solidity >=0.8.22 <0.9.0; import { WithdrawableAmountOf_Integration_Concrete_Test } from - "./../../lockup/withdrawable-amount-of/withdrawableAmountOf.t.sol"; -import { LockupDynamic_Integration_Shared_Test, Integration_Test } from "./../LockupDynamic.t.sol"; + "./../../lockup-base/withdrawable-amount-of/withdrawableAmountOf.t.sol"; +import { Lockup_Dynamic_Integration_Shared_Test, Integration_Test } from "./../LockupDynamic.t.sol"; contract WithdrawableAmountOf_LockupDynamic_Integration_Concrete_Test is - LockupDynamic_Integration_Shared_Test, + Lockup_Dynamic_Integration_Shared_Test, WithdrawableAmountOf_Integration_Concrete_Test { - function setUp() public virtual override(LockupDynamic_Integration_Shared_Test, Integration_Test) { - LockupDynamic_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Dynamic_Integration_Shared_Test, Integration_Test) { + Lockup_Dynamic_Integration_Shared_Test.setUp(); } function test_GivenStartTimeInPresent() external givenSTREAMINGStatus { vm.warp({ newTimestamp: defaults.START_TIME() }); - uint128 actualWithdrawableAmount = lockupDynamic.withdrawableAmountOf(defaultStreamId); + uint128 actualWithdrawableAmount = lockup.withdrawableAmountOf(defaultStreamId); uint128 expectedWithdrawableAmount = 0; assertEq(actualWithdrawableAmount, expectedWithdrawableAmount, "withdrawableAmount"); } @@ -25,7 +25,7 @@ contract WithdrawableAmountOf_LockupDynamic_Integration_Concrete_Test is vm.warp({ newTimestamp: defaults.START_TIME() + defaults.CLIFF_DURATION() + 3750 seconds }); // Run the test. - uint128 actualWithdrawableAmount = lockupDynamic.withdrawableAmountOf(defaultStreamId); + uint128 actualWithdrawableAmount = lockup.withdrawableAmountOf(defaultStreamId); // The second term is 7,500*0.5^{0.5} uint128 expectedWithdrawableAmount = defaults.segments()[0].amount + 5303.30085889910643e18; assertEq(actualWithdrawableAmount, expectedWithdrawableAmount, "withdrawableAmount"); @@ -36,10 +36,10 @@ contract WithdrawableAmountOf_LockupDynamic_Integration_Concrete_Test is vm.warp({ newTimestamp: defaults.START_TIME() + defaults.CLIFF_DURATION() + 3750 seconds }); // Make the withdrawal. - lockupDynamic.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: defaults.WITHDRAW_AMOUNT() }); + lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: defaults.WITHDRAW_AMOUNT() }); // Run the test. - uint128 actualWithdrawableAmount = lockupDynamic.withdrawableAmountOf(defaultStreamId); + uint128 actualWithdrawableAmount = lockup.withdrawableAmountOf(defaultStreamId); // The second term is 7,500*0.5^{0.5} uint128 expectedWithdrawableAmount = diff --git a/test/core/integration/concrete/lockup-linear/LockupLinear.t.sol b/test/core/integration/concrete/lockup-linear/LockupLinear.t.sol index e5cfcae77..432784f41 100644 --- a/test/core/integration/concrete/lockup-linear/LockupLinear.t.sol +++ b/test/core/integration/concrete/lockup-linear/LockupLinear.t.sol @@ -2,339 +2,388 @@ pragma solidity >=0.8.22 <0.9.0; import { Integration_Test } from "./../../Integration.t.sol"; -import { LockupLinear_Integration_Shared_Test } from "./../../shared/lockup-linear/LockupLinear.t.sol"; -import { AllowToHook_Integration_Concrete_Test } from "./../lockup/allow-to-hook/allowToHook.t.sol"; -import { Batch_Integration_Concrete_Test } from "./../lockup/batch/batch.t.sol"; -import { Burn_Integration_Concrete_Test } from "./../lockup/burn/burn.t.sol"; -import { CancelMultiple_Integration_Concrete_Test } from "./../lockup/cancel-multiple/cancelMultiple.t.sol"; -import { Cancel_Integration_Concrete_Test } from "./../lockup/cancel/cancel.t.sol"; -import { GetAsset_Integration_Concrete_Test } from "./../lockup/get-asset/getAsset.t.sol"; -import { GetDepositedAmount_Integration_Concrete_Test } from "./../lockup/get-deposited-amount/getDepositedAmount.t.sol"; -import { GetEndTime_Integration_Concrete_Test } from "./../lockup/get-end-time/getEndTime.t.sol"; -import { GetRecipient_Integration_Concrete_Test } from "./../lockup/get-recipient/getRecipient.t.sol"; -import { GetRefundedAmount_Integration_Concrete_Test } from "./../lockup/get-refunded-amount/getRefundedAmount.t.sol"; -import { GetSender_Integration_Concrete_Test } from "./../lockup/get-sender/getSender.t.sol"; -import { GetStartTime_Integration_Concrete_Test } from "./../lockup/get-start-time/getStartTime.t.sol"; -import { GetWithdrawnAmount_Integration_Concrete_Test } from "./../lockup/get-withdrawn-amount/getWithdrawnAmount.t.sol"; -import { IsAllowedToHook_Integration_Concrete_Test } from "./../lockup/is-allowed-to-hook/isAllowedToHook.t.sol"; -import { IsCancelable_Integration_Concrete_Test } from "./../lockup/is-cancelable/isCancelable.t.sol"; -import { IsCold_Integration_Concrete_Test } from "./../lockup/is-cold/isCold.t.sol"; -import { IsDepleted_Integration_Concrete_Test } from "./../lockup/is-depleted/isDepleted.t.sol"; -import { IsStream_Integration_Concrete_Test } from "./../lockup/is-stream/isStream.t.sol"; -import { IsTransferable_Integration_Concrete_Test } from "./../lockup/is-transferable/isTransferable.t.sol"; -import { IsWarm_Integration_Concrete_Test } from "./../lockup/is-warm/isWarm.t.sol"; -import { RefundableAmountOf_Integration_Concrete_Test } from "./../lockup/refundable-amount-of/refundableAmountOf.t.sol"; -import { Renounce_Integration_Concrete_Test } from "./../lockup/renounce/renounce.t.sol"; -import { SetNFTDescriptor_Integration_Concrete_Test } from "./../lockup/set-nft-descriptor/setNFTDescriptor.t.sol"; -import { StatusOf_Integration_Concrete_Test } from "./../lockup/status-of/statusOf.t.sol"; -import { TransferFrom_Integration_Concrete_Test } from "./../lockup/transfer-from/transferFrom.t.sol"; -import { WasCanceled_Integration_Concrete_Test } from "./../lockup/was-canceled/wasCanceled.t.sol"; -import { WithdrawHooks_Integration_Concrete_Test } from "./../lockup/withdraw-hooks/withdrawHooks.t.sol"; +import { Lockup_Create_Integration_Shared_Test } from "./../../shared/lockup/Lockup.t.sol"; +import { AllowToHook_Integration_Concrete_Test } from "./../lockup-base/allow-to-hook/allowToHook.t.sol"; +import { Batch_Integration_Concrete_Test } from "./../lockup-base/batch/batch.t.sol"; +import { Burn_Integration_Concrete_Test } from "./../lockup-base/burn/burn.t.sol"; +import { CancelMultiple_Integration_Concrete_Test } from "./../lockup-base/cancel-multiple/cancelMultiple.t.sol"; +import { Cancel_Integration_Concrete_Test } from "./../lockup-base/cancel/cancel.t.sol"; +import { GetAsset_Integration_Concrete_Test } from "./../lockup-base/get-asset/getAsset.t.sol"; +import { GetDepositedAmount_Integration_Concrete_Test } from + "./../lockup-base/get-deposited-amount/getDepositedAmount.t.sol"; +import { GetEndTime_Integration_Concrete_Test } from "./../lockup-base/get-end-time/getEndTime.t.sol"; +import { GetRecipient_Integration_Concrete_Test } from "./../lockup-base/get-recipient/getRecipient.t.sol"; +import { GetRefundedAmount_Integration_Concrete_Test } from + "./../lockup-base/get-refunded-amount/getRefundedAmount.t.sol"; +import { GetSender_Integration_Concrete_Test } from "./../lockup-base/get-sender/getSender.t.sol"; +import { GetStartTime_Integration_Concrete_Test } from "./../lockup-base/get-start-time/getStartTime.t.sol"; +import { GetWithdrawnAmount_Integration_Concrete_Test } from + "./../lockup-base/get-withdrawn-amount/getWithdrawnAmount.t.sol"; +import { IsAllowedToHook_Integration_Concrete_Test } from "./../lockup-base/is-allowed-to-hook/isAllowedToHook.t.sol"; +import { IsCancelable_Integration_Concrete_Test } from "./../lockup-base/is-cancelable/isCancelable.t.sol"; +import { IsCold_Integration_Concrete_Test } from "./../lockup-base/is-cold/isCold.t.sol"; +import { IsDepleted_Integration_Concrete_Test } from "./../lockup-base/is-depleted/isDepleted.t.sol"; +import { IsStream_Integration_Concrete_Test } from "./../lockup-base/is-stream/isStream.t.sol"; +import { IsTransferable_Integration_Concrete_Test } from "./../lockup-base/is-transferable/isTransferable.t.sol"; +import { IsWarm_Integration_Concrete_Test } from "./../lockup-base/is-warm/isWarm.t.sol"; +import { RefundableAmountOf_Integration_Concrete_Test } from + "./../lockup-base/refundable-amount-of/refundableAmountOf.t.sol"; +import { Renounce_Integration_Concrete_Test } from "./../lockup-base/renounce/renounce.t.sol"; +import { SetNFTDescriptor_Integration_Concrete_Test } from "./../lockup-base/set-nft-descriptor/setNFTDescriptor.t.sol"; +import { StatusOf_Integration_Concrete_Test } from "./../lockup-base/status-of/statusOf.t.sol"; +import { TransferFrom_Integration_Concrete_Test } from "./../lockup-base/transfer-from/transferFrom.t.sol"; +import { WasCanceled_Integration_Concrete_Test } from "./../lockup-base/was-canceled/wasCanceled.t.sol"; +import { WithdrawHooks_Integration_Concrete_Test } from "./../lockup-base/withdraw-hooks/withdrawHooks.t.sol"; import { WithdrawMaxAndTransfer_Integration_Concrete_Test } from - "./../lockup/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol"; -import { WithdrawMax_Integration_Concrete_Test } from "./../lockup/withdraw-max/withdrawMax.t.sol"; -import { WithdrawMultiple_Integration_Concrete_Test } from "./../lockup/withdraw-multiple/withdrawMultiple.t.sol"; -import { Withdraw_Integration_Concrete_Test } from "./../lockup/withdraw/withdraw.t.sol"; + "./../lockup-base/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol"; +import { WithdrawMax_Integration_Concrete_Test } from "./../lockup-base/withdraw-max/withdrawMax.t.sol"; +import { WithdrawMultiple_Integration_Concrete_Test } from "./../lockup-base/withdraw-multiple/withdrawMultiple.t.sol"; +import { Withdraw_Integration_Concrete_Test } from "./../lockup-base/withdraw/withdraw.t.sol"; + +abstract contract Lockup_Linear_Integration_Shared_Test is Lockup_Create_Integration_Shared_Test { + function setUp() public virtual override { + Lockup_Create_Integration_Shared_Test.setUp(); + + // Initialize streams IDs. + defaultStreamId = createDefaultStreamLL(); + differentSenderRecipientStreamId = + createDefaultStreamWithUsersLL({ recipient: address(recipientGood), sender: users.sender }); + earlyEndtimeStreamId = createDefaultStreamWithEndTimeLL({ endTime: defaults.CLIFF_TIME() + 1 seconds }); + identicalSenderRecipientStreamId = createDefaultStreamWithIdenticalUsersLL(users.sender); + notCancelableStreamId = createDefaultStreamNotCancelableLL(); + notTransferableStreamId = createDefaultStreamNotTransferableLL(); + recipientContractStreamId = createDefaultStreamWithRecipientLL(address(recipientGood)); + recipientInvalidSelectorStreamId = createDefaultStreamWithRecipientLL(address(recipientInvalidSelector)); + recipientReentrantStreamId = createDefaultStreamWithRecipientLL(address(recipientReentrant)); + recipientRevertStreamId = createDefaultStreamWithRecipientLL(address(recipientReverting)); + } +} /*////////////////////////////////////////////////////////////////////////// SHARED TESTS //////////////////////////////////////////////////////////////////////////*/ contract AllowToHook_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, AllowToHook_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract Batch_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, Batch_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract Burn_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, Burn_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract Cancel_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, Cancel_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract CancelMultiple_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, CancelMultiple_Integration_Concrete_Test { - function setUp() - public - virtual - override(LockupLinear_Integration_Shared_Test, CancelMultiple_Integration_Concrete_Test) - { - LockupLinear_Integration_Shared_Test.setUp(); - CancelMultiple_Integration_Concrete_Test.setUp(); + modifier whenCallerAuthorizedForAll() override { + _; + cancelMultipleStreamIds = WarpAndCreateStreamsForCancelMultipleLL({ warpTime: originalTime }); + _; + } + + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); + + originalTime = getBlockTimestamp(); + cancelMultipleStreamIds = WarpAndCreateStreamsForCancelMultipleLL({ warpTime: originalTime }); } } contract GetAsset_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, GetAsset_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract GetDepositedAmount_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, GetDepositedAmount_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract GetEndTime_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, GetEndTime_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract GetRecipient_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, GetRecipient_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract GetRefundedAmount_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, GetRefundedAmount_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract GetSender_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, GetSender_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract GetStartTime_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, GetStartTime_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract GetWithdrawnAmount_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, GetWithdrawnAmount_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract IsAllowedToHook_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, IsAllowedToHook_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract IsCancelable_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, IsCancelable_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract IsCold_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, IsCold_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract IsDepleted_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, IsDepleted_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract IsStream_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, IsStream_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract IsTransferable_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, IsTransferable_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract IsWarm_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, IsWarm_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract Renounce_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, Renounce_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract RefundableAmountOf_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, RefundableAmountOf_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract SetNFTDescriptor_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, SetNFTDescriptor_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract StatusOf_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, StatusOf_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract TransferFrom_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, TransferFrom_Integration_Concrete_Test { function setUp() public virtual - override(LockupLinear_Integration_Shared_Test, TransferFrom_Integration_Concrete_Test) + override(Lockup_Linear_Integration_Shared_Test, TransferFrom_Integration_Concrete_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + Lockup_Linear_Integration_Shared_Test.setUp(); TransferFrom_Integration_Concrete_Test.setUp(); } } contract WasCanceled_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, WasCanceled_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract Withdraw_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, Withdraw_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract WithdrawHooks_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, WithdrawHooks_Integration_Concrete_Test { function setUp() public virtual - override(LockupLinear_Integration_Shared_Test, WithdrawHooks_Integration_Concrete_Test) + override(Lockup_Linear_Integration_Shared_Test, WithdrawHooks_Integration_Concrete_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + Lockup_Linear_Integration_Shared_Test.setUp(); WithdrawHooks_Integration_Concrete_Test.setUp(); } } contract WithdrawMax_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, WithdrawMax_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract WithdrawMaxAndTransfer_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, WithdrawMaxAndTransfer_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } } contract WithdrawMultiple_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, WithdrawMultiple_Integration_Concrete_Test { - function setUp() - public - virtual - override(LockupLinear_Integration_Shared_Test, WithdrawMultiple_Integration_Concrete_Test) - { - LockupLinear_Integration_Shared_Test.setUp(); - WithdrawMultiple_Integration_Concrete_Test.setUp(); + /// @dev This modifier runs the test in three different modes: + /// - Stream's sender as caller + /// - Stream's recipient as caller + /// - Approved NFT operator as caller + modifier whenCallerAuthorizedAllStreams() override { + caller = users.sender; + _; + + WarpAndCreateStreamsWithdrawMultipleLL({ warpTime: originalTime }); + caller = users.recipient; + _; + + WarpAndCreateStreamsWithdrawMultipleLL({ warpTime: originalTime }); + caller = users.operator; + _; + } + + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); + + originalTime = getBlockTimestamp(); + + // Define the default amounts. + testAmounts = new uint128[](3); + testAmounts[0] = defaults.WITHDRAW_AMOUNT(); + testAmounts[1] = defaults.DEPOSIT_AMOUNT(); + testAmounts[2] = defaults.WITHDRAW_AMOUNT() / 2; + + withdrawMultipleStreamIds = WarpAndCreateStreamsWithdrawMultipleLL({ warpTime: originalTime }); } } diff --git a/test/core/integration/concrete/lockup-linear/create-with-durations/createWithDurations.t.sol b/test/core/integration/concrete/lockup-linear/create-with-durations/createWithDurationsLL.t.sol similarity index 64% rename from test/core/integration/concrete/lockup-linear/create-with-durations/createWithDurations.t.sol rename to test/core/integration/concrete/lockup-linear/create-with-durations/createWithDurationsLL.t.sol index 861426bb9..07b4277b7 100644 --- a/test/core/integration/concrete/lockup-linear/create-with-durations/createWithDurations.t.sol +++ b/test/core/integration/concrete/lockup-linear/create-with-durations/createWithDurationsLL.t.sol @@ -3,24 +3,24 @@ pragma solidity >=0.8.22 <0.9.0; import { IERC4906 } from "@openzeppelin/contracts/interfaces/IERC4906.sol"; -import { ISablierLockupLinear } from "src/core/interfaces/ISablierLockupLinear.sol"; +import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; import { Errors } from "src/core/libraries/Errors.sol"; import { Lockup, LockupLinear } from "src/core/types/DataTypes.sol"; -import { LockupLinear_Integration_Shared_Test } from "../LockupLinear.t.sol"; +import { Lockup_Linear_Integration_Shared_Test } from "../LockupLinear.t.sol"; -contract CreateWithDurations_LockupLinear_Integration_Concrete_Test is LockupLinear_Integration_Shared_Test { +contract CreateWithDurationsLL_Integration_Concrete_Test is Lockup_Linear_Integration_Shared_Test { uint256 internal streamId; function setUp() public virtual override { - LockupLinear_Integration_Shared_Test.setUp(); - streamId = lockupLinear.nextStreamId(); + Lockup_Linear_Integration_Shared_Test.setUp(); + streamId = lockup.nextStreamId(); } function test_RevertWhen_DelegateCall() external { bytes memory callData = - abi.encodeCall(ISablierLockupLinear.createWithDurations, defaults.createWithDurationsLL()); - (bool success, bytes memory returnData) = address(lockupLinear).delegatecall(callData); + abi.encodeCall(ISablierLockup.createWithDurationsLL, (defaults.createWithDurations(), defaults.durations())); + (bool success, bytes memory returnData) = address(lockup).delegatecall(callData); expectRevertDueToDelegateCall(success, returnData); } @@ -37,13 +37,11 @@ contract CreateWithDurations_LockupLinear_Integration_Concrete_Test is LockupLin // It should revert. vm.expectRevert( - abi.encodeWithSelector( - Errors.SablierLockupLinear_StartTimeNotLessThanCliffTime.selector, startTime, cliffTime - ) + abi.encodeWithSelector(Errors.SablierLockup_StartTimeNotLessThanCliffTime.selector, startTime, cliffTime) ); // Create the stream. - createDefaultStreamWithDurations(LockupLinear.Durations({ cliff: cliffDuration, total: totalDuration })); + createDefaultStreamWithDurationsLL(LockupLinear.Durations({ cliff: cliffDuration, total: totalDuration })); } function test_WhenCliffTimeCalculationNotOverflow() external whenNoDelegateCall whenCliffDurationNotZero { @@ -66,11 +64,11 @@ contract CreateWithDurations_LockupLinear_Integration_Concrete_Test is LockupLin // It should revert. vm.expectRevert( - abi.encodeWithSelector(Errors.SablierLockupLinear_StartTimeNotLessThanEndTime.selector, startTime, endTime) + abi.encodeWithSelector(Errors.SablierLockup_StartTimeNotLessThanEndTime.selector, startTime, endTime) ); // Create the stream. - createDefaultStreamWithDurations(durations); + createDefaultStreamWithDurationsLL(durations); } function test_WhenEndTimeCalculationNotOverflow() external whenNoDelegateCall whenCliffDurationZero { @@ -85,7 +83,7 @@ contract CreateWithDurations_LockupLinear_Integration_Concrete_Test is LockupLin // Declare the timestamps. uint40 blockTimestamp = getBlockTimestamp(); - LockupLinear.Timestamps memory timestamps = LockupLinear.Timestamps({ + Lockup.Timestamps memory timestamps = Lockup.Timestamps({ start: blockTimestamp, cliff: blockTimestamp + durations.cliff, end: blockTimestamp + durations.total @@ -94,16 +92,16 @@ contract CreateWithDurations_LockupLinear_Integration_Concrete_Test is LockupLin if (durations.cliff == 0) timestamps.cliff = 0; // It should perform the ERC-20 transfers. - expectCallToTransferFrom({ from: funder, to: address(lockupLinear), value: defaults.DEPOSIT_AMOUNT() }); + expectCallToTransferFrom({ from: funder, to: address(lockup), value: defaults.DEPOSIT_AMOUNT() }); // Expect the broker fee to be paid to the broker. expectCallToTransferFrom({ from: funder, to: users.broker, value: defaults.BROKER_FEE_AMOUNT() }); // It should emit {CreateLockupLinearStream} and {MetadataUpdate} events. - vm.expectEmit({ emitter: address(lockupLinear) }); + vm.expectEmit({ emitter: address(lockup) }); emit IERC4906.MetadataUpdate({ _tokenId: streamId }); - vm.expectEmit({ emitter: address(lockupLinear) }); - emit ISablierLockupLinear.CreateLockupLinearStream({ + vm.expectEmit({ emitter: address(lockup) }); + emit ISablierLockup.CreateLockupLinearStream({ streamId: streamId, funder: funder, sender: users.sender, @@ -117,28 +115,34 @@ contract CreateWithDurations_LockupLinear_Integration_Concrete_Test is LockupLin }); // Create the stream. - createDefaultStreamWithDurations(durations); + createDefaultStreamWithDurationsLL(durations); // It should create the stream. - LockupLinear.StreamLL memory actualStream = lockupLinear.getStream(streamId); - LockupLinear.StreamLL memory expectedStream = defaults.lockupLinearStream(); - expectedStream.startTime = timestamps.start; - expectedStream.cliffTime = timestamps.cliff; - expectedStream.endTime = timestamps.end; - assertEq(actualStream, expectedStream); + assertEq(lockup.getDepositedAmount(streamId), defaults.DEPOSIT_AMOUNT(), "depositedAmount"); + assertEq(lockup.getAsset(streamId), dai, "asset"); + assertEq(lockup.getEndTime(streamId), timestamps.end, "endTime"); + assertEq(lockup.isCancelable(streamId), true, "isCancelable"); + assertEq(lockup.isDepleted(streamId), false, "isDepleted"); + assertEq(lockup.isStream(streamId), true, "isStream"); + assertEq(lockup.isTransferable(streamId), true, "isTransferable"); + assertEq(lockup.getRecipient(streamId), users.recipient, "recipient"); + assertEq(lockup.getSender(streamId), users.sender, "sender"); + assertEq(lockup.getStartTime(streamId), timestamps.start, "startTime"); + assertEq(lockup.wasCanceled(streamId), false, "wasCanceled"); + assertEq(lockup.getCliffTime(streamId), timestamps.cliff, "cliff"); // Assert that the stream's status is "STREAMING". - Lockup.Status actualStatus = lockupLinear.statusOf(streamId); + Lockup.Status actualStatus = lockup.statusOf(streamId); Lockup.Status expectedStatus = Lockup.Status.STREAMING; assertEq(actualStatus, expectedStatus); // It should bump the next stream ID. - uint256 actualNextStreamId = lockupLinear.nextStreamId(); + uint256 actualNextStreamId = lockup.nextStreamId(); uint256 expectedNextStreamId = streamId + 1; assertEq(actualNextStreamId, expectedNextStreamId, "nextStreamId"); // It should mint the NFT. - address actualNFTOwner = lockupLinear.ownerOf({ tokenId: streamId }); + address actualNFTOwner = lockup.ownerOf({ tokenId: streamId }); address expectedNFTOwner = users.recipient; assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } diff --git a/test/core/integration/concrete/lockup-linear/create-with-durations/createWithDurations.tree b/test/core/integration/concrete/lockup-linear/create-with-durations/createWithDurationsLL.tree similarity index 94% rename from test/core/integration/concrete/lockup-linear/create-with-durations/createWithDurations.tree rename to test/core/integration/concrete/lockup-linear/create-with-durations/createWithDurationsLL.tree index 8aecc0edc..471e17494 100644 --- a/test/core/integration/concrete/lockup-linear/create-with-durations/createWithDurations.tree +++ b/test/core/integration/concrete/lockup-linear/create-with-durations/createWithDurationsLL.tree @@ -1,4 +1,4 @@ -CreateWithDurations_LockupLinear_Integration_Concrete_Test +CreateWithDurationsLL_Integration_Concrete_Test ├── when delegate call │ └── it should revert └── when no delegate call diff --git a/test/core/integration/concrete/lockup-linear/create-with-timestamps/createWithTimestamps.t.sol b/test/core/integration/concrete/lockup-linear/create-with-timestamps/createWithTimestampsLL.t.sol similarity index 62% rename from test/core/integration/concrete/lockup-linear/create-with-timestamps/createWithTimestamps.t.sol rename to test/core/integration/concrete/lockup-linear/create-with-timestamps/createWithTimestampsLL.t.sol index 03c21efe4..880c92f7b 100644 --- a/test/core/integration/concrete/lockup-linear/create-with-timestamps/createWithTimestamps.t.sol +++ b/test/core/integration/concrete/lockup-linear/create-with-timestamps/createWithTimestampsLL.t.sol @@ -6,35 +6,36 @@ import { IERC4906 } from "@openzeppelin/contracts/interfaces/IERC4906.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { Address } from "@openzeppelin/contracts/utils/Address.sol"; import { UD60x18, ud } from "@prb/math/src/UD60x18.sol"; -import { ISablierLockupLinear } from "src/core/interfaces/ISablierLockupLinear.sol"; +import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; import { Errors } from "src/core/libraries/Errors.sol"; -import { Broker, Lockup, LockupLinear } from "src/core/types/DataTypes.sol"; -import { LockupLinear_Integration_Shared_Test } from "./../LockupLinear.t.sol"; +import { Broker, Lockup } from "src/core/types/DataTypes.sol"; +import { Lockup_Linear_Integration_Shared_Test } from "./../LockupLinear.t.sol"; -contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is LockupLinear_Integration_Shared_Test { +contract CreateWithTimestampsLL_Integration_Concrete_Test is Lockup_Linear_Integration_Shared_Test { uint256 internal streamId; function setUp() public override { - LockupLinear_Integration_Shared_Test.setUp(); - streamId = lockupLinear.nextStreamId(); + Lockup_Linear_Integration_Shared_Test.setUp(); + streamId = lockup.nextStreamId(); } function test_RevertWhen_DelegateCall() external { - bytes memory callData = - abi.encodeCall(ISablierLockupLinear.createWithTimestamps, defaults.createWithTimestampsLL()); - (bool success, bytes memory returnData) = address(lockupLinear).delegatecall(callData); + bytes memory callData = abi.encodeCall( + ISablierLockup.createWithTimestampsLT, (defaults.createWithTimestamps(), defaults.tranches()) + ); + (bool success, bytes memory returnData) = address(lockup).delegatecall(callData); expectRevertDueToDelegateCall(success, returnData); } function test_RevertWhen_SenderZeroAddress() external whenNoDelegateCall { vm.expectRevert(Errors.SablierLockup_SenderZeroAddress.selector); - createDefaultStreamWithSender(address(0)); + createDefaultStreamWithSenderLL(address(0)); } function test_RevertWhen_RecipientZeroAddress() external whenNoDelegateCall whenSenderNotZeroAddress { address recipient = address(0); vm.expectRevert(abi.encodeWithSelector(IERC721Errors.ERC721InvalidReceiver.selector, recipient)); - createDefaultStreamWithRecipient(recipient); + createDefaultStreamWithRecipientLL(recipient); } function test_RevertWhen_DepositAmountZero() @@ -44,7 +45,7 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is LockupLi whenRecipientNotZeroAddress { vm.expectRevert(Errors.SablierLockup_DepositAmountZero.selector); - createDefaultStreamWithTotalAmount(0); + createDefaultStreamWithTotalAmountLL(0); } function test_RevertWhen_StartTimeZero() @@ -58,7 +59,7 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is LockupLi uint40 endTime = defaults.END_TIME(); vm.expectRevert(Errors.SablierLockup_StartTimeZero.selector); - createDefaultStreamWithTimestamps(LockupLinear.Timestamps({ start: 0, cliff: cliffTime, end: endTime })); + createDefaultStreamWithTimestampsLL(Lockup.Timestamps({ start: 0, cliff: cliffTime, end: endTime })); } function test_RevertWhen_StartTimeNotLessThanEndTime() @@ -74,9 +75,9 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is LockupLi uint40 endTime = defaults.START_TIME(); vm.expectRevert( - abi.encodeWithSelector(Errors.SablierLockupLinear_StartTimeNotLessThanEndTime.selector, startTime, endTime) + abi.encodeWithSelector(Errors.SablierLockup_StartTimeNotLessThanEndTime.selector, startTime, endTime) ); - createDefaultStreamWithTimestamps(LockupLinear.Timestamps({ start: startTime, cliff: 0, end: endTime })); + createDefaultStreamWithTimestampsLL(Lockup.Timestamps({ start: startTime, cliff: 0, end: endTime })); } function test_WhenStartTimeLessThanEndTime() @@ -88,23 +89,31 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is LockupLi whenStartTimeNotZero whenCliffTimeZero { - createDefaultStreamWithTimestamps( - LockupLinear.Timestamps({ start: defaults.START_TIME(), cliff: 0, end: defaults.END_TIME() }) + createDefaultStreamWithTimestampsLL( + Lockup.Timestamps({ start: defaults.START_TIME(), cliff: 0, end: defaults.END_TIME() }) ); - // Assert that the stream has been created. - LockupLinear.StreamLL memory actualStream = lockupLinear.getStream(streamId); - LockupLinear.StreamLL memory expectedStream = defaults.lockupLinearStream(); - expectedStream.cliffTime = 0; - assertEq(actualStream, expectedStream); + // It should create the stream. + assertEq(lockup.getDepositedAmount(streamId), defaults.DEPOSIT_AMOUNT(), "depositedAmount"); + assertEq(lockup.getAsset(streamId), dai, "asset"); + assertEq(lockup.getEndTime(streamId), defaults.END_TIME(), "endTime"); + assertEq(lockup.isCancelable(streamId), true, "isCancelable"); + assertEq(lockup.isDepleted(streamId), false, "isDepleted"); + assertEq(lockup.isStream(streamId), true, "isStream"); + assertEq(lockup.isTransferable(streamId), true, "isTransferable"); + assertEq(lockup.getRecipient(streamId), users.recipient, "recipient"); + assertEq(lockup.getSender(streamId), users.sender, "sender"); + assertEq(lockup.getStartTime(streamId), defaults.START_TIME(), "startTime"); + assertEq(lockup.wasCanceled(streamId), false, "wasCanceled"); + assertEq(lockup.getCliffTime(streamId), 0, "cliff"); // Assert that the next stream ID has been bumped. - uint256 actualNextStreamId = lockupLinear.nextStreamId(); + uint256 actualNextStreamId = lockup.nextStreamId(); uint256 expectedNextStreamId = streamId + 1; assertEq(actualNextStreamId, expectedNextStreamId, "nextStreamId"); // Assert that the NFT has been minted. - address actualNFTOwner = lockupLinear.ownerOf({ tokenId: streamId }); + address actualNFTOwner = lockup.ownerOf({ tokenId: streamId }); address expectedNFTOwner = users.recipient; assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } @@ -122,11 +131,9 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is LockupLi uint40 cliffTime = defaults.START_TIME(); uint40 endTime = defaults.END_TIME(); vm.expectRevert( - abi.encodeWithSelector( - Errors.SablierLockupLinear_StartTimeNotLessThanCliffTime.selector, startTime, cliffTime - ) + abi.encodeWithSelector(Errors.SablierLockup_StartTimeNotLessThanCliffTime.selector, startTime, cliffTime) ); - createDefaultStreamWithTimestamps(LockupLinear.Timestamps({ start: startTime, cliff: cliffTime, end: endTime })); + createDefaultStreamWithTimestampsLL(Lockup.Timestamps({ start: startTime, cliff: cliffTime, end: endTime })); } function test_RevertWhen_CliffTimeNotLessThanEndTime() @@ -143,9 +150,9 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is LockupLi uint40 cliffTime = defaults.END_TIME(); uint40 endTime = defaults.CLIFF_TIME(); vm.expectRevert( - abi.encodeWithSelector(Errors.SablierLockupLinear_CliffTimeNotLessThanEndTime.selector, cliffTime, endTime) + abi.encodeWithSelector(Errors.SablierLockup_CliffTimeNotLessThanEndTime.selector, cliffTime, endTime) ); - createDefaultStreamWithTimestamps(LockupLinear.Timestamps({ start: startTime, cliff: cliffTime, end: endTime })); + createDefaultStreamWithTimestampsLL(Lockup.Timestamps({ start: startTime, cliff: cliffTime, end: endTime })); } function test_RevertWhen_BrokerFeeExceedsMaxValue() @@ -163,7 +170,7 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is LockupLi vm.expectRevert( abi.encodeWithSelector(Errors.SablierLockup_BrokerFeeTooHigh.selector, brokerFee, MAX_BROKER_FEE) ); - createDefaultStreamWithBroker(Broker({ account: users.broker, fee: brokerFee })); + createDefaultStreamWithBrokerLL(Broker({ account: users.broker, fee: brokerFee })); } function test_RevertWhen_AssetNotContract() @@ -180,7 +187,7 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is LockupLi { address nonContract = address(8128); vm.expectRevert(abi.encodeWithSelector(Address.AddressEmptyCode.selector, nonContract)); - createDefaultStreamWithAsset(IERC20(nonContract)); + createDefaultStreamWithAssetLL(IERC20(nonContract)); } function test_WhenAssetMissesERC20ReturnValue() @@ -196,7 +203,7 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is LockupLi whenBrokerFeeNotExceedMaxValue whenAssetContract { - testCreateWithTimestamps(address(usdt)); + _testCreateWithTimestamps(address(usdt)); } function test_WhenAssetNotMissERC20ReturnValue() @@ -212,11 +219,11 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is LockupLi whenBrokerFeeNotExceedMaxValue whenAssetContract { - testCreateWithTimestamps(address(dai)); + _testCreateWithTimestamps(address(dai)); } /// @dev Shared logic between {test_CreateWithTimestamps_AssetMissingReturnValue} and {test_CreateWithTimestamps}. - function testCreateWithTimestamps(address asset) internal { + function _testCreateWithTimestamps(address asset) private { // Make the Sender the stream's funder. address funder = users.sender; @@ -224,7 +231,7 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is LockupLi expectCallToTransferFrom({ asset: IERC20(asset), from: funder, - to: address(lockupLinear), + to: address(lockup), value: defaults.DEPOSIT_AMOUNT() }); @@ -237,10 +244,10 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is LockupLi }); // It should emit {MetadataUpdate} and {CreateLockupLinearStream} events. - vm.expectEmit({ emitter: address(lockupLinear) }); + vm.expectEmit({ emitter: address(lockup) }); emit IERC4906.MetadataUpdate({ _tokenId: streamId }); - vm.expectEmit({ emitter: address(lockupLinear) }); - emit ISablierLockupLinear.CreateLockupLinearStream({ + vm.expectEmit({ emitter: address(lockup) }); + emit ISablierLockup.CreateLockupLinearStream({ streamId: streamId, funder: funder, sender: users.sender, @@ -254,26 +261,34 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is LockupLi }); // Create the stream. - createDefaultStreamWithAsset(IERC20(asset)); + createDefaultStreamWithAssetLL(IERC20(asset)); // It should create the stream. - LockupLinear.StreamLL memory actualStream = lockupLinear.getStream(streamId); - LockupLinear.StreamLL memory expectedStream = defaults.lockupLinearStream(); - expectedStream.asset = IERC20(asset); - assertEq(actualStream, expectedStream); + assertEq(lockup.getDepositedAmount(streamId), defaults.DEPOSIT_AMOUNT(), "depositedAmount"); + assertEq(lockup.getAsset(streamId), IERC20(asset), "asset"); + assertEq(lockup.getEndTime(streamId), defaults.END_TIME(), "endTime"); + assertEq(lockup.isCancelable(streamId), true, "isCancelable"); + assertEq(lockup.isDepleted(streamId), false, "isDepleted"); + assertEq(lockup.isStream(streamId), true, "isStream"); + assertEq(lockup.isTransferable(streamId), true, "isTransferable"); + assertEq(lockup.getRecipient(streamId), users.recipient, "recipient"); + assertEq(lockup.getSender(streamId), users.sender, "sender"); + assertEq(lockup.getStartTime(streamId), defaults.START_TIME(), "startTime"); + assertEq(lockup.wasCanceled(streamId), false, "wasCanceled"); + assertEq(lockup.getCliffTime(streamId), defaults.CLIFF_TIME(), "cliff"); // Assert that the stream's status is "PENDING". - Lockup.Status actualStatus = lockupLinear.statusOf(streamId); + Lockup.Status actualStatus = lockup.statusOf(streamId); Lockup.Status expectedStatus = Lockup.Status.PENDING; assertEq(actualStatus, expectedStatus); // It should bump the next stream ID. - uint256 actualNextStreamId = lockupLinear.nextStreamId(); + uint256 actualNextStreamId = lockup.nextStreamId(); uint256 expectedNextStreamId = streamId + 1; assertEq(actualNextStreamId, expectedNextStreamId, "nextStreamId"); // It should mint the NFT. - address actualNFTOwner = lockupLinear.ownerOf({ tokenId: streamId }); + address actualNFTOwner = lockup.ownerOf({ tokenId: streamId }); address expectedNFTOwner = users.recipient; assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } diff --git a/test/core/integration/concrete/lockup-linear/create-with-timestamps/createWithTimestamps.tree b/test/core/integration/concrete/lockup-linear/create-with-timestamps/createWithTimestampsLL.tree similarity index 97% rename from test/core/integration/concrete/lockup-linear/create-with-timestamps/createWithTimestamps.tree rename to test/core/integration/concrete/lockup-linear/create-with-timestamps/createWithTimestampsLL.tree index 640b7753a..f1d53bdd8 100644 --- a/test/core/integration/concrete/lockup-linear/create-with-timestamps/createWithTimestamps.tree +++ b/test/core/integration/concrete/lockup-linear/create-with-timestamps/createWithTimestampsLL.tree @@ -1,4 +1,4 @@ -CreateWithTimestamps_LockupLinear_Integration_Concrete_Test +CreateWithTimestampsLL_Integration_Concrete_Test ├── when delegate call │ └── it should revert └── when no delegate call diff --git a/test/core/integration/concrete/lockup-linear/get-cliff-time/getCliffTime.t.sol b/test/core/integration/concrete/lockup-linear/get-cliff-time/getCliffTime.t.sol index 95f6f963f..07d8e07bc 100644 --- a/test/core/integration/concrete/lockup-linear/get-cliff-time/getCliffTime.t.sol +++ b/test/core/integration/concrete/lockup-linear/get-cliff-time/getCliffTime.t.sol @@ -3,18 +3,17 @@ pragma solidity >=0.8.22 <0.9.0; import { Errors } from "src/core/libraries/Errors.sol"; -import { LockupLinear_Integration_Shared_Test } from "../LockupLinear.t.sol"; +import { Lockup_Linear_Integration_Shared_Test } from "../LockupLinear.t.sol"; -contract GetCliffTime_LockupLinear_Integration_Concrete_Test is LockupLinear_Integration_Shared_Test { +contract GetCliffTime_LockupLinear_Integration_Concrete_Test is Lockup_Linear_Integration_Shared_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); - lockupLinear.getCliffTime(nullStreamId); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); + lockup.getCliffTime(nullStreamId); } - function test_GivenNotNull() external { - uint256 streamId = createDefaultStream(); - uint40 actualCliffTime = lockupLinear.getCliffTime(streamId); + function test_GivenNotNull() external view { + uint40 actualCliffTime = lockup.getCliffTime(defaultStreamId); uint40 expectedCliffTime = defaults.CLIFF_TIME(); assertEq(actualCliffTime, expectedCliffTime, "cliffTime"); } diff --git a/test/core/integration/concrete/lockup-linear/get-stream/getStream.t.sol b/test/core/integration/concrete/lockup-linear/get-stream/getStream.t.sol deleted file mode 100644 index 9bc468e76..000000000 --- a/test/core/integration/concrete/lockup-linear/get-stream/getStream.t.sol +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.8.22 <0.9.0; - -import { Errors } from "src/core/libraries/Errors.sol"; -import { LockupLinear } from "src/core/types/DataTypes.sol"; - -import { LockupLinear_Integration_Shared_Test } from "../LockupLinear.t.sol"; - -contract GetStream_LockupLinear_Integration_Concrete_Test is LockupLinear_Integration_Shared_Test { - function test_RevertGiven_Null() external { - uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); - lockupLinear.getStream(nullStreamId); - } - - function test_GivenSettledStream() external givenNotNull { - vm.warp({ newTimestamp: defaults.END_TIME() }); - - // It should return the stream struct. - LockupLinear.StreamLL memory actualStream = lockupLinear.getStream(defaultStreamId); - LockupLinear.StreamLL memory expectedStream = defaults.lockupLinearStream(); - // It should always return stream as non-cancelable. - expectedStream.isCancelable = false; - assertEq(actualStream, expectedStream); - } - - function test_GivenNotSettledStream() external givenNotNull { - // It should return the stream struct. - LockupLinear.StreamLL memory actualStream = lockupLinear.getStream(defaultStreamId); - LockupLinear.StreamLL memory expectedStream = defaults.lockupLinearStream(); - assertEq(actualStream, expectedStream); - } -} diff --git a/test/core/integration/concrete/lockup-linear/get-stream/getStream.tree b/test/core/integration/concrete/lockup-linear/get-stream/getStream.tree deleted file mode 100644 index e2f40df40..000000000 --- a/test/core/integration/concrete/lockup-linear/get-stream/getStream.tree +++ /dev/null @@ -1,9 +0,0 @@ -GetStream_LockupLinear_Integration_Concrete_Test -├── given null -│ └── it should revert -└── given not null - ├── given settled stream - │ ├── it should always return stream as non-cancelable - │ └── it should return the stream struct - └── given not settled stream - └── it should return the stream struct diff --git a/test/core/integration/concrete/lockup-linear/get-timestamps/getTimestamps.t.sol b/test/core/integration/concrete/lockup-linear/get-timestamps/getTimestamps.t.sol index 3eb8dc124..f55ecf9b7 100644 --- a/test/core/integration/concrete/lockup-linear/get-timestamps/getTimestamps.t.sol +++ b/test/core/integration/concrete/lockup-linear/get-timestamps/getTimestamps.t.sol @@ -2,21 +2,20 @@ pragma solidity >=0.8.22 <0.9.0; import { Errors } from "src/core/libraries/Errors.sol"; -import { LockupLinear } from "src/core/types/DataTypes.sol"; +import { Lockup } from "src/core/types/DataTypes.sol"; -import { LockupLinear_Integration_Shared_Test } from "../LockupLinear.t.sol"; +import { Lockup_Linear_Integration_Shared_Test } from "../LockupLinear.t.sol"; -contract GetTimestamps_LockupLinear_Integration_Concrete_Test is LockupLinear_Integration_Shared_Test { +contract GetTimestamps_LockupLinear_Integration_Concrete_Test is Lockup_Linear_Integration_Shared_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); - lockupLinear.getTimestamps(nullStreamId); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); + lockup.getTimestamps(nullStreamId); } function test_GivenNotNull() external { - uint256 streamId = createDefaultStream(); - LockupLinear.Timestamps memory actualTimestamps = lockupLinear.getTimestamps(streamId); - LockupLinear.Timestamps memory expectedTimestamps = defaults.lockupLinearTimestamps(); + Lockup.Timestamps memory actualTimestamps = lockup.getTimestamps(defaultStreamId); + Lockup.Timestamps memory expectedTimestamps = defaults.lockupLinearTimestamps(); assertEq(actualTimestamps, expectedTimestamps); } } diff --git a/test/core/integration/concrete/lockup-linear/streamed-amount-of/streamedAmountOf.t.sol b/test/core/integration/concrete/lockup-linear/streamed-amount-of/streamedAmountOf.t.sol index 9a35c7a57..61e947f5f 100644 --- a/test/core/integration/concrete/lockup-linear/streamed-amount-of/streamedAmountOf.t.sol +++ b/test/core/integration/concrete/lockup-linear/streamed-amount-of/streamedAmountOf.t.sol @@ -1,26 +1,26 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.22 <0.9.0; -import { LockupLinear } from "src/core/types/DataTypes.sol"; -import { StreamedAmountOf_Integration_Concrete_Test } from "./../../lockup/streamed-amount-of/streamedAmountOf.t.sol"; -import { LockupLinear_Integration_Shared_Test, Integration_Test } from "./../LockupLinear.t.sol"; +import { Lockup } from "src/core/types/DataTypes.sol"; +import { StreamedAmountOf_Integration_Concrete_Test } from + "./../../lockup-base/streamed-amount-of/streamedAmountOf.t.sol"; +import { Lockup_Linear_Integration_Shared_Test, Integration_Test } from "./../LockupLinear.t.sol"; contract StreamedAmountOf_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, StreamedAmountOf_Integration_Concrete_Test { - function setUp() public override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } function test_GivenCliffTimeZero() external givenPENDINGStatus { vm.warp({ newTimestamp: defaults.START_TIME() - 1 }); - - LockupLinear.Timestamps memory timestamps = defaults.lockupLinearTimestamps(); + Lockup.Timestamps memory timestamps = defaults.lockupLinearTimestamps(); timestamps.cliff = 0; - uint256 streamId = createDefaultStreamWithTimestamps(timestamps); + uint256 streamId = createDefaultStreamWithTimestampsLL(timestamps); - uint128 actualStreamedAmount = lockupLinear.streamedAmountOf(streamId); + uint128 actualStreamedAmount = lockup.streamedAmountOf(streamId); uint128 expectedStreamedAmount = 0; assertEq(actualStreamedAmount, expectedStreamedAmount, "streamedAmount"); } @@ -28,38 +28,38 @@ contract StreamedAmountOf_LockupLinear_Integration_Concrete_Test is function test_GivenCliffTimeNotZero() external givenPENDINGStatus { vm.warp({ newTimestamp: defaults.START_TIME() - 1 }); - LockupLinear.Timestamps memory timestamps = defaults.lockupLinearTimestamps(); + Lockup.Timestamps memory timestamps = defaults.lockupLinearTimestamps(); timestamps.cliff = defaults.CLIFF_TIME(); - uint256 streamId = createDefaultStreamWithTimestamps(timestamps); + uint256 streamId = createDefaultStreamWithTimestampsLL(timestamps); - uint128 actualStreamedAmount = lockupLinear.streamedAmountOf(streamId); + uint128 actualStreamedAmount = lockup.streamedAmountOf(streamId); uint128 expectedStreamedAmount = 0; assertEq(actualStreamedAmount, expectedStreamedAmount, "streamedAmount"); } function test_GivenCliffTimeInFuture() external givenSTREAMINGStatus { vm.warp({ newTimestamp: defaults.CLIFF_TIME() - 1 }); - uint128 actualStreamedAmount = lockupLinear.streamedAmountOf(defaultStreamId); + uint128 actualStreamedAmount = lockup.streamedAmountOf(defaultStreamId); uint128 expectedStreamedAmount = 0; assertEq(actualStreamedAmount, expectedStreamedAmount, "streamedAmount"); } function test_GivenCliffTimeInPresent() external givenSTREAMINGStatus { vm.warp({ newTimestamp: defaults.CLIFF_TIME() }); - uint128 actualStreamedAmount = lockupLinear.streamedAmountOf(defaultStreamId); + uint128 actualStreamedAmount = lockup.streamedAmountOf(defaultStreamId); uint128 expectedStreamedAmount = defaults.CLIFF_AMOUNT(); assertEq(actualStreamedAmount, expectedStreamedAmount, "streamedAmount"); } function test_GivenEndTimeNotInFuture() external givenSTREAMINGStatus givenCliffTimeInPast { vm.warp({ newTimestamp: defaults.END_TIME() + 1 }); - uint128 actualStreamedAmount = lockupLinear.streamedAmountOf(defaultStreamId); + uint128 actualStreamedAmount = lockup.streamedAmountOf(defaultStreamId); uint128 expectedStreamedAmount = defaults.DEPOSIT_AMOUNT(); assertEq(actualStreamedAmount, expectedStreamedAmount, "streamedAmount"); } function test_GivenEndTimeInFuture() external givenSTREAMINGStatus givenCliffTimeInPast { - uint128 actualStreamedAmount = lockupLinear.streamedAmountOf(defaultStreamId); + uint128 actualStreamedAmount = lockup.streamedAmountOf(defaultStreamId); uint128 expectedStreamedAmount = 2600e18; assertEq(actualStreamedAmount, expectedStreamedAmount, "streamedAmount"); } diff --git a/test/core/integration/concrete/lockup-linear/token-uri/tokenURI.t.sol b/test/core/integration/concrete/lockup-linear/token-uri/tokenURI.t.sol index 9e08b54d9..ef3fb5ba3 100644 --- a/test/core/integration/concrete/lockup-linear/token-uri/tokenURI.t.sol +++ b/test/core/integration/concrete/lockup-linear/token-uri/tokenURI.t.sol @@ -7,7 +7,7 @@ import { console2 } from "forge-std/src/console2.sol"; import { StdStyle } from "forge-std/src/StdStyle.sol"; import { Base64 } from "solady/src/utils/Base64.sol"; -import { LockupLinear_Integration_Shared_Test } from "../LockupLinear.t.sol"; +import { Lockup_Linear_Integration_Shared_Test } from "../LockupLinear.t.sol"; /// @dev Requirements for these tests to work: /// - The stream ID must be 1 @@ -16,12 +16,12 @@ import { LockupLinear_Integration_Shared_Test } from "../LockupLinear.t.sol"; /// - The contract deployer, i.e. the `sender` config option in `foundry.toml`, must have the default value /// 0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38 so that the deployed contracts have the same addresses as /// the values hard coded in the tests below -contract TokenURI_LockupLinear_Integration_Concrete_Test is LockupLinear_Integration_Shared_Test { - address internal constant LOCKUP_LINEAR = 0x3381cD18e2Fb4dB236BF0525938AB6E43Db0440f; +contract TokenURI_LockupLinear_Integration_Concrete_Test is Lockup_Linear_Integration_Shared_Test { + address internal constant LOCKUP = 0x3381cD18e2Fb4dB236BF0525938AB6E43Db0440f; /// @dev To make these tests noninvasive, they are run only when the contract address matches the hard coded value. modifier skipOnMismatch() { - if (address(lockupLinear) == LOCKUP_LINEAR) { + if (address(lockup) == LOCKUP) { _; } else { console2.log(StdStyle.yellow('Warning: "LockupLinear.tokenURI" tests skipped due to address mismatch')); @@ -31,7 +31,7 @@ contract TokenURI_LockupLinear_Integration_Concrete_Test is LockupLinear_Integra function test_RevertGiven_NFTNotExist() external { uint256 nullStreamId = 1729; vm.expectRevert(abi.encodeWithSelector(IERC721Errors.ERC721NonexistentToken.selector, nullStreamId)); - lockupLinear.tokenURI({ tokenId: nullStreamId }); + lockup.tokenURI({ tokenId: nullStreamId }); } /// @dev If you need to update the hard-coded token URI: @@ -40,7 +40,7 @@ contract TokenURI_LockupLinear_Integration_Concrete_Test is LockupLinear_Integra function test_WhenTokenURIDecoded() external skipOnMismatch givenNFTExists { vm.warp({ newTimestamp: defaults.START_TIME() + defaults.TOTAL_DURATION() / 4 }); - string memory tokenURI = lockupLinear.tokenURI(defaultStreamId); + string memory tokenURI = lockup.tokenURI(defaultStreamId); tokenURI = vm.replace({ input: tokenURI, from: "data:application/json;base64,", to: "" }); string memory actualDecodedTokenURI = string(Base64.decode(tokenURI)); string memory expectedDecodedTokenURI = @@ -51,7 +51,7 @@ contract TokenURI_LockupLinear_Integration_Concrete_Test is LockupLinear_Integra function test_WhenTokenURINotDecoded() external skipOnMismatch givenNFTExists { vm.warp({ newTimestamp: defaults.START_TIME() + defaults.TOTAL_DURATION() / 4 }); - string memory actualTokenURI = lockupLinear.tokenURI(defaultStreamId); + string memory actualTokenURI = lockup.tokenURI(defaultStreamId); string memory expectedTokenURI = "data:application/json;base64,eyJhdHRyaWJ1dGVzIjpbeyJ0cmFpdF90eXBlIjoiQXNzZXQiLCJ2YWx1ZSI6IkRBSSJ9LHsidHJhaXRfdHlwZSI6IlNlbmRlciIsInZhbHVlIjoiMHg2MzMyZTdiMWRlYjFmMWEwYjc3YjJiYjE4YjE0NDMzMGM3MjkxYmNhIn0seyJ0cmFpdF90eXBlIjoiU3RhdHVzIiwidmFsdWUiOiJTdHJlYW1pbmcifV0sImRlc2NyaXB0aW9uIjoiVGhpcyBORlQgcmVwcmVzZW50cyBhIHBheW1lbnQgc3RyZWFtIGluIGEgU2FibGllciBWMiBMb2NrdXAgTGluZWFyIGNvbnRyYWN0LiBUaGUgb3duZXIgb2YgdGhpcyBORlQgY2FuIHdpdGhkcmF3IHRoZSBzdHJlYW1lZCBhc3NldHMsIHdoaWNoIGFyZSBkZW5vbWluYXRlZCBpbiBEQUkuXG5cbi0gU3RyZWFtIElEOiAxXG4tIExvY2t1cCBMaW5lYXIgQWRkcmVzczogMHgzMzgxY2QxOGUyZmI0ZGIyMzZiZjA1MjU5MzhhYjZlNDNkYjA0NDBmXG4tIERBSSBBZGRyZXNzOiAweDAzYTZhODRjZDc2MmQ5NzA3YTIxNjA1YjU0OGFhYWI4OTE1NjJhYWJcblxu4pqg77iPIFdBUk5JTkc6IFRyYW5zZmVycmluZyB0aGUgTkZUIG1ha2VzIHRoZSBuZXcgb3duZXIgdGhlIHJlY2lwaWVudCBvZiB0aGUgc3RyZWFtLiBUaGUgZnVuZHMgYXJlIG5vd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VFl5WVdGaUlPS0FvaUJFUVVrOEwzUmxlSFJRWVhSb1Bqd3ZkR1Y0ZEQ0OGRYTmxJR2h5WldZOUlpTkhiRzkzSWlCbWFXeHNMVzl3WVdOcGRIazlJaTQ1SWk4K1BIVnpaU0JvY21WbVBTSWpSMnh2ZHlJZ2VEMGlNVEF3TUNJZ2VUMGlNVEF3TUNJZ1ptbHNiQzF2Y0dGamFYUjVQU0l1T1NJdlBqeDFjMlVnYUhKbFpqMGlJMHh2WjI4aUlIZzlJakUzTUNJZ2VUMGlNVGN3SWlCMGNtRnVjMlp2Y20wOUluTmpZV3hsS0M0MktTSXZQangxYzJVZ2FISmxaajBpSTBodmRYSm5iR0Z6Y3lJZ2VEMGlNVFV3SWlCNVBTSTVNQ0lnZEhKaGJuTm1iM0p0UFNKeWIzUmhkR1VvTVRBcElpQjBjbUZ1YzJadmNtMHRiM0pwWjJsdVBTSTFNREFnTlRBd0lpOCtQSFZ6WlNCb2NtVm1QU0lqVUhKdlozSmxjM01pSUhnOUlqRTBOQ0lnZVQwaU56a3dJaTgrUEhWelpTQm9jbVZtUFNJalUzUmhkSFZ6SWlCNFBTSXpOamdpSUhrOUlqYzVNQ0l2UGp4MWMyVWdhSEpsWmowaUkwRnRiM1Z1ZENJZ2VEMGlOVFk0SWlCNVBTSTNPVEFpTHo0OGRYTmxJR2h5WldZOUlpTkVkWEpoZEdsdmJpSWdlRDBpTnpBMElpQjVQU0kzT1RBaUx6NDhMM04yWno0PSJ9"; assertEq(actualTokenURI, expectedTokenURI, "token URI"); diff --git a/test/core/integration/concrete/lockup-linear/withdrawable-amount-of/withdrawableAmountOf.t.sol b/test/core/integration/concrete/lockup-linear/withdrawable-amount-of/withdrawableAmountOf.t.sol index 5d4bd2bd9..01841209d 100644 --- a/test/core/integration/concrete/lockup-linear/withdrawable-amount-of/withdrawableAmountOf.t.sol +++ b/test/core/integration/concrete/lockup-linear/withdrawable-amount-of/withdrawableAmountOf.t.sol @@ -2,34 +2,34 @@ pragma solidity >=0.8.22 <0.9.0; import { WithdrawableAmountOf_Integration_Concrete_Test } from - "./../../lockup/withdrawable-amount-of/withdrawableAmountOf.t.sol"; -import { LockupLinear_Integration_Shared_Test, Integration_Test } from "./../LockupLinear.t.sol"; + "./../../lockup-base/withdrawable-amount-of/withdrawableAmountOf.t.sol"; +import { Lockup_Linear_Integration_Shared_Test, Integration_Test } from "./../LockupLinear.t.sol"; contract WithdrawableAmountOf_LockupLinear_Integration_Concrete_Test is - LockupLinear_Integration_Shared_Test, + Lockup_Linear_Integration_Shared_Test, WithdrawableAmountOf_Integration_Concrete_Test { - function setUp() public virtual override(LockupLinear_Integration_Shared_Test, Integration_Test) { - LockupLinear_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Linear_Integration_Shared_Test, Integration_Test) { + Lockup_Linear_Integration_Shared_Test.setUp(); } function test_GivenCliffTimeInFuture() external givenSTREAMINGStatus { vm.warp({ newTimestamp: defaults.CLIFF_TIME() - 1 }); - uint128 actualWithdrawableAmount = lockupLinear.withdrawableAmountOf(defaultStreamId); + uint128 actualWithdrawableAmount = lockup.withdrawableAmountOf(defaultStreamId); uint128 expectedWithdrawableAmount = 0; assertEq(actualWithdrawableAmount, expectedWithdrawableAmount, "withdrawableAmount"); } function test_GivenNoPreviousWithdrawals() external givenSTREAMINGStatus givenCliffTimeNotInFuture { - uint128 actualWithdrawableAmount = lockupLinear.withdrawableAmountOf(defaultStreamId); + uint128 actualWithdrawableAmount = lockup.withdrawableAmountOf(defaultStreamId); uint128 expectedWithdrawableAmount = defaults.WITHDRAW_AMOUNT(); assertEq(actualWithdrawableAmount, expectedWithdrawableAmount, "withdrawableAmount"); } function test_GivenPreviousWithdrawal() external givenSTREAMINGStatus givenCliffTimeNotInFuture { - lockupLinear.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: defaults.WITHDRAW_AMOUNT() }); + lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: defaults.WITHDRAW_AMOUNT() }); - uint128 actualWithdrawableAmount = lockupLinear.withdrawableAmountOf(defaultStreamId); + uint128 actualWithdrawableAmount = lockup.withdrawableAmountOf(defaultStreamId); uint128 expectedWithdrawableAmount = 0; assertEq(actualWithdrawableAmount, expectedWithdrawableAmount, "withdrawableAmount"); } diff --git a/test/core/integration/concrete/lockup-tranched/LockupTranched.t.sol b/test/core/integration/concrete/lockup-tranched/LockupTranched.t.sol index 5e71142de..8efdae194 100644 --- a/test/core/integration/concrete/lockup-tranched/LockupTranched.t.sol +++ b/test/core/integration/concrete/lockup-tranched/LockupTranched.t.sol @@ -2,339 +2,387 @@ pragma solidity >=0.8.22 <0.9.0; import { Integration_Test } from "./../../Integration.t.sol"; -import { LockupTranched_Integration_Shared_Test } from "./../../shared/lockup-tranched/LockupTranched.t.sol"; -import { AllowToHook_Integration_Concrete_Test } from "./../lockup/allow-to-hook/allowToHook.t.sol"; -import { Batch_Integration_Concrete_Test } from "./../lockup/batch/batch.t.sol"; -import { Burn_Integration_Concrete_Test } from "./../lockup/burn/burn.t.sol"; -import { CancelMultiple_Integration_Concrete_Test } from "./../lockup/cancel-multiple/cancelMultiple.t.sol"; -import { Cancel_Integration_Concrete_Test } from "./../lockup/cancel/cancel.t.sol"; -import { GetAsset_Integration_Concrete_Test } from "./../lockup/get-asset/getAsset.t.sol"; -import { GetDepositedAmount_Integration_Concrete_Test } from "./../lockup/get-deposited-amount/getDepositedAmount.t.sol"; -import { GetEndTime_Integration_Concrete_Test } from "./../lockup/get-end-time/getEndTime.t.sol"; -import { GetRecipient_Integration_Concrete_Test } from "./../lockup/get-recipient/getRecipient.t.sol"; -import { GetRefundedAmount_Integration_Concrete_Test } from "./../lockup/get-refunded-amount/getRefundedAmount.t.sol"; -import { GetSender_Integration_Concrete_Test } from "./../lockup/get-sender/getSender.t.sol"; -import { GetStartTime_Integration_Concrete_Test } from "./../lockup/get-start-time/getStartTime.t.sol"; -import { GetWithdrawnAmount_Integration_Concrete_Test } from "./../lockup/get-withdrawn-amount/getWithdrawnAmount.t.sol"; -import { IsAllowedToHook_Integration_Concrete_Test } from "./../lockup/is-allowed-to-hook/isAllowedToHook.t.sol"; -import { IsCancelable_Integration_Concrete_Test } from "./../lockup/is-cancelable/isCancelable.t.sol"; -import { IsCold_Integration_Concrete_Test } from "./../lockup/is-cold/isCold.t.sol"; -import { IsDepleted_Integration_Concrete_Test } from "./../lockup/is-depleted/isDepleted.t.sol"; -import { IsStream_Integration_Concrete_Test } from "./../lockup/is-stream/isStream.t.sol"; -import { IsTransferable_Integration_Concrete_Test } from "./../lockup/is-transferable/isTransferable.t.sol"; -import { IsWarm_Integration_Concrete_Test } from "./../lockup/is-warm/isWarm.t.sol"; -import { RefundableAmountOf_Integration_Concrete_Test } from "./../lockup/refundable-amount-of/refundableAmountOf.t.sol"; -import { Renounce_Integration_Concrete_Test } from "./../lockup/renounce/renounce.t.sol"; -import { SetNFTDescriptor_Integration_Concrete_Test } from "./../lockup/set-nft-descriptor/setNFTDescriptor.t.sol"; -import { StatusOf_Integration_Concrete_Test } from "./../lockup/status-of/statusOf.t.sol"; -import { TransferFrom_Integration_Concrete_Test } from "./../lockup/transfer-from/transferFrom.t.sol"; -import { WasCanceled_Integration_Concrete_Test } from "./../lockup/was-canceled/wasCanceled.t.sol"; -import { WithdrawHooks_Integration_Concrete_Test } from "./../lockup/withdraw-hooks/withdrawHooks.t.sol"; +import { Lockup_Create_Integration_Shared_Test } from "./../../shared/lockup/Lockup.t.sol"; +import { AllowToHook_Integration_Concrete_Test } from "./../lockup-base/allow-to-hook/allowToHook.t.sol"; +import { Batch_Integration_Concrete_Test } from "./../lockup-base/batch/batch.t.sol"; +import { Burn_Integration_Concrete_Test } from "./../lockup-base/burn/burn.t.sol"; +import { CancelMultiple_Integration_Concrete_Test } from "./../lockup-base/cancel-multiple/cancelMultiple.t.sol"; +import { Cancel_Integration_Concrete_Test } from "./../lockup-base/cancel/cancel.t.sol"; +import { GetAsset_Integration_Concrete_Test } from "./../lockup-base/get-asset/getAsset.t.sol"; +import { GetDepositedAmount_Integration_Concrete_Test } from + "./../lockup-base/get-deposited-amount/getDepositedAmount.t.sol"; +import { GetEndTime_Integration_Concrete_Test } from "./../lockup-base/get-end-time/getEndTime.t.sol"; +import { GetRecipient_Integration_Concrete_Test } from "./../lockup-base/get-recipient/getRecipient.t.sol"; +import { GetRefundedAmount_Integration_Concrete_Test } from + "./../lockup-base/get-refunded-amount/getRefundedAmount.t.sol"; +import { GetSender_Integration_Concrete_Test } from "./../lockup-base/get-sender/getSender.t.sol"; +import { GetStartTime_Integration_Concrete_Test } from "./../lockup-base/get-start-time/getStartTime.t.sol"; +import { GetWithdrawnAmount_Integration_Concrete_Test } from + "./../lockup-base/get-withdrawn-amount/getWithdrawnAmount.t.sol"; +import { IsAllowedToHook_Integration_Concrete_Test } from "./../lockup-base/is-allowed-to-hook/isAllowedToHook.t.sol"; +import { IsCancelable_Integration_Concrete_Test } from "./../lockup-base/is-cancelable/isCancelable.t.sol"; +import { IsCold_Integration_Concrete_Test } from "./../lockup-base/is-cold/isCold.t.sol"; +import { IsDepleted_Integration_Concrete_Test } from "./../lockup-base/is-depleted/isDepleted.t.sol"; +import { IsStream_Integration_Concrete_Test } from "./../lockup-base/is-stream/isStream.t.sol"; +import { IsTransferable_Integration_Concrete_Test } from "./../lockup-base/is-transferable/isTransferable.t.sol"; +import { IsWarm_Integration_Concrete_Test } from "./../lockup-base/is-warm/isWarm.t.sol"; +import { RefundableAmountOf_Integration_Concrete_Test } from + "./../lockup-base/refundable-amount-of/refundableAmountOf.t.sol"; +import { Renounce_Integration_Concrete_Test } from "./../lockup-base/renounce/renounce.t.sol"; +import { SetNFTDescriptor_Integration_Concrete_Test } from "./../lockup-base/set-nft-descriptor/setNFTDescriptor.t.sol"; +import { StatusOf_Integration_Concrete_Test } from "./../lockup-base/status-of/statusOf.t.sol"; +import { TransferFrom_Integration_Concrete_Test } from "./../lockup-base/transfer-from/transferFrom.t.sol"; +import { WasCanceled_Integration_Concrete_Test } from "./../lockup-base/was-canceled/wasCanceled.t.sol"; +import { WithdrawHooks_Integration_Concrete_Test } from "./../lockup-base/withdraw-hooks/withdrawHooks.t.sol"; import { WithdrawMaxAndTransfer_Integration_Concrete_Test } from - "./../lockup/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol"; -import { WithdrawMax_Integration_Concrete_Test } from "./../lockup/withdraw-max/withdrawMax.t.sol"; -import { WithdrawMultiple_Integration_Concrete_Test } from "./../lockup/withdraw-multiple/withdrawMultiple.t.sol"; -import { Withdraw_Integration_Concrete_Test } from "./../lockup/withdraw/withdraw.t.sol"; - + "./../lockup-base/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol"; +import { WithdrawMax_Integration_Concrete_Test } from "./../lockup-base/withdraw-max/withdrawMax.t.sol"; +import { WithdrawMultiple_Integration_Concrete_Test } from "./../lockup-base/withdraw-multiple/withdrawMultiple.t.sol"; +import { Withdraw_Integration_Concrete_Test } from "./../lockup-base/withdraw/withdraw.t.sol"; + +abstract contract Lockup_Tranched_Integration_Shared_Test is Lockup_Create_Integration_Shared_Test { + function setUp() public virtual override { + Lockup_Create_Integration_Shared_Test.setUp(); + + // Initialize streams IDs. + defaultStreamId = createDefaultStreamLT(); + differentSenderRecipientStreamId = + createDefaultStreamWithUsersLT({ recipient: address(recipientGood), sender: users.sender }); + earlyEndtimeStreamId = createDefaultStreamWithEndTimeLT({ endTime: defaults.CLIFF_TIME() + 1 seconds }); + identicalSenderRecipientStreamId = createDefaultStreamWithIdenticalUsersLT(users.sender); + notCancelableStreamId = createDefaultStreamNotCancelableLT(); + notTransferableStreamId = createDefaultStreamNotTransferableLT(); + recipientContractStreamId = createDefaultStreamWithRecipientLT(address(recipientGood)); + recipientInvalidSelectorStreamId = createDefaultStreamWithRecipientLT(address(recipientInvalidSelector)); + recipientReentrantStreamId = createDefaultStreamWithRecipientLT(address(recipientReentrant)); + recipientRevertStreamId = createDefaultStreamWithRecipientLT(address(recipientReverting)); + } +} /*////////////////////////////////////////////////////////////////////////// SHARED TESTS //////////////////////////////////////////////////////////////////////////*/ contract AllowToHook_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, AllowToHook_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract Batch_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, Batch_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract Burn_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, Burn_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract Cancel_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, Cancel_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract CancelMultiple_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, CancelMultiple_Integration_Concrete_Test { - function setUp() - public - virtual - override(LockupTranched_Integration_Shared_Test, CancelMultiple_Integration_Concrete_Test) - { - LockupTranched_Integration_Shared_Test.setUp(); - CancelMultiple_Integration_Concrete_Test.setUp(); + modifier whenCallerAuthorizedForAll() override { + _; + cancelMultipleStreamIds = WarpAndCreateStreamsForCancelMultipleLT({ warpTime: originalTime }); + _; + } + + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); + + originalTime = getBlockTimestamp(); + cancelMultipleStreamIds = WarpAndCreateStreamsForCancelMultipleLT({ warpTime: originalTime }); } } contract GetAsset_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, GetAsset_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract GetDepositedAmount_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, GetDepositedAmount_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract GetEndTime_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, GetEndTime_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract GetRecipient_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, GetRecipient_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract GetRefundedAmount_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, GetRefundedAmount_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract GetSender_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, GetSender_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract GetStartTime_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, GetStartTime_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract GetWithdrawnAmount_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, GetWithdrawnAmount_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract IsAllowedToHook_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, IsAllowedToHook_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract IsCancelable_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, IsCancelable_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract IsCold_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, IsCold_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract IsDepleted_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, IsDepleted_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract IsStream_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, IsStream_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract IsTransferable_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, IsTransferable_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract IsWarm_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, IsWarm_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract RefundableAmountOf_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, RefundableAmountOf_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract Renounce_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, Renounce_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract SetNFTDescriptor_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, SetNFTDescriptor_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract StatusOf_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, StatusOf_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract TransferFrom_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, TransferFrom_Integration_Concrete_Test { function setUp() public virtual - override(LockupTranched_Integration_Shared_Test, TransferFrom_Integration_Concrete_Test) + override(Lockup_Tranched_Integration_Shared_Test, TransferFrom_Integration_Concrete_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + Lockup_Tranched_Integration_Shared_Test.setUp(); TransferFrom_Integration_Concrete_Test.setUp(); } } contract WasCanceled_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, WasCanceled_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract Withdraw_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, Withdraw_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract WithdrawHooks_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, WithdrawHooks_Integration_Concrete_Test { function setUp() public virtual - override(LockupTranched_Integration_Shared_Test, WithdrawHooks_Integration_Concrete_Test) + override(Lockup_Tranched_Integration_Shared_Test, WithdrawHooks_Integration_Concrete_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + Lockup_Tranched_Integration_Shared_Test.setUp(); WithdrawHooks_Integration_Concrete_Test.setUp(); } } contract WithdrawMax_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, WithdrawMax_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract WithdrawMaxAndTransfer_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, WithdrawMaxAndTransfer_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } } contract WithdrawMultiple_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, WithdrawMultiple_Integration_Concrete_Test { - function setUp() - public - virtual - override(LockupTranched_Integration_Shared_Test, WithdrawMultiple_Integration_Concrete_Test) - { - LockupTranched_Integration_Shared_Test.setUp(); - WithdrawMultiple_Integration_Concrete_Test.setUp(); + /// @dev This modifier runs the test in three different modes: + /// - Stream's sender as caller + /// - Stream's recipient as caller + /// - Approved NFT operator as caller + modifier whenCallerAuthorizedAllStreams() override { + caller = users.sender; + _; + + WarpAndCreateStreamsWithdrawMultipleLT({ warpTime: originalTime }); + caller = users.recipient; + _; + + WarpAndCreateStreamsWithdrawMultipleLT({ warpTime: originalTime }); + caller = users.operator; + _; + } + + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); + + originalTime = getBlockTimestamp(); + + // Define the default amounts. + testAmounts = new uint128[](3); + testAmounts[0] = defaults.WITHDRAW_AMOUNT(); + testAmounts[1] = defaults.DEPOSIT_AMOUNT(); + testAmounts[2] = defaults.WITHDRAW_AMOUNT() / 2; + + withdrawMultipleStreamIds = WarpAndCreateStreamsWithdrawMultipleLT({ warpTime: originalTime }); } } diff --git a/test/core/integration/concrete/lockup-tranched/constructor.t.sol b/test/core/integration/concrete/lockup-tranched/constructor.t.sol deleted file mode 100644 index 25f87935e..000000000 --- a/test/core/integration/concrete/lockup-tranched/constructor.t.sol +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.8.22 <0.9.0; - -import { UD60x18 } from "@prb/math/src/UD60x18.sol"; - -import { IAdminable } from "src/core/interfaces/IAdminable.sol"; -import { SablierLockupTranched } from "src/core/SablierLockupTranched.sol"; - -import { LockupTranched_Integration_Shared_Test } from "./LockupTranched.t.sol"; - -contract Constructor_LockupTranched_Integration_Concrete_Test is LockupTranched_Integration_Shared_Test { - function test_Constructor() external { - // Expect the relevant event to be emitted. - vm.expectEmit(); - emit IAdminable.TransferAdmin({ oldAdmin: address(0), newAdmin: users.admin }); - - // Construct the contract. - SablierLockupTranched constructedLockupTranched = new SablierLockupTranched({ - initialAdmin: users.admin, - initialNFTDescriptor: nftDescriptor, - maxTrancheCount: defaults.MAX_TRANCHE_COUNT() - }); - - // {SablierLockup.constant} - UD60x18 actualMaxBrokerFee = constructedLockupTranched.MAX_BROKER_FEE(); - UD60x18 expectedMaxBrokerFee = UD60x18.wrap(0.1e18); - assertEq(actualMaxBrokerFee, expectedMaxBrokerFee, "MAX_BROKER_FEE"); - - // {SablierLockup.constructor} - address actualAdmin = constructedLockupTranched.admin(); - address expectedAdmin = users.admin; - assertEq(actualAdmin, expectedAdmin, "admin"); - - uint256 actualStreamId = constructedLockupTranched.nextStreamId(); - uint256 expectedStreamId = 1; - assertEq(actualStreamId, expectedStreamId, "nextStreamId"); - - address actualNFTDescriptor = address(constructedLockupTranched.nftDescriptor()); - address expectedNFTDescriptor = address(nftDescriptor); - assertEq(actualNFTDescriptor, expectedNFTDescriptor, "nftDescriptor"); - - // {SablierLockup.supportsInterface} - assertTrue(constructedLockupTranched.supportsInterface(0x49064906), "ERC-4906 interface ID"); - - // {SablierLockupTranched.constructor} - uint256 actualMaxTrancheCount = constructedLockupTranched.MAX_TRANCHE_COUNT(); - uint256 expectedMaxTrancheCount = defaults.MAX_TRANCHE_COUNT(); - assertEq(actualMaxTrancheCount, expectedMaxTrancheCount, "MAX_TRANCHE_COUNT"); - } -} diff --git a/test/core/integration/concrete/lockup-tranched/create-with-durations/createWithDurations.t.sol b/test/core/integration/concrete/lockup-tranched/create-with-durations/createWithDurationsLT.t.sol similarity index 67% rename from test/core/integration/concrete/lockup-tranched/create-with-durations/createWithDurations.t.sol rename to test/core/integration/concrete/lockup-tranched/create-with-durations/createWithDurationsLT.t.sol index 706fee3a7..bc5742b56 100644 --- a/test/core/integration/concrete/lockup-tranched/create-with-durations/createWithDurations.t.sol +++ b/test/core/integration/concrete/lockup-tranched/create-with-durations/createWithDurationsLT.t.sol @@ -3,31 +3,32 @@ pragma solidity >=0.8.22 <0.9.0; import { IERC4906 } from "@openzeppelin/contracts/interfaces/IERC4906.sol"; -import { ISablierLockupTranched } from "src/core/interfaces/ISablierLockupTranched.sol"; +import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; import { Errors } from "src/core/libraries/Errors.sol"; import { Lockup, LockupTranched } from "src/core/types/DataTypes.sol"; -import { LockupTranched_Integration_Shared_Test } from "../LockupTranched.t.sol"; +import { Lockup_Tranched_Integration_Shared_Test } from "./../LockupTranched.t.sol"; -contract CreateWithDurations_LockupTranched_Integration_Concrete_Test is LockupTranched_Integration_Shared_Test { +contract CreateWithDurationsLT_Integration_Concrete_Test is Lockup_Tranched_Integration_Shared_Test { uint256 internal streamId; function setUp() public virtual override { - LockupTranched_Integration_Shared_Test.setUp(); - streamId = lockupTranched.nextStreamId(); + Lockup_Tranched_Integration_Shared_Test.setUp(); + streamId = lockup.nextStreamId(); } function test_RevertWhen_DelegateCall() external { - bytes memory callData = - abi.encodeCall(ISablierLockupTranched.createWithDurations, defaults.createWithDurationsLT()); - (bool success, bytes memory returnData) = address(lockupTranched).delegatecall(callData); + bytes memory callData = abi.encodeCall( + ISablierLockup.createWithDurationsLT, (defaults.createWithDurations(), defaults.tranchesWithDurations()) + ); + (bool success, bytes memory returnData) = address(lockup).delegatecall(callData); expectRevertDueToDelegateCall(success, returnData); } function test_RevertWhen_TrancheCountExceedsMaxValue() external whenNoDelegateCall { LockupTranched.TrancheWithDuration[] memory tranches = new LockupTranched.TrancheWithDuration[](25_000); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupTranched_TrancheCountTooHigh.selector, 25_000)); - createDefaultStreamWithDurations(tranches); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_TrancheCountTooHigh.selector, 25_000)); + createDefaultStreamWithDurationsLT(tranches); } function test_RevertWhen_FirstIndexHasZeroDuration() @@ -36,18 +37,18 @@ contract CreateWithDurations_LockupTranched_Integration_Concrete_Test is LockupT whenTrancheCountNotExceedMaxValue { uint40 startTime = getBlockTimestamp(); - LockupTranched.TrancheWithDuration[] memory tranches = defaults.createWithDurationsLT().tranches; + LockupTranched.TrancheWithDuration[] memory tranches = defaults.tranchesWithDurations(); tranches[2].duration = 0; uint256 index = 2; vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockupTranched_TrancheTimestampsNotOrdered.selector, + Errors.SablierLockup_TrancheTimestampsNotOrdered.selector, index, startTime + tranches[0].duration + tranches[1].duration, startTime + tranches[0].duration + tranches[1].duration ) ); - createDefaultStreamWithDurations(tranches); + createDefaultStreamWithDurationsLT(tranches); } function test_RevertWhen_StartTimeExceedsFirstTimestamp() @@ -63,12 +64,12 @@ contract CreateWithDurations_LockupTranched_Integration_Concrete_Test is LockupT tranches[0].duration = MAX_UINT40; vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockupTranched_StartTimeNotLessThanFirstTrancheTimestamp.selector, + Errors.SablierLockup_StartTimeNotLessThanFirstTrancheTimestamp.selector, startTime, startTime + tranches[0].duration ) ); - createDefaultStreamWithDurations(tranches); + createDefaultStreamWithDurationsLT(tranches); } } @@ -93,7 +94,7 @@ contract CreateWithDurations_LockupTranched_Integration_Concrete_Test is LockupT uint256 index = 1; vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockupTranched_TrancheTimestampsNotOrdered.selector, + Errors.SablierLockup_TrancheTimestampsNotOrdered.selector, index, startTime + tranches[0].duration, startTime + tranches[0].duration + tranches[1].duration @@ -101,7 +102,7 @@ contract CreateWithDurations_LockupTranched_Integration_Concrete_Test is LockupT ); // Create the stream. - createDefaultStreamWithDurations(tranches); + createDefaultStreamWithDurationsLT(tranches); } } @@ -116,8 +117,8 @@ contract CreateWithDurations_LockupTranched_Integration_Concrete_Test is LockupT // Declare the timestamps. uint40 blockTimestamp = getBlockTimestamp(); - LockupTranched.Timestamps memory timestamps = - LockupTranched.Timestamps({ start: blockTimestamp, end: blockTimestamp + defaults.TOTAL_DURATION() }); + Lockup.Timestamps memory timestamps = + Lockup.Timestamps({ start: blockTimestamp, cliff: 0, end: blockTimestamp + defaults.TOTAL_DURATION() }); LockupTranched.TrancheWithDuration[] memory tranchesWithDurations = defaults.tranchesWithDurations(); LockupTranched.Tranche[] memory tranches = defaults.tranches(); @@ -126,16 +127,16 @@ contract CreateWithDurations_LockupTranched_Integration_Concrete_Test is LockupT tranches[2].timestamp = tranches[1].timestamp + tranchesWithDurations[2].duration; // It should perform the ERC-20 transfers. - expectCallToTransferFrom({ from: funder, to: address(lockupTranched), value: defaults.DEPOSIT_AMOUNT() }); + expectCallToTransferFrom({ from: funder, to: address(lockup), value: defaults.DEPOSIT_AMOUNT() }); // Expect the broker fee to be paid to the broker. expectCallToTransferFrom({ from: funder, to: users.broker, value: defaults.BROKER_FEE_AMOUNT() }); // It should emit {MetadataUpdate} and {CreateLockupTranchedStream} events. - vm.expectEmit({ emitter: address(lockupTranched) }); + vm.expectEmit({ emitter: address(lockup) }); emit IERC4906.MetadataUpdate({ _tokenId: streamId }); - vm.expectEmit({ emitter: address(lockupTranched) }); - emit ISablierLockupTranched.CreateLockupTranchedStream({ + vm.expectEmit({ emitter: address(lockup) }); + emit ISablierLockup.CreateLockupTranchedStream({ streamId: streamId, funder: funder, sender: users.sender, @@ -150,28 +151,34 @@ contract CreateWithDurations_LockupTranched_Integration_Concrete_Test is LockupT }); // Create the stream. - createDefaultStreamWithDurations(); - - // It should create the stream. - LockupTranched.StreamLT memory actualStream = lockupTranched.getStream(streamId); - LockupTranched.StreamLT memory expectedStream = defaults.lockupTranchedStream(); - expectedStream.endTime = timestamps.end; - expectedStream.startTime = timestamps.start; - expectedStream.tranches = tranches; - assertEq(actualStream, expectedStream); + createDefaultStreamWithDurationsLT(); + + // Assert that the stream has been created. + assertEq(lockup.getDepositedAmount(streamId), defaults.DEPOSIT_AMOUNT(), "depositedAmount"); + assertEq(lockup.getAsset(streamId), dai, "asset"); + assertEq(lockup.getEndTime(streamId), timestamps.end, "endTime"); + assertEq(lockup.isCancelable(streamId), true, "isCancelable"); + assertEq(lockup.isDepleted(streamId), false, "isDepleted"); + assertEq(lockup.isStream(streamId), true, "isStream"); + assertEq(lockup.isTransferable(streamId), true, "isTransferable"); + assertEq(lockup.getRecipient(streamId), users.recipient, "recipient"); + assertEq(lockup.getSender(streamId), users.sender, "sender"); + assertEq(lockup.getStartTime(streamId), timestamps.start, "startTime"); + assertEq(lockup.wasCanceled(streamId), false, "wasCanceled"); + assertEq(lockup.getTranches(streamId), tranches, "tranches"); // Assert that the stream's status is "STREAMING". - Lockup.Status actualStatus = lockupTranched.statusOf(streamId); + Lockup.Status actualStatus = lockup.statusOf(streamId); Lockup.Status expectedStatus = Lockup.Status.STREAMING; assertEq(actualStatus, expectedStatus); // It should bump the next stream ID. - uint256 actualNextStreamId = lockupTranched.nextStreamId(); + uint256 actualNextStreamId = lockup.nextStreamId(); uint256 expectedNextStreamId = streamId + 1; assertEq(actualNextStreamId, expectedNextStreamId, "nextStreamId"); // It should mint the NFT. - address actualNFTOwner = lockupTranched.ownerOf({ tokenId: streamId }); + address actualNFTOwner = lockup.ownerOf({ tokenId: streamId }); address expectedNFTOwner = users.recipient; assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } diff --git a/test/core/integration/concrete/lockup-tranched/create-with-durations/createWithDurations.tree b/test/core/integration/concrete/lockup-tranched/create-with-durations/createWithDurationsLT.tree similarity index 94% rename from test/core/integration/concrete/lockup-tranched/create-with-durations/createWithDurations.tree rename to test/core/integration/concrete/lockup-tranched/create-with-durations/createWithDurationsLT.tree index 695948e74..375ee923e 100644 --- a/test/core/integration/concrete/lockup-tranched/create-with-durations/createWithDurations.tree +++ b/test/core/integration/concrete/lockup-tranched/create-with-durations/createWithDurationsLT.tree @@ -1,4 +1,4 @@ -CreateWithDurations_LockupTranched_Integration_Concrete_Test +CreateWithDurationsLT_Integration_Concrete_Test ├── when delegate call │ └── it should revert └── when no delegate call diff --git a/test/core/integration/concrete/lockup-tranched/create-with-timestamps/createWithTimestamps.t.sol b/test/core/integration/concrete/lockup-tranched/create-with-timestamps/createWithTimestampsLT.t.sol similarity index 76% rename from test/core/integration/concrete/lockup-tranched/create-with-timestamps/createWithTimestamps.t.sol rename to test/core/integration/concrete/lockup-tranched/create-with-timestamps/createWithTimestampsLT.t.sol index 28ad09d78..ad0ec2f15 100644 --- a/test/core/integration/concrete/lockup-tranched/create-with-timestamps/createWithTimestamps.t.sol +++ b/test/core/integration/concrete/lockup-tranched/create-with-timestamps/createWithTimestampsLT.t.sol @@ -7,35 +7,36 @@ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { Address } from "@openzeppelin/contracts/utils/Address.sol"; import { UD60x18, ud } from "@prb/math/src/UD60x18.sol"; import { stdError } from "forge-std/src/StdError.sol"; -import { ISablierLockupTranched } from "src/core/interfaces/ISablierLockupTranched.sol"; +import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; import { Errors } from "src/core/libraries/Errors.sol"; import { Broker, Lockup, LockupTranched } from "src/core/types/DataTypes.sol"; -import { LockupTranched_Integration_Shared_Test } from "./../LockupTranched.t.sol"; +import { Lockup_Tranched_Integration_Shared_Test } from "./../LockupTranched.t.sol"; -contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is LockupTranched_Integration_Shared_Test { +contract CreateWithTimestampsLT_Integration_Concrete_Test is Lockup_Tranched_Integration_Shared_Test { uint256 internal streamId; function setUp() public virtual override { - LockupTranched_Integration_Shared_Test.setUp(); - streamId = lockupTranched.nextStreamId(); + Lockup_Tranched_Integration_Shared_Test.setUp(); + streamId = lockup.nextStreamId(); } function test_RevertWhen_DelegateCall() external { - bytes memory callData = - abi.encodeCall(ISablierLockupTranched.createWithTimestamps, defaults.createWithTimestampsLT()); - (bool success, bytes memory returnData) = address(lockupTranched).delegatecall(callData); + bytes memory callData = abi.encodeCall( + ISablierLockup.createWithTimestampsLT, (defaults.createWithTimestamps(), defaults.tranches()) + ); + (bool success, bytes memory returnData) = address(lockup).delegatecall(callData); expectRevertDueToDelegateCall(success, returnData); } function test_RevertWhen_SenderZeroAddress() external whenNoDelegateCall { vm.expectRevert(Errors.SablierLockup_SenderZeroAddress.selector); - createDefaultStreamWithSender(address(0)); + createDefaultStreamWithSenderLT(address(0)); } function test_RevertWhen_RecipientZeroAddress() external whenNoDelegateCall whenSenderNotZeroAddress { address recipient = address(0); vm.expectRevert(abi.encodeWithSelector(IERC721Errors.ERC721InvalidReceiver.selector, recipient)); - createDefaultStreamWithRecipient(recipient); + createDefaultStreamWithRecipientLT(recipient); } function test_RevertWhen_DepositAmountZero() @@ -48,7 +49,7 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is Lockup // is hard coded to 10%. vm.expectRevert(Errors.SablierLockup_DepositAmountZero.selector); uint128 totalAmount = 0; - createDefaultStreamWithTotalAmount(totalAmount); + createDefaultStreamWithTotalAmountLT(totalAmount); } function test_RevertWhen_StartTimeZero() @@ -59,7 +60,7 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is Lockup whenDepositAmountNotZero { vm.expectRevert(Errors.SablierLockup_StartTimeZero.selector); - createDefaultStreamWithStartTime(0); + createDefaultStreamWithStartTimeLT(0); } function test_RevertWhen_TrancheCountZero() @@ -71,8 +72,8 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is Lockup whenStartTimeNotZero { LockupTranched.Tranche[] memory tranches; - vm.expectRevert(Errors.SablierLockupTranched_TrancheCountZero.selector); - createDefaultStreamWithTranches(tranches); + vm.expectRevert(Errors.SablierLockup_TrancheCountZero.selector); + createDefaultStreamWithTranchesLT(tranches); } function test_RevertWhen_TrancheCountExceedsMaxValue() @@ -84,10 +85,11 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is Lockup whenStartTimeNotZero whenTrancheCountNotZero { - uint256 trancheCount = defaults.MAX_TRANCHE_COUNT() + 1; + uint256 trancheCount = defaults.MAX_COUNT() + 1; LockupTranched.Tranche[] memory tranches = new LockupTranched.Tranche[](trancheCount); - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupTranched_TrancheCountTooHigh.selector, trancheCount)); - createDefaultStreamWithTranches(tranches); + tranches[trancheCount - 1].timestamp = defaults.END_TIME(); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_TrancheCountTooHigh.selector, trancheCount)); + createDefaultStreamWithTranchesLT(tranches); } function test_RevertWhen_TrancheAmountsSumOverflows() @@ -104,7 +106,7 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is Lockup tranches[0].amount = MAX_UINT128; tranches[1].amount = 1; vm.expectRevert(stdError.arithmeticError); - createDefaultStreamWithTranches(tranches); + createDefaultStreamWithTranchesLT(tranches); } function test_RevertWhen_StartTimeGreaterThanFirstTimestamp() @@ -125,14 +127,14 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is Lockup // Expect the relevant error to be thrown. vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockupTranched_StartTimeNotLessThanFirstTrancheTimestamp.selector, + Errors.SablierLockup_StartTimeNotLessThanFirstTrancheTimestamp.selector, defaults.START_TIME(), tranches[0].timestamp ) ); // Create the stream. - createDefaultStreamWithTranches(tranches); + createDefaultStreamWithTranchesLT(tranches); } function test_RevertWhen_StartTimeEqualsFirstTimestamp() @@ -153,14 +155,14 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is Lockup // Expect the relevant error to be thrown. vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockupTranched_StartTimeNotLessThanFirstTrancheTimestamp.selector, + Errors.SablierLockup_StartTimeNotLessThanFirstTrancheTimestamp.selector, defaults.START_TIME(), tranches[0].timestamp ) ); // Create the stream. - createDefaultStreamWithTranches(tranches); + createDefaultStreamWithTranchesLT(tranches); } function test_RevertWhen_TimestampsNotStrictlyIncreasing() @@ -183,7 +185,7 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is Lockup uint256 index = 1; vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockupTranched_TrancheTimestampsNotOrdered.selector, + Errors.SablierLockup_TrancheTimestampsNotOrdered.selector, index, tranches[0].timestamp, tranches[1].timestamp @@ -191,7 +193,7 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is Lockup ); // Create the stream. - createDefaultStreamWithTranches(tranches); + createDefaultStreamWithTranchesLT(tranches); } function test_RevertWhen_DepositAmountNotEqualTrancheAmountsSum() @@ -214,20 +216,22 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is Lockup uint128 depositAmount = defaultDepositAmount + 100; // Prepare the params. - LockupTranched.CreateWithTimestamps memory params = defaults.createWithTimestampsBrokerNullLT(); + Lockup.CreateWithTimestamps memory params = defaults.createWithTimestampsBrokerNull(); params.totalAmount = depositAmount; + LockupTranched.Tranche[] memory tranches = defaults.tranches(); + // Expect the relevant error to be thrown. vm.expectRevert( abi.encodeWithSelector( - Errors.SablierLockupTranched_DepositAmountNotEqualToTrancheAmountsSum.selector, + Errors.SablierLockup_DepositAmountNotEqualToTrancheAmountsSum.selector, depositAmount, defaultDepositAmount ) ); // Create the stream. - lockupTranched.createWithTimestamps(params); + lockup.createWithTimestampsLT(params, tranches); } function test_RevertWhen_BrokerFeeExceedsMaxValue() @@ -248,7 +252,7 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is Lockup vm.expectRevert( abi.encodeWithSelector(Errors.SablierLockup_BrokerFeeTooHigh.selector, brokerFee, MAX_BROKER_FEE) ); - createDefaultStreamWithBroker(Broker({ account: users.broker, fee: brokerFee })); + createDefaultStreamWithBrokerLT(Broker({ account: users.broker, fee: brokerFee })); } function test_RevertWhen_AssetNotContract() @@ -272,7 +276,7 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is Lockup // Run the test. vm.expectRevert(abi.encodeWithSelector(Address.AddressEmptyCode.selector, nonContract)); - createDefaultStreamWithAsset(IERC20(nonContract)); + createDefaultStreamWithAssetLT(IERC20(nonContract)); } function test_WhenAssetMissesERC20ReturnValue() @@ -322,7 +326,7 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is Lockup expectCallToTransferFrom({ asset: IERC20(asset), from: funder, - to: address(lockupTranched), + to: address(lockup), value: defaults.DEPOSIT_AMOUNT() }); @@ -335,10 +339,10 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is Lockup }); // It should emit {CreateLockupTranchedStream} and {MetadataUpdate} events. - vm.expectEmit({ emitter: address(lockupTranched) }); + vm.expectEmit({ emitter: address(lockup) }); emit IERC4906.MetadataUpdate({ _tokenId: streamId }); - vm.expectEmit({ emitter: address(lockupTranched) }); - emit ISablierLockupTranched.CreateLockupTranchedStream({ + vm.expectEmit({ emitter: address(lockup) }); + emit ISablierLockup.CreateLockupTranchedStream({ streamId: streamId, funder: funder, sender: users.sender, @@ -353,26 +357,34 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is Lockup }); // It should create the stream. - streamId = createDefaultStreamWithAsset(IERC20(asset)); + streamId = createDefaultStreamWithAssetLT(IERC20(asset)); - // Assert that the stream has been created. - LockupTranched.StreamLT memory actualStream = lockupTranched.getStream(streamId); - LockupTranched.StreamLT memory expectedStream = defaults.lockupTranchedStream(); - expectedStream.asset = IERC20(asset); - assertEq(actualStream, expectedStream); + // It should create the stream. + assertEq(lockup.getDepositedAmount(streamId), defaults.DEPOSIT_AMOUNT(), "depositedAmount"); + assertEq(lockup.getAsset(streamId), IERC20(asset), "asset"); + assertEq(lockup.getEndTime(streamId), defaults.END_TIME(), "endTime"); + assertEq(lockup.isCancelable(streamId), true, "isCancelable"); + assertEq(lockup.isDepleted(streamId), false, "isDepleted"); + assertEq(lockup.isStream(streamId), true, "isStream"); + assertEq(lockup.isTransferable(streamId), true, "isTransferable"); + assertEq(lockup.getRecipient(streamId), users.recipient, "recipient"); + assertEq(lockup.getSender(streamId), users.sender, "sender"); + assertEq(lockup.getStartTime(streamId), defaults.START_TIME(), "startTime"); + assertEq(lockup.wasCanceled(streamId), false, "wasCanceled"); + assertEq(lockup.getTranches(streamId), defaults.tranches(), "tranches"); // Assert that the stream's status is "PENDING". - Lockup.Status actualStatus = lockupTranched.statusOf(streamId); + Lockup.Status actualStatus = lockup.statusOf(streamId); Lockup.Status expectedStatus = Lockup.Status.PENDING; assertEq(actualStatus, expectedStatus); // It should bump the next stream ID. - uint256 actualNextStreamId = lockupTranched.nextStreamId(); + uint256 actualNextStreamId = lockup.nextStreamId(); uint256 expectedNextStreamId = streamId + 1; assertEq(actualNextStreamId, expectedNextStreamId, "nextStreamId"); // It should mint the NFT. - address actualNFTOwner = lockupTranched.ownerOf({ tokenId: streamId }); + address actualNFTOwner = lockup.ownerOf({ tokenId: streamId }); address expectedNFTOwner = users.recipient; assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } diff --git a/test/core/integration/concrete/lockup-tranched/create-with-timestamps/createWithTimestamps.tree b/test/core/integration/concrete/lockup-tranched/create-with-timestamps/createWithTimestampsLT.tree similarity index 98% rename from test/core/integration/concrete/lockup-tranched/create-with-timestamps/createWithTimestamps.tree rename to test/core/integration/concrete/lockup-tranched/create-with-timestamps/createWithTimestampsLT.tree index 9f1273285..f6e6393e4 100644 --- a/test/core/integration/concrete/lockup-tranched/create-with-timestamps/createWithTimestamps.tree +++ b/test/core/integration/concrete/lockup-tranched/create-with-timestamps/createWithTimestampsLT.tree @@ -1,4 +1,4 @@ -CreateWithTimestamps_LockupTranched_Integration_Concrete_Test +CreateWithTimestampsLT_Integration_Concrete_Test ├── when delegate call │ └── it should revert └── when no delegate call diff --git a/test/core/integration/concrete/lockup-tranched/get-stream/getStream.t.sol b/test/core/integration/concrete/lockup-tranched/get-stream/getStream.t.sol deleted file mode 100644 index c521db549..000000000 --- a/test/core/integration/concrete/lockup-tranched/get-stream/getStream.t.sol +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.8.22 <0.9.0; - -import { Errors } from "src/core/libraries/Errors.sol"; -import { LockupTranched } from "src/core/types/DataTypes.sol"; - -import { LockupTranched_Integration_Shared_Test } from "../LockupTranched.t.sol"; - -contract GetStream_LockupTranched_Integration_Concrete_Test is LockupTranched_Integration_Shared_Test { - function test_RevertGiven_Null() external { - uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); - lockupTranched.getStream(nullStreamId); - } - - function test_GivenSettledStream() external givenNotNull { - vm.warp({ newTimestamp: defaults.END_TIME() }); - - // It should return the stream struct. - LockupTranched.StreamLT memory actualStream = lockupTranched.getStream(defaultStreamId); - LockupTranched.StreamLT memory expectedStream = defaults.lockupTranchedStream(); - // It should always return stream as non-cancelable. - expectedStream.isCancelable = false; - assertEq(actualStream, expectedStream); - } - - function test_GivenNotSettledStream() external givenNotNull { - uint256 streamId = createDefaultStream(); - // It should return the stream struct. - LockupTranched.StreamLT memory actualStream = lockupTranched.getStream(streamId); - LockupTranched.StreamLT memory expectedStream = defaults.lockupTranchedStream(); - assertEq(actualStream, expectedStream); - } -} diff --git a/test/core/integration/concrete/lockup-tranched/get-stream/getStream.tree b/test/core/integration/concrete/lockup-tranched/get-stream/getStream.tree deleted file mode 100644 index 74dbb72ca..000000000 --- a/test/core/integration/concrete/lockup-tranched/get-stream/getStream.tree +++ /dev/null @@ -1,9 +0,0 @@ -GetStream_LockupTranched_Integration_Concrete_Test -├── given null -│ └── it should revert -└── given not null - ├── given settled stream - │ ├── it should always return stream as non-cancelable - │ └── it should return the stream struct - └── given not settled stream - └── it should return the stream struct diff --git a/test/core/integration/concrete/lockup-tranched/get-timestamps/getTimestamps.t.sol b/test/core/integration/concrete/lockup-tranched/get-timestamps/getTimestamps.t.sol index eefe31174..24dd97fe5 100644 --- a/test/core/integration/concrete/lockup-tranched/get-timestamps/getTimestamps.t.sol +++ b/test/core/integration/concrete/lockup-tranched/get-timestamps/getTimestamps.t.sol @@ -2,21 +2,20 @@ pragma solidity >=0.8.22 <0.9.0; import { Errors } from "src/core/libraries/Errors.sol"; -import { LockupTranched } from "src/core/types/DataTypes.sol"; +import { Lockup } from "src/core/types/DataTypes.sol"; -import { LockupTranched_Integration_Shared_Test } from "../LockupTranched.t.sol"; +import { Lockup_Tranched_Integration_Shared_Test } from "../LockupTranched.t.sol"; -contract GetTimestamps_LockupTranched_Integration_Concrete_Test is LockupTranched_Integration_Shared_Test { +contract GetTimestamps_LockupTranched_Integration_Concrete_Test is Lockup_Tranched_Integration_Shared_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); - lockupTranched.getTimestamps(nullStreamId); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); + lockup.getTimestamps(nullStreamId); } function test_GivenNotNull() external { - uint256 streamId = createDefaultStream(); - LockupTranched.Timestamps memory actualTimestamps = lockupTranched.getTimestamps(streamId); - LockupTranched.Timestamps memory expectedTimestamps = defaults.lockupTranchedTimestamps(); + Lockup.Timestamps memory actualTimestamps = lockup.getTimestamps(defaultStreamId); + Lockup.Timestamps memory expectedTimestamps = defaults.lockupTranchedTimestamps(); assertEq(actualTimestamps, expectedTimestamps); } } diff --git a/test/core/integration/concrete/lockup-tranched/get-tranches/getTranches.t.sol b/test/core/integration/concrete/lockup-tranched/get-tranches/getTranches.t.sol index 015f15d67..3fe8c6b37 100644 --- a/test/core/integration/concrete/lockup-tranched/get-tranches/getTranches.t.sol +++ b/test/core/integration/concrete/lockup-tranched/get-tranches/getTranches.t.sol @@ -4,18 +4,17 @@ pragma solidity >=0.8.22 <0.9.0; import { Errors } from "src/core/libraries/Errors.sol"; import { LockupTranched } from "src/core/types/DataTypes.sol"; -import { LockupTranched_Integration_Shared_Test } from "../LockupTranched.t.sol"; +import { Lockup_Tranched_Integration_Shared_Test } from "../LockupTranched.t.sol"; -contract GetTranches_LockupTranched_Integration_Concrete_Test is LockupTranched_Integration_Shared_Test { +contract GetTranches_LockupTranched_Integration_Concrete_Test is Lockup_Tranched_Integration_Shared_Test { function test_RevertGiven_Null() external { uint256 nullStreamId = 1729; - vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockup_Null.selector, nullStreamId)); - lockupTranched.getTranches(nullStreamId); + vm.expectRevert(abi.encodeWithSelector(Errors.SablierLockupBase_Null.selector, nullStreamId)); + lockup.getTranches(nullStreamId); } function test_GivenNotNull() external { - uint256 streamId = createDefaultStream(); - LockupTranched.Tranche[] memory actualTranches = lockupTranched.getTranches(streamId); + LockupTranched.Tranche[] memory actualTranches = lockup.getTranches(defaultStreamId); LockupTranched.Tranche[] memory expectedTranches = defaults.tranches(); assertEq(actualTranches, expectedTranches, "tranches"); } diff --git a/test/core/integration/concrete/lockup-tranched/streamed-amount-of/streamedAmountOf.t.sol b/test/core/integration/concrete/lockup-tranched/streamed-amount-of/streamedAmountOf.t.sol index 5e50af371..2ba496940 100644 --- a/test/core/integration/concrete/lockup-tranched/streamed-amount-of/streamedAmountOf.t.sol +++ b/test/core/integration/concrete/lockup-tranched/streamed-amount-of/streamedAmountOf.t.sol @@ -1,20 +1,21 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.22 <0.9.0; -import { StreamedAmountOf_Integration_Concrete_Test } from "./../../lockup/streamed-amount-of/streamedAmountOf.t.sol"; -import { LockupTranched_Integration_Shared_Test, Integration_Test } from "./../LockupTranched.t.sol"; +import { StreamedAmountOf_Integration_Concrete_Test } from + "./../../lockup-base/streamed-amount-of/streamedAmountOf.t.sol"; +import { Lockup_Tranched_Integration_Shared_Test, Integration_Test } from "./../LockupTranched.t.sol"; contract StreamedAmountOf_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, StreamedAmountOf_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } function test_GivenStartTimeInPresent() external givenSTREAMINGStatus { vm.warp({ newTimestamp: defaults.START_TIME() }); - uint128 actualStreamedAmount = lockupTranched.streamedAmountOf(defaultStreamId); + uint128 actualStreamedAmount = lockup.streamedAmountOf(defaultStreamId); uint128 expectedStreamedAmount = 0; assertEq(actualStreamedAmount, expectedStreamedAmount, "streamedAmount"); } @@ -23,7 +24,7 @@ contract StreamedAmountOf_LockupTranched_Integration_Concrete_Test is vm.warp({ newTimestamp: defaults.END_TIME() + 1 seconds }); // It should return the deposited amount. - uint128 actualStreamedAmount = lockupTranched.streamedAmountOf(defaultStreamId); + uint128 actualStreamedAmount = lockup.streamedAmountOf(defaultStreamId); uint128 expectedStreamedAmount = defaults.DEPOSIT_AMOUNT(); assertEq(actualStreamedAmount, expectedStreamedAmount, "streamedAmount"); } @@ -37,7 +38,7 @@ contract StreamedAmountOf_LockupTranched_Integration_Concrete_Test is vm.warp({ newTimestamp: defaults.START_TIME() + 1 seconds }); // It should return 0. - uint128 actualStreamedAmount = lockupTranched.streamedAmountOf(defaultStreamId); + uint128 actualStreamedAmount = lockup.streamedAmountOf(defaultStreamId); uint128 expectedStreamedAmount = 0; assertEq(actualStreamedAmount, expectedStreamedAmount, "streamedAmount"); } @@ -51,7 +52,7 @@ contract StreamedAmountOf_LockupTranched_Integration_Concrete_Test is vm.warp({ newTimestamp: defaults.END_TIME() - 1 seconds }); // It should return the correct streamed amount. - uint128 actualStreamedAmount = lockupTranched.streamedAmountOf(defaultStreamId); + uint128 actualStreamedAmount = lockup.streamedAmountOf(defaultStreamId); uint128 expectedStreamedAmount = defaults.tranches()[0].amount + defaults.tranches()[1].amount; assertEq(actualStreamedAmount, expectedStreamedAmount, "streamedAmount"); } diff --git a/test/core/integration/concrete/lockup-tranched/token-uri/tokenURI.t.sol b/test/core/integration/concrete/lockup-tranched/token-uri/tokenURI.t.sol index bcfbfabfd..ca9a84a19 100644 --- a/test/core/integration/concrete/lockup-tranched/token-uri/tokenURI.t.sol +++ b/test/core/integration/concrete/lockup-tranched/token-uri/tokenURI.t.sol @@ -7,7 +7,7 @@ import { console2 } from "forge-std/src/console2.sol"; import { StdStyle } from "forge-std/src/StdStyle.sol"; import { Base64 } from "solady/src/utils/Base64.sol"; -import { LockupTranched_Integration_Shared_Test } from "../LockupTranched.t.sol"; +import { Lockup_Tranched_Integration_Shared_Test } from "../LockupTranched.t.sol"; /// @dev Requirements for these tests to work: /// - The stream ID must be 1 @@ -16,22 +16,22 @@ import { LockupTranched_Integration_Shared_Test } from "../LockupTranched.t.sol" /// - The contract deployer, i.e. the `sender` config option in `foundry.toml`, must have the default value /// 0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38 so that the deployed contracts have the same addresses as /// the values hard coded in the tests below -contract TokenURI_LockupTranched_Integration_Concrete_Test is LockupTranched_Integration_Shared_Test { - address internal constant LOCKUP_TRANCHED = 0xDB25A7b768311dE128BBDa7B8426c3f9C74f3240; +contract TokenURI_LockupTranched_Integration_Concrete_Test is Lockup_Tranched_Integration_Shared_Test { + address internal constant LOCKUP = 0xDB25A7b768311dE128BBDa7B8426c3f9C74f3240; /// @dev To make these tests noninvasive, they are run only when the contract address matches the hard coded value. modifier skipOnMismatch() { - if (address(lockupTranched) == LOCKUP_TRANCHED) { + if (address(lockup) == LOCKUP) { _; } else { - console2.log(StdStyle.yellow('Warning: "lockupTranched.tokenURI" tests skipped due to address mismatch')); + console2.log(StdStyle.yellow('Warning: "lockup.tokenURI" tests skipped due to address mismatch')); } } function test_RevertGiven_NFTNotExist() external { uint256 nullStreamId = 1729; vm.expectRevert(abi.encodeWithSelector(IERC721Errors.ERC721NonexistentToken.selector, nullStreamId)); - lockupTranched.tokenURI({ tokenId: nullStreamId }); + lockup.tokenURI({ tokenId: nullStreamId }); } /// @dev If you need to update the hard-coded token URI: @@ -40,7 +40,7 @@ contract TokenURI_LockupTranched_Integration_Concrete_Test is LockupTranched_Int function test_WhenTokenURIDecoded() external skipOnMismatch givenNFTExists { vm.warp({ newTimestamp: defaults.START_TIME() + defaults.TOTAL_DURATION() / 4 }); - string memory tokenURI = lockupTranched.tokenURI(defaultStreamId); + string memory tokenURI = lockup.tokenURI(defaultStreamId); tokenURI = vm.replace({ input: tokenURI, from: "data:application/json;base64,", to: "" }); string memory actualDecodedTokenURI = string(Base64.decode(tokenURI)); string memory expectedDecodedTokenURI = @@ -51,7 +51,7 @@ contract TokenURI_LockupTranched_Integration_Concrete_Test is LockupTranched_Int function test_WhenTokenURINotDecoded() external skipOnMismatch givenNFTExists { vm.warp({ newTimestamp: defaults.START_TIME() + defaults.TOTAL_DURATION() / 4 }); - string memory actualTokenURI = lockupTranched.tokenURI(defaultStreamId); + string memory actualTokenURI = lockup.tokenURI(defaultStreamId); string memory expectedTokenURI = "data:application/json;base64,eyJhdHRyaWJ1dGVzIjpbeyJ0cmFpdF90eXBlIjoiQXNzZXQiLCJ2YWx1ZSI6IkRBSSJ9LHsidHJhaXRfdHlwZSI6IlNlbmRlciIsInZhbHVlIjoiMHg2MzMyZTdiMWRlYjFmMWEwYjc3YjJiYjE4YjE0NDMzMGM3MjkxYmNhIn0seyJ0cmFpdF90eXBlIjoiU3RhdHVzIiwidmFsdWUiOiJTdHJlYW1pbmcifV0sImRlc2NyaXB0aW9uIjoiVGhpcyBORlQgcmVwcmVzZW50cyBhIHBheW1lbnQgc3RyZWFtIGluIGEgU2FibGllciBWMiBMb2NrdXAgRHluYW1pYyBjb250cmFjdC4gVGhlIG93bmVyIG9mIHRoaXMgTkZUIGNhbiB3aXRoZHJhdyB0aGUgc3RyZWFtZWQgYXNzZXRzLCB3aGljaCBhcmUgZGVub21pbmF0ZWQgaW4gREFJLlxuXG4tIFN0cmVhbSBJRDogMVxuLSBMb2NrdXAgRHluYW1pYyBBZGRyZXNzOiAweGRiMjVhN2I3NjgzMTFkZTEyOGJiZGE3Yjg0MjZjM2Y5Yzc0ZjMyNDBcbi0gREFJIEFkZHJlc3M6IDB4MDNhNmE4NGNkNzYyZDk3MDdhMjE2MDViNTQ4YWFhYjg5MTU2MmFhYlxuXG7imqDvuI8gV0FSTklORzogVHJhbnNmZXJyaW5nIHRoZSBORlQgbWFrZXMgdGhlIG5ldyBvd25lciB0aGUgcmVjaXBpZW50IG9mIHRoZSBzdHJlYW0uIFRoZSBmdW5kcyB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VEUxTmpKaFlXSWc0b0NpSUVSQlNUd3ZkR1Y0ZEZCaGRHZytQQzkwWlhoMFBqeDFjMlVnYUhKbFpqMGlJMGRzYjNjaUlHWnBiR3d0YjNCaFkybDBlVDBpTGpraUx6NDhkWE5sSUdoeVpXWTlJaU5IYkc5M0lpQjRQU0l4TURBd0lpQjVQU0l4TURBd0lpQm1hV3hzTFc5d1lXTnBkSGs5SWk0NUlpOCtQSFZ6WlNCb2NtVm1QU0lqVEc5bmJ5SWdlRDBpTVRjd0lpQjVQU0l4TnpBaUlIUnlZVzV6Wm05eWJUMGljMk5oYkdVb0xqWXBJaTgrUEhWelpTQm9jbVZtUFNJalNHOTFjbWRzWVhOeklpQjRQU0l4TlRBaUlIazlJamt3SWlCMGNtRnVjMlp2Y20wOUluSnZkR0YwWlNneE1Da2lJSFJ5WVc1elptOXliUzF2Y21sbmFXNDlJalV3TUNBMU1EQWlMejQ4ZFhObElHaHlaV1k5SWlOUWNtOW5jbVZ6Y3lJZ2VEMGlNVFEwSWlCNVBTSTNPVEFpTHo0OGRYTmxJR2h5WldZOUlpTlRkR0YwZFhNaUlIZzlJak0yT0NJZ2VUMGlOemt3SWk4K1BIVnpaU0JvY21WbVBTSWpRVzF2ZFc1MElpQjRQU0kxTmpnaUlIazlJamM1TUNJdlBqeDFjMlVnYUhKbFpqMGlJMFIxY21GMGFXOXVJaUI0UFNJM01EUWlJSGs5SWpjNU1DSXZQand2YzNablBnPT0ifQ=="; assertEq(actualTokenURI, expectedTokenURI, "token URI"); diff --git a/test/core/integration/concrete/lockup-tranched/withdrawable-amount-of/withdrawableAmountOf.t.sol b/test/core/integration/concrete/lockup-tranched/withdrawable-amount-of/withdrawableAmountOf.t.sol index 1bdac3a06..8663e992e 100644 --- a/test/core/integration/concrete/lockup-tranched/withdrawable-amount-of/withdrawableAmountOf.t.sol +++ b/test/core/integration/concrete/lockup-tranched/withdrawable-amount-of/withdrawableAmountOf.t.sol @@ -2,20 +2,20 @@ pragma solidity >=0.8.22 <0.9.0; import { WithdrawableAmountOf_Integration_Concrete_Test } from - "./../../lockup/withdrawable-amount-of/withdrawableAmountOf.t.sol"; -import { LockupTranched_Integration_Shared_Test, Integration_Test } from "./../LockupTranched.t.sol"; + "./../../lockup-base/withdrawable-amount-of/withdrawableAmountOf.t.sol"; +import { Lockup_Tranched_Integration_Shared_Test, Integration_Test } from "./../LockupTranched.t.sol"; contract WithdrawableAmountOf_LockupTranched_Integration_Concrete_Test is - LockupTranched_Integration_Shared_Test, + Lockup_Tranched_Integration_Shared_Test, WithdrawableAmountOf_Integration_Concrete_Test { - function setUp() public virtual override(LockupTranched_Integration_Shared_Test, Integration_Test) { - LockupTranched_Integration_Shared_Test.setUp(); + function setUp() public virtual override(Lockup_Tranched_Integration_Shared_Test, Integration_Test) { + Lockup_Tranched_Integration_Shared_Test.setUp(); } function test_GivenStartTimeInPresent() external givenSTREAMINGStatus { vm.warp({ newTimestamp: defaults.START_TIME() }); - uint128 actualWithdrawableAmount = lockupTranched.withdrawableAmountOf(defaultStreamId); + uint128 actualWithdrawableAmount = lockup.withdrawableAmountOf(defaultStreamId); uint128 expectedWithdrawableAmount = 0; assertEq(actualWithdrawableAmount, expectedWithdrawableAmount, "withdrawableAmount"); } @@ -25,7 +25,7 @@ contract WithdrawableAmountOf_LockupTranched_Integration_Concrete_Test is vm.warp({ newTimestamp: defaults.START_TIME() + defaults.CLIFF_DURATION() }); // Run the test. - uint128 actualWithdrawableAmount = lockupTranched.withdrawableAmountOf(defaultStreamId); + uint128 actualWithdrawableAmount = lockup.withdrawableAmountOf(defaultStreamId); uint128 expectedWithdrawableAmount = defaults.tranches()[0].amount; assertEq(actualWithdrawableAmount, expectedWithdrawableAmount, "withdrawableAmount"); } @@ -35,10 +35,10 @@ contract WithdrawableAmountOf_LockupTranched_Integration_Concrete_Test is vm.warp({ newTimestamp: defaults.START_TIME() + defaults.CLIFF_DURATION() }); // Make the withdrawal. - lockupTranched.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: defaults.CLIFF_AMOUNT() }); + lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: defaults.CLIFF_AMOUNT() }); // Run the test. - uint128 actualWithdrawableAmount = lockupTranched.withdrawableAmountOf(defaultStreamId); + uint128 actualWithdrawableAmount = lockup.withdrawableAmountOf(defaultStreamId); uint128 expectedWithdrawableAmount = defaults.tranches()[0].amount - defaults.CLIFF_AMOUNT(); assertEq(actualWithdrawableAmount, expectedWithdrawableAmount, "withdrawableAmount"); diff --git a/test/core/integration/concrete/nft-descriptor/map-symbol/mapSymbol.t.sol b/test/core/integration/concrete/nft-descriptor/map-symbol/mapSymbol.t.sol index 812b7ed60..769ec597e 100644 --- a/test/core/integration/concrete/nft-descriptor/map-symbol/mapSymbol.t.sol +++ b/test/core/integration/concrete/nft-descriptor/map-symbol/mapSymbol.t.sol @@ -16,21 +16,9 @@ contract MapSymbol_Integration_Concrete_Test is NFTDescriptor_Integration_Shared nftDescriptorMock.mapSymbol_(IERC721Metadata(address(nft))); } - function test_WhenLockupDynamicNFT() external view givenKnownNFTContract { - string memory actualLockupModel = nftDescriptorMock.mapSymbol_(lockupDynamic); - string memory expectedLockupModel = "Sablier Lockup Dynamic"; - assertEq(actualLockupModel, expectedLockupModel, "lockupModel"); - } - - function test_WhenLockupLinearNFT() external view givenKnownNFTContract { - string memory actualLockupModel = nftDescriptorMock.mapSymbol_(lockupLinear); - string memory expectedLockupModel = "Sablier Lockup Linear"; - assertEq(actualLockupModel, expectedLockupModel, "lockupModel"); - } - - function test_WhenLockupTranchedNFT() external view givenKnownNFTContract { - string memory actualLockupModel = nftDescriptorMock.mapSymbol_(lockupTranched); - string memory expectedLockupModel = "Sablier Lockup Tranched"; + function test_WhenLockupNFT() external view givenKnownNFTContract { + string memory actualLockupModel = nftDescriptorMock.mapSymbol_(lockup); + string memory expectedLockupModel = "Sablier Lockup"; assertEq(actualLockupModel, expectedLockupModel, "lockupModel"); } } diff --git a/test/core/integration/shared/lockup-dynamic/LockupDynamic.t.sol b/test/core/integration/shared/lockup-dynamic/LockupDynamic.t.sol deleted file mode 100644 index 2de692918..000000000 --- a/test/core/integration/shared/lockup-dynamic/LockupDynamic.t.sol +++ /dev/null @@ -1,178 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.8.22 <0.9.0; - -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; - -import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; -import { Broker, LockupDynamic } from "src/core/types/DataTypes.sol"; - -import { Integration_Test } from "../../Integration.t.sol"; - -/// @notice Common testing logic needed across {SablierLockupDynamic} integration tests. -abstract contract LockupDynamic_Integration_Shared_Test is Integration_Test { - struct CreateParams { - LockupDynamic.CreateWithDurations createWithDurations; - LockupDynamic.CreateWithTimestamps createWithTimestamps; - } - - /// @dev These have to be pre-declared so that `vm.expectRevert` does not expect a revert in `defaults`. - /// See https://github.com/foundry-rs/foundry/issues/4762. - CreateParams private _params; - - function setUp() public virtual override { - Integration_Test.setUp(); - - _params.createWithDurations.sender = users.sender; - _params.createWithDurations.recipient = users.recipient; - _params.createWithDurations.totalAmount = defaults.TOTAL_AMOUNT(); - _params.createWithDurations.asset = dai; - _params.createWithDurations.cancelable = true; - _params.createWithDurations.transferable = true; - _params.createWithDurations.broker = defaults.broker(); - - _params.createWithTimestamps.sender = users.sender; - _params.createWithTimestamps.recipient = users.recipient; - _params.createWithTimestamps.totalAmount = defaults.TOTAL_AMOUNT(); - _params.createWithTimestamps.asset = dai; - _params.createWithTimestamps.cancelable = true; - _params.createWithTimestamps.transferable = true; - _params.createWithTimestamps.startTime = defaults.START_TIME(); - _params.createWithTimestamps.broker = defaults.broker(); - - // See https://github.com/ethereum/solidity/issues/12783 - LockupDynamic.SegmentWithDuration[] memory segmentsWithDurations = defaults.segmentsWithDurations(); - LockupDynamic.Segment[] memory segments = defaults.segments(); - for (uint256 i = 0; i < defaults.SEGMENT_COUNT(); ++i) { - _params.createWithDurations.segments.push(segmentsWithDurations[i]); - _params.createWithTimestamps.segments.push(segments[i]); - } - - // Cast the {LockupDynamic} contract as {ISablierLockup}. - lockup = ISablierLockup(lockupDynamic); - - // Create the default stream. - defaultStreamId = createDefaultStream(); - - // Create a non-transferable stream. - notTransferableStreamId = createDefaultStreamNotTransferable(); - } - - /// @inheritdoc Integration_Test - function createDefaultStream() internal override returns (uint256 streamId) { - streamId = lockupDynamic.createWithTimestamps(_params.createWithTimestamps); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithAsset(IERC20 asset) internal override returns (uint256 streamId) { - LockupDynamic.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.asset = asset; - streamId = lockupDynamic.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithBroker(Broker memory broker) internal override returns (uint256 streamId) { - LockupDynamic.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.broker = broker; - streamId = lockupDynamic.createWithTimestamps(params); - } - - /// @dev Creates the default stream with durations. - function createDefaultStreamWithDurations() internal returns (uint256 streamId) { - streamId = lockupDynamic.createWithDurations(_params.createWithDurations); - } - - /// @dev Creates the default stream with the provided durations. - function createDefaultStreamWithDurations(LockupDynamic.SegmentWithDuration[] memory segments) - internal - returns (uint256 streamId) - { - LockupDynamic.CreateWithDurations memory params = _params.createWithDurations; - params.segments = segments; - streamId = lockupDynamic.createWithDurations(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithEndTime(uint40 endTime) internal override returns (uint256 streamId) { - LockupDynamic.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.segments[1].timestamp = endTime; - streamId = lockupDynamic.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamNotCancelable() internal override returns (uint256 streamId) { - LockupDynamic.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.cancelable = false; - streamId = lockupDynamic.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamNotTransferable() internal override returns (uint256 streamId) { - LockupDynamic.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.transferable = false; - streamId = lockupDynamic.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithRecipient(address recipient) internal override returns (uint256 streamId) { - LockupDynamic.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.recipient = recipient; - streamId = lockupDynamic.createWithTimestamps(params); - } - - /// @dev Creates the default stream with the provided segments. - function createDefaultStreamWithSegments(LockupDynamic.Segment[] memory segments) - internal - returns (uint256 streamId) - { - LockupDynamic.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.segments = segments; - streamId = lockupDynamic.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithSender(address sender) internal override returns (uint256 streamId) { - LockupDynamic.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.sender = sender; - streamId = lockupDynamic.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithStartTime(uint40 startTime) internal override returns (uint256 streamId) { - LockupDynamic.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.startTime = startTime; - streamId = lockupDynamic.createWithTimestamps(params); - } - - /// @dev Creates the default stream with the provided timestamps. - function createDefaultStreamWithTimestamps(LockupDynamic.Timestamps memory timestamps) - internal - returns (uint256 streamId) - { - LockupDynamic.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.startTime = timestamps.start; - params.segments[1].timestamp = timestamps.end; - streamId = lockupDynamic.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithTotalAmount(uint128 totalAmount) internal override returns (uint256 streamId) { - LockupDynamic.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.totalAmount = totalAmount; - streamId = lockupDynamic.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithUsers( - address recipient, - address sender - ) - internal - override - returns (uint256 streamId) - { - LockupDynamic.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.recipient = recipient; - params.sender = sender; - streamId = lockupDynamic.createWithTimestamps(params); - } -} diff --git a/test/core/integration/shared/lockup-linear/LockupLinear.t.sol b/test/core/integration/shared/lockup-linear/LockupLinear.t.sol deleted file mode 100644 index 7ef270538..000000000 --- a/test/core/integration/shared/lockup-linear/LockupLinear.t.sol +++ /dev/null @@ -1,144 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.8.22 <0.9.0; - -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; - -import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; -import { Broker, LockupLinear } from "src/core/types/DataTypes.sol"; - -import { Integration_Test } from "../../Integration.t.sol"; - -/// @notice Common testing logic needed by all {SablierLockupLinear} integration tests. -abstract contract LockupLinear_Integration_Shared_Test is Integration_Test { - struct Params { - LockupLinear.CreateWithDurations createWithDurations; - LockupLinear.CreateWithTimestamps createWithTimestamps; - } - - /// @dev These have to be pre-declared so that `vm.expectRevert` does not expect a revert in `defaults`. - /// See https://github.com/foundry-rs/foundry/issues/4762. - Params private _params; - - function setUp() public virtual override { - Integration_Test.setUp(); - _params.createWithDurations = defaults.createWithDurationsLL(); - _params.createWithTimestamps = defaults.createWithTimestampsLL(); - - // Cast the LockupLinear contract as {ISablierLockup}. - lockup = ISablierLockup(lockupLinear); - - // Create the default stream. - defaultStreamId = createDefaultStream(); - - // Create a non-transferable stream. - notTransferableStreamId = createDefaultStreamNotTransferable(); - } - - /// @inheritdoc Integration_Test - function createDefaultStream() internal override returns (uint256 streamId) { - streamId = lockupLinear.createWithTimestamps(_params.createWithTimestamps); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithAsset(IERC20 asset) internal override returns (uint256 streamId) { - LockupLinear.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.asset = asset; - streamId = lockupLinear.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithBroker(Broker memory broker) internal override returns (uint256 streamId) { - LockupLinear.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.broker = broker; - streamId = lockupLinear.createWithTimestamps(params); - } - - /// @dev Creates the default stream with durations. - function createDefaultStreamWithDurations() internal returns (uint256 streamId) { - streamId = lockupLinear.createWithDurations(_params.createWithDurations); - } - - /// @dev Creates the default stream with the provided durations. - function createDefaultStreamWithDurations(LockupLinear.Durations memory durations) - internal - returns (uint256 streamId) - { - LockupLinear.CreateWithDurations memory params = _params.createWithDurations; - params.durations = durations; - streamId = lockupLinear.createWithDurations(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamNotCancelable() internal override returns (uint256 streamId) { - LockupLinear.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.cancelable = false; - streamId = lockupLinear.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamNotTransferable() internal override returns (uint256 streamId) { - LockupLinear.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.transferable = false; - streamId = lockupLinear.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithEndTime(uint40 endTime) internal override returns (uint256 streamId) { - LockupLinear.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.timestamps.end = endTime; - streamId = lockupLinear.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithRecipient(address recipient) internal override returns (uint256 streamId) { - LockupLinear.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.recipient = recipient; - streamId = lockupLinear.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithSender(address sender) internal override returns (uint256 streamId) { - LockupLinear.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.sender = sender; - streamId = lockupLinear.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithStartTime(uint40 startTime) internal override returns (uint256 streamId) { - LockupLinear.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.timestamps.start = startTime; - streamId = lockupLinear.createWithTimestamps(params); - } - - /// @dev Creates the default stream with the provided timestamps. - function createDefaultStreamWithTimestamps(LockupLinear.Timestamps memory timestamps) - internal - returns (uint256 streamId) - { - LockupLinear.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.timestamps = timestamps; - streamId = lockupLinear.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithTotalAmount(uint128 totalAmount) internal override returns (uint256 streamId) { - LockupLinear.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.totalAmount = totalAmount; - streamId = lockupLinear.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithUsers( - address recipient, - address sender - ) - internal - override - returns (uint256 streamId) - { - LockupLinear.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.recipient = recipient; - params.sender = sender; - streamId = lockupLinear.createWithTimestamps(params); - } -} diff --git a/test/core/integration/shared/lockup-tranched/LockupTranched.t.sol b/test/core/integration/shared/lockup-tranched/LockupTranched.t.sol deleted file mode 100644 index c120ad375..000000000 --- a/test/core/integration/shared/lockup-tranched/LockupTranched.t.sol +++ /dev/null @@ -1,187 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.8.22 <0.9.0; - -import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; - -import { ISablierLockup } from "src/core/interfaces/ISablierLockup.sol"; -import { Broker, LockupTranched } from "src/core/types/DataTypes.sol"; - -import { Integration_Test } from "../../Integration.t.sol"; - -/// @notice Common testing logic needed across {SablierLockupTranched} integration tests. -abstract contract LockupTranched_Integration_Shared_Test is Integration_Test { - struct CreateParams { - LockupTranched.CreateWithDurations createWithDurations; - LockupTranched.CreateWithTimestamps createWithTimestamps; - } - - /// @dev These have to be pre-declared so that `vm.expectRevert` does not expect a revert in `defaults`. - /// See https://github.com/foundry-rs/foundry/issues/4762. - CreateParams private _params; - - function setUp() public virtual override { - Integration_Test.setUp(); - - _params.createWithDurations.sender = users.sender; - _params.createWithDurations.recipient = users.recipient; - _params.createWithDurations.totalAmount = defaults.TOTAL_AMOUNT(); - _params.createWithDurations.asset = dai; - _params.createWithDurations.cancelable = true; - _params.createWithDurations.transferable = true; - _params.createWithDurations.broker = defaults.broker(); - - _params.createWithTimestamps.sender = users.sender; - _params.createWithTimestamps.recipient = users.recipient; - _params.createWithTimestamps.totalAmount = defaults.TOTAL_AMOUNT(); - _params.createWithTimestamps.asset = dai; - _params.createWithTimestamps.cancelable = true; - _params.createWithTimestamps.transferable = true; - _params.createWithTimestamps.startTime = defaults.START_TIME(); - _params.createWithTimestamps.broker = defaults.broker(); - - // See https://github.com/ethereum/solidity/issues/12783 - LockupTranched.TrancheWithDuration[] memory tranchesWithDurations = defaults.tranchesWithDurations(); - LockupTranched.Tranche[] memory tranches = defaults.tranches(); - for (uint256 i = 0; i < defaults.TRANCHE_COUNT(); ++i) { - _params.createWithDurations.tranches.push(tranchesWithDurations[i]); - _params.createWithTimestamps.tranches.push(tranches[i]); - } - - // Cast the LockupTranched contract as {ISablierLockup}. - lockup = ISablierLockup(lockupTranched); - - // Create the default stream. - defaultStreamId = createDefaultStream(); - - // Create a non-transferable stream. - notTransferableStreamId = createDefaultStreamNotTransferable(); - } - - /// @inheritdoc Integration_Test - function createDefaultStream() internal override returns (uint256 streamId) { - streamId = lockupTranched.createWithTimestamps(_params.createWithTimestamps); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithAsset(IERC20 asset) internal override returns (uint256 streamId) { - LockupTranched.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.asset = asset; - streamId = lockupTranched.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithBroker(Broker memory broker) internal override returns (uint256 streamId) { - LockupTranched.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.broker = broker; - streamId = lockupTranched.createWithTimestamps(params); - } - - /// @dev Creates the default stream with durations. - function createDefaultStreamWithDurations() internal returns (uint256 streamId) { - streamId = lockupTranched.createWithDurations(_params.createWithDurations); - } - - /// @dev Creates the default stream with the provided durations. - function createDefaultStreamWithDurations(LockupTranched.TrancheWithDuration[] memory tranches) - internal - returns (uint256 streamId) - { - LockupTranched.CreateWithDurations memory params = _params.createWithDurations; - params.tranches = tranches; - streamId = lockupTranched.createWithDurations(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithEndTime(uint40 endTime) internal override returns (uint256 streamId) { - LockupTranched.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.tranches[2].timestamp = endTime; - - // Ensure the timestamps are arranged in ascending order. - if (params.tranches[2].timestamp <= params.tranches[1].timestamp) { - params.tranches[1].timestamp = params.tranches[2].timestamp - 1; - } - if (params.tranches[1].timestamp <= params.tranches[0].timestamp) { - params.tranches[0].timestamp = params.tranches[1].timestamp - 1; - } - - streamId = lockupTranched.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamNotCancelable() internal override returns (uint256 streamId) { - LockupTranched.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.cancelable = false; - streamId = lockupTranched.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamNotTransferable() internal override returns (uint256 streamId) { - LockupTranched.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.transferable = false; - streamId = lockupTranched.createWithTimestamps(params); - } - - /// @dev Creates the default stream with the provided timestamps. - function createDefaultStreamWithTimestamps(LockupTranched.Timestamps memory timestamps) - internal - returns (uint256 streamId) - { - LockupTranched.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.startTime = timestamps.start; - params.tranches[1].timestamp = timestamps.end; - streamId = lockupTranched.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithRecipient(address recipient) internal override returns (uint256 streamId) { - LockupTranched.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.recipient = recipient; - streamId = lockupTranched.createWithTimestamps(params); - } - - /// @dev Creates the default stream with the provided tranches. - function createDefaultStreamWithTranches(LockupTranched.Tranche[] memory tranches) - internal - returns (uint256 streamId) - { - LockupTranched.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.tranches = tranches; - streamId = lockupTranched.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithSender(address sender) internal override returns (uint256 streamId) { - LockupTranched.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.sender = sender; - streamId = lockupTranched.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithStartTime(uint40 startTime) internal override returns (uint256 streamId) { - LockupTranched.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.startTime = startTime; - streamId = lockupTranched.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithTotalAmount(uint128 totalAmount) internal override returns (uint256 streamId) { - LockupTranched.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.totalAmount = totalAmount; - streamId = lockupTranched.createWithTimestamps(params); - } - - /// @inheritdoc Integration_Test - function createDefaultStreamWithUsers( - address recipient, - address sender - ) - internal - override - returns (uint256 streamId) - { - LockupTranched.CreateWithTimestamps memory params = _params.createWithTimestamps; - params.recipient = recipient; - params.sender = sender; - streamId = lockupTranched.createWithTimestamps(params); - } -} diff --git a/test/core/integration/shared/lockup/Lockup.t.sol b/test/core/integration/shared/lockup/Lockup.t.sol new file mode 100644 index 000000000..e08f46aac --- /dev/null +++ b/test/core/integration/shared/lockup/Lockup.t.sol @@ -0,0 +1,451 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity >=0.8.22 <0.9.0; + +import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; + +import { Broker, Lockup, LockupDynamic, LockupLinear, LockupTranched } from "src/core/types/DataTypes.sol"; + +import { Integration_Test } from "../../Integration.t.sol"; + +/// @notice Common testing logic needed across {SablierLockup} integration tests. +abstract contract Lockup_Create_Integration_Shared_Test is Integration_Test { + struct CreateParams { + Lockup.CreateWithTimestamps createWithTimestamps; + Lockup.CreateWithDurations createWithDurations; + uint40 cliffTime; + LockupLinear.Durations durations; + LockupDynamic.Segment[] segments; + LockupDynamic.SegmentWithDuration[] segmentsWithDurations; + LockupTranched.Tranche[] tranches; + LockupTranched.TrancheWithDuration[] tranchesWithDurations; + } + + CreateParams private _params; + + /*////////////////////////////////////////////////////////////////////////// + SET-UP FUNCTION + //////////////////////////////////////////////////////////////////////////*/ + + function setUp() public virtual override { + Integration_Test.setUp(); + + _params.createWithTimestamps = defaults.createWithTimestamps(); + _params.createWithDurations = defaults.createWithDurations(); + _params.cliffTime = defaults.CLIFF_TIME(); + _params.durations = defaults.durations(); + + // See https://github.com/ethereum/solidity/issues/12783 + LockupDynamic.SegmentWithDuration[] memory segmentsWithDurations = defaults.segmentsWithDurations(); + LockupDynamic.Segment[] memory segments = defaults.segments(); + for (uint256 i; i < defaults.SEGMENT_COUNT(); ++i) { + _params.segments.push(segments[i]); + _params.segmentsWithDurations.push(segmentsWithDurations[i]); + } + LockupTranched.TrancheWithDuration[] memory tranchesWithDurations = defaults.tranchesWithDurations(); + LockupTranched.Tranche[] memory tranches = defaults.tranches(); + for (uint256 i; i < defaults.TRANCHE_COUNT(); ++i) { + _params.tranches.push(tranches[i]); + _params.tranchesWithDurations.push(tranchesWithDurations[i]); + } + } + + /*////////////////////////////////////////////////////////////////////////// + LOCKUP-DYNAMIC + //////////////////////////////////////////////////////////////////////////*/ + + function createDefaultStreamLD() internal returns (uint256 streamId) { + streamId = lockup.createWithTimestampsLD(_params.createWithTimestamps, _params.segments); + } + + function createDefaultStreamWithAssetLD(IERC20 asset) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.asset = asset; + streamId = lockup.createWithTimestampsLD(params, _params.segments); + } + + function createDefaultStreamWithBrokerLD(Broker memory broker) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.broker = broker; + streamId = lockup.createWithTimestampsLD(params, _params.segments); + } + + /// @dev Creates the default stream with durations. + function createDefaultStreamWithDurationsLD() internal returns (uint256 streamId) { + streamId = lockup.createWithDurationsLD(_params.createWithDurations, _params.segmentsWithDurations); + } + + /// @dev Creates the default stream with the provided durations. + function createDefaultStreamWithDurationsLD(LockupDynamic.SegmentWithDuration[] memory segmentsWithDurations) + internal + returns (uint256 streamId) + { + streamId = lockup.createWithDurationsLD(_params.createWithDurations, segmentsWithDurations); + } + + function createDefaultStreamWithEndTimeLD(uint40 endTime) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + LockupDynamic.Segment[] memory segments_ = _params.segments; + params.endTime = endTime; + segments_[1].timestamp = endTime; + streamId = lockup.createWithTimestampsLD(params, segments_); + } + + function createDefaultStreamWithIdenticalUsersLD(address user) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.sender = user; + params.recipient = user; + streamId = lockup.createWithTimestampsLD(params, _params.segments); + } + + function createDefaultStreamNotCancelableLD() internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.cancelable = false; + streamId = lockup.createWithTimestampsLD(params, _params.segments); + } + + function createDefaultStreamNotTransferableLD() internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.transferable = false; + streamId = lockup.createWithTimestampsLD(params, _params.segments); + } + + function createDefaultStreamWithRecipientLD(address recipient) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.recipient = recipient; + streamId = lockup.createWithTimestampsLD(params, _params.segments); + } + + /// @dev Creates the default stream with the provided segments. + function createDefaultStreamWithSegmentsLD(LockupDynamic.Segment[] memory segments) + internal + returns (uint256 streamId) + { + streamId = lockup.createWithTimestampsLD(_params.createWithTimestamps, segments); + } + + function createDefaultStreamWithSenderLD(address sender) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.sender = sender; + streamId = lockup.createWithTimestampsLD(params, _params.segments); + } + + function createDefaultStreamWithStartTimeLD(uint40 startTime) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.startTime = startTime; + streamId = lockup.createWithTimestampsLD(params, _params.segments); + } + + /// @dev Creates the default stream with the provided timestamps. + function createDefaultStreamWithTimestampsLD(Lockup.Timestamps memory timestamps) + internal + returns (uint256 streamId) + { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + LockupDynamic.Segment[] memory segments_ = _params.segments; + params.startTime = timestamps.start; + params.endTime = timestamps.end; + segments_[1].timestamp = timestamps.end; + streamId = lockup.createWithTimestampsLD(params, segments_); + } + + function createDefaultStreamWithTotalAmountLD(uint128 totalAmount) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.totalAmount = totalAmount; + streamId = lockup.createWithTimestampsLD(params, _params.segments); + } + + function createDefaultStreamWithUsersLD(address recipient, address sender) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.recipient = recipient; + params.sender = sender; + streamId = lockup.createWithTimestampsLD(params, _params.segments); + } + + function WarpAndCreateStreamsForCancelMultipleLD(uint40 warpTime) internal returns (uint256[2] memory streamIds) { + vm.warp({ newTimestamp: warpTime }); + + // Create the first stream. + streamIds[0] = createDefaultStreamLD(); + + // Create the second stream with an end time double that of the default stream so that the refund amounts are + // different. + streamIds[1] = createDefaultStreamWithEndTimeLD(defaults.END_TIME() + defaults.TOTAL_DURATION()); + } + + function WarpAndCreateStreamsWithdrawMultipleLD(uint40 warpTime) internal returns (uint256[3] memory streamIds) { + vm.warp({ newTimestamp: warpTime }); + + // Create three test streams: + // 1. A default stream + // 2. A stream with an early end time + // 3. A stream meant to be canceled before the withdrawal is made + streamIds[0] = createDefaultStreamLD(); + streamIds[1] = createDefaultStreamWithEndTimeLD(defaults.WARP_26_PERCENT()); + streamIds[2] = createDefaultStreamLD(); + } + + /*////////////////////////////////////////////////////////////////////////// + LOCKUP-LINEAR + //////////////////////////////////////////////////////////////////////////*/ + + function createDefaultStreamLL() internal returns (uint256 streamId) { + streamId = lockup.createWithTimestampsLL(_params.createWithTimestamps, _params.cliffTime); + } + + function createDefaultStreamWithAssetLL(IERC20 asset) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.asset = asset; + streamId = lockup.createWithTimestampsLL(params, _params.cliffTime); + } + + function createDefaultStreamWithBrokerLL(Broker memory broker) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.broker = broker; + streamId = lockup.createWithTimestampsLL(params, _params.cliffTime); + } + + /// @dev Creates the default stream with durations. + function createDefaultStreamWithDurationsLL() internal returns (uint256 streamId) { + streamId = lockup.createWithDurationsLL(_params.createWithDurations, _params.durations); + } + + /// @dev Creates the default stream with the provided durations. + function createDefaultStreamWithDurationsLL(LockupLinear.Durations memory durations) + internal + returns (uint256 streamId) + { + streamId = lockup.createWithDurationsLL(_params.createWithDurations, durations); + } + + function createDefaultStreamNotCancelableLL() internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.cancelable = false; + streamId = lockup.createWithTimestampsLL(params, _params.cliffTime); + } + + function createDefaultStreamNotTransferableLL() internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.transferable = false; + streamId = lockup.createWithTimestampsLL(params, _params.cliffTime); + } + + function createDefaultStreamWithEndTimeLL(uint40 endTime) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.endTime = endTime; + streamId = lockup.createWithTimestampsLL(params, _params.cliffTime); + } + + function createDefaultStreamWithIdenticalUsersLL(address user) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.sender = user; + params.recipient = user; + streamId = lockup.createWithTimestampsLL(params, _params.cliffTime); + } + + function createDefaultStreamWithRecipientLL(address recipient) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.recipient = recipient; + streamId = lockup.createWithTimestampsLL(params, _params.cliffTime); + } + + function createDefaultStreamWithSenderLL(address sender) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.sender = sender; + streamId = lockup.createWithTimestampsLL(params, _params.cliffTime); + } + + function createDefaultStreamWithStartTimeLL(uint40 startTime) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.startTime = startTime; + streamId = lockup.createWithTimestampsLL(params, _params.cliffTime); + } + + /// @dev Creates the default stream with the provided timestamps. + function createDefaultStreamWithTimestampsLL(Lockup.Timestamps memory timestamps) + internal + returns (uint256 streamId) + { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.startTime = timestamps.start; + params.endTime = timestamps.end; + streamId = lockup.createWithTimestampsLL(params, timestamps.cliff); + } + + function createDefaultStreamWithTotalAmountLL(uint128 totalAmount) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.totalAmount = totalAmount; + streamId = lockup.createWithTimestampsLL(params, _params.cliffTime); + } + + function createDefaultStreamWithUsersLL(address recipient, address sender) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.recipient = recipient; + params.sender = sender; + streamId = lockup.createWithTimestampsLL(params, _params.cliffTime); + } + + function WarpAndCreateStreamsForCancelMultipleLL(uint40 warpTime) internal returns (uint256[2] memory streamIds) { + vm.warp({ newTimestamp: warpTime }); + + // Create the first stream. + streamIds[0] = createDefaultStreamLL(); + // Create the second stream with an end time double that of the default stream so that the refund amounts are + // different. + streamIds[1] = createDefaultStreamWithEndTimeLL(defaults.END_TIME() + defaults.TOTAL_DURATION()); + } + + function WarpAndCreateStreamsWithdrawMultipleLL(uint40 warpTime) internal returns (uint256[3] memory streamIds) { + vm.warp({ newTimestamp: warpTime }); + + // Create three test streams: + // 1. A default stream + // 2. A stream with an early end time + // 3. A stream meant to be canceled before the withdrawal is made + streamIds[0] = createDefaultStreamLL(); + streamIds[1] = createDefaultStreamWithEndTimeLL(defaults.WARP_26_PERCENT()); + streamIds[2] = createDefaultStreamLL(); + } + + /*////////////////////////////////////////////////////////////////////////// + LOCKUP-TRANCHED + //////////////////////////////////////////////////////////////////////////*/ + + function createDefaultStreamLT() internal returns (uint256 streamId) { + streamId = lockup.createWithTimestampsLT(_params.createWithTimestamps, _params.tranches); + } + + function createDefaultStreamWithAssetLT(IERC20 asset) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.asset = asset; + streamId = lockup.createWithTimestampsLT(params, _params.tranches); + } + + function createDefaultStreamWithBrokerLT(Broker memory broker) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.broker = broker; + streamId = lockup.createWithTimestampsLT(params, _params.tranches); + } + + /// @dev Creates the default stream with durations. + function createDefaultStreamWithDurationsLT() internal returns (uint256 streamId) { + streamId = lockup.createWithDurationsLT(_params.createWithDurations, _params.tranchesWithDurations); + } + + /// @dev Creates the default stream with the provided durations. + function createDefaultStreamWithDurationsLT(LockupTranched.TrancheWithDuration[] memory tranchesWithDuration) + internal + returns (uint256 streamId) + { + streamId = lockup.createWithDurationsLT(_params.createWithDurations, tranchesWithDuration); + } + + function createDefaultStreamWithEndTimeLT(uint40 endTime) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + LockupTranched.Tranche[] memory tranches_ = _params.tranches; + params.endTime = endTime; + tranches_[2].timestamp = endTime; + + // Ensure the timestamps are arranged in ascending order. + if (tranches_[2].timestamp <= tranches_[1].timestamp) { + tranches_[1].timestamp = tranches_[2].timestamp - 1; + } + if (tranches_[1].timestamp <= tranches_[0].timestamp) { + tranches_[0].timestamp = tranches_[1].timestamp - 1; + } + + streamId = lockup.createWithTimestampsLT(params, tranches_); + } + + function createDefaultStreamWithIdenticalUsersLT(address user) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.sender = user; + params.recipient = user; + streamId = lockup.createWithTimestampsLT(params, _params.tranches); + } + + function createDefaultStreamNotCancelableLT() internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.cancelable = false; + streamId = lockup.createWithTimestampsLT(params, _params.tranches); + } + + function createDefaultStreamNotTransferableLT() internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.transferable = false; + streamId = lockup.createWithTimestampsLT(params, _params.tranches); + } + + /// @dev Creates the default stream with the provided timestamps. + function createDefaultStreamWithTimestampsLT(Lockup.Timestamps memory timestamps) + internal + returns (uint256 streamId) + { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + LockupTranched.Tranche[] memory tranches_ = _params.tranches; + params.startTime = timestamps.start; + params.endTime = timestamps.end; + tranches_[1].timestamp = timestamps.end; + streamId = lockup.createWithTimestampsLT(params, tranches_); + } + + function createDefaultStreamWithRecipientLT(address recipient) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.recipient = recipient; + streamId = lockup.createWithTimestampsLT(params, _params.tranches); + } + + /// @dev Creates the default stream with the provided tranches. + function createDefaultStreamWithTranchesLT(LockupTranched.Tranche[] memory tranches) + internal + returns (uint256 streamId) + { + streamId = lockup.createWithTimestampsLT(_params.createWithTimestamps, tranches); + } + + function createDefaultStreamWithSenderLT(address sender) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.sender = sender; + streamId = lockup.createWithTimestampsLT(params, _params.tranches); + } + + function createDefaultStreamWithStartTimeLT(uint40 startTime) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.startTime = startTime; + streamId = lockup.createWithTimestampsLT(params, _params.tranches); + } + + function createDefaultStreamWithTotalAmountLT(uint128 totalAmount) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.totalAmount = totalAmount; + streamId = lockup.createWithTimestampsLT(params, _params.tranches); + } + + function createDefaultStreamWithUsersLT(address recipient, address sender) internal returns (uint256 streamId) { + Lockup.CreateWithTimestamps memory params = _params.createWithTimestamps; + params.recipient = recipient; + params.sender = sender; + streamId = lockup.createWithTimestampsLT(params, _params.tranches); + } + + function WarpAndCreateStreamsForCancelMultipleLT(uint40 warpTime) internal returns (uint256[2] memory streamIds) { + vm.warp({ newTimestamp: warpTime }); + + // Create the first stream. + streamIds[0] = createDefaultStreamLT(); + // Create the second stream with an end time double that of the default stream so that the refund amounts are + // different. + streamIds[1] = createDefaultStreamWithEndTimeLT(defaults.END_TIME() + defaults.TOTAL_DURATION()); + } + + function WarpAndCreateStreamsWithdrawMultipleLT(uint40 warpTime) internal returns (uint256[3] memory streamIds) { + vm.warp({ newTimestamp: warpTime }); + + // Create three test streams: + // 1. A default stream + // 2. A stream with an early end time + // 3. A stream meant to be canceled before the withdrawal is made + streamIds[0] = createDefaultStreamLT(); + streamIds[1] = createDefaultStreamWithEndTimeLT(defaults.WARP_26_PERCENT()); + streamIds[2] = createDefaultStreamLT(); + } +} diff --git a/test/core/integration/shared/lockup/cancelMultiple.t.sol b/test/core/integration/shared/lockup/cancelMultiple.t.sol deleted file mode 100644 index 6fb78c8de..000000000 --- a/test/core/integration/shared/lockup/cancelMultiple.t.sol +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.8.22 <0.9.0; - -import { Integration_Test } from "../../Integration.t.sol"; - -abstract contract CancelMultiple_Integration_Shared_Test is Integration_Test { - uint40 internal originalTime; - uint256[] internal testStreamIds; - - function setUp() public virtual override { - originalTime = getBlockTimestamp(); - createTestStreams(); - } - - /// @dev Creates the default streams used throughout the tests. - function createTestStreams() internal { - // Warp back to the original timestamp. - vm.warp({ newTimestamp: originalTime }); - - // Create the test streams. - testStreamIds = new uint256[](2); - testStreamIds[0] = createDefaultStream(); - // Create a stream with an end time double that of the default stream so that the refund amounts are different. - testStreamIds[1] = createDefaultStreamWithEndTime(defaults.END_TIME() + defaults.TOTAL_DURATION()); - } - - modifier whenCallerAuthorizedForAll() { - _; - vm.warp({ newTimestamp: originalTime }); - createTestStreams(); - _; - } -} diff --git a/test/core/integration/shared/lockup/withdrawMultiple.t.sol b/test/core/integration/shared/lockup/withdrawMultiple.t.sol deleted file mode 100644 index cde5025f7..000000000 --- a/test/core/integration/shared/lockup/withdrawMultiple.t.sol +++ /dev/null @@ -1,56 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.8.22 <0.9.0; - -import { Integration_Test } from "../../Integration.t.sol"; - -abstract contract WithdrawMultiple_Integration_Shared_Test is Integration_Test { - address internal caller; - uint40 internal earlyStopTime; - uint40 internal originalTime; - uint128[] internal testAmounts; - uint256[] internal testStreamIds; - - function setUp() public virtual override { - earlyStopTime = defaults.WARP_26_PERCENT(); - originalTime = getBlockTimestamp(); - createTestStreams(); - } - - /// @dev Creates the default streams used throughout the tests. - function createTestStreams() internal { - // Warp back to the original timestamp. - vm.warp({ newTimestamp: originalTime }); - - // Define the default amounts. - testAmounts = new uint128[](3); - testAmounts[0] = defaults.WITHDRAW_AMOUNT(); - testAmounts[1] = defaults.DEPOSIT_AMOUNT(); - testAmounts[2] = defaults.WITHDRAW_AMOUNT() / 2; - - // Create three test streams: - // 1. A default stream - // 2. A stream with an early end time - // 3. A stream meant to be canceled before the withdrawal is made - testStreamIds = new uint256[](3); - testStreamIds[0] = createDefaultStream(); - testStreamIds[1] = createDefaultStreamWithEndTime(earlyStopTime); - testStreamIds[2] = createDefaultStream(); - } - - /// @dev This modifier runs the test in three different modes: - /// - Stream's sender as caller - /// - Stream's recipient as caller - /// - Approved NFT operator as caller - modifier whenCallerAuthorizedAllStreams() { - caller = users.sender; - _; - - createTestStreams(); - caller = users.recipient; - _; - - createTestStreams(); - caller = users.operator; - _; - } -} diff --git a/test/periphery/fork/merkle-campaign/MerkleLL.t.sol b/test/periphery/fork/merkle-campaign/MerkleLL.t.sol index db5fee13a..310ba031b 100644 --- a/test/periphery/fork/merkle-campaign/MerkleLL.t.sol +++ b/test/periphery/fork/merkle-campaign/MerkleLL.t.sol @@ -199,7 +199,9 @@ abstract contract MerkleLL_Fork_Test is Fork_Test { assertEq(lockup.getRefundedAmount(vars.expectedStreamId), 0, "refunded amount"); assertEq(lockup.getWithdrawnAmount(vars.expectedStreamId), 0, "withdrawn amount"); assertEq(lockup.getAsset(vars.expectedStreamId), FORK_ASSET, "asset"); - assertEq(lockup.getCliff(vars.expectedStreamId), getBlockTimestamp() + defaults.CLIFF_DURATION(), "cliff time"); + assertEq( + lockup.getCliffTime(vars.expectedStreamId), getBlockTimestamp() + defaults.CLIFF_DURATION(), "cliff time" + ); assertEq(lockup.getEndTime(vars.expectedStreamId), getBlockTimestamp() + defaults.TOTAL_DURATION(), "end time"); assertEq(lockup.isCancelable(vars.expectedStreamId), defaults.CANCELABLE(), "is cancelable"); assertEq(lockup.isDepleted(vars.expectedStreamId), false, "is depleted"); diff --git a/test/periphery/integration/batch-lockup/create-with-durations-ld/createWithDurationsLD.t.sol b/test/periphery/integration/batch-lockup/create-with-durations-ld/createWithDurationsLD.t.sol index b488ba54f..e75f99091 100644 --- a/test/periphery/integration/batch-lockup/create-with-durations-ld/createWithDurationsLD.t.sol +++ b/test/periphery/integration/batch-lockup/create-with-durations-ld/createWithDurationsLD.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.22 <0.9.0; -import { Lockup, LockupDynamic } from "src/core/types/DataTypes.sol"; import { Errors } from "src/periphery/libraries/Errors.sol"; import { BatchLockup } from "src/periphery/types/DataTypes.sol"; @@ -27,9 +26,11 @@ contract CreateWithDurationsLD_Integration_Test is Periphery_Test { to: address(batchLockup), value: defaults.TOTAL_TRANSFER_AMOUNT() }); - (Lockup.CreateWithDurations memory params_, LockupDynamic.SegmentWithDuration[] memory segments_) = - defaults.createWithDurationsBrokerNullLD(); - expectMultipleCallsToCreateWithDurationsLD({ count: defaults.BATCH_SIZE(), params: params_, segments: segments_ }); + expectMultipleCallsToCreateWithDurationsLD({ + count: defaults.BATCH_SIZE(), + params: defaults.createWithDurationsBrokerNull(), + segments: defaults.segmentsWithDurations() + }); expectMultipleCallsToTransferFrom({ count: defaults.BATCH_SIZE(), from: address(batchLockup), diff --git a/test/periphery/integration/batch-lockup/create-with-durations-ll/createWithDurationsLL.t.sol b/test/periphery/integration/batch-lockup/create-with-durations-ll/createWithDurationsLL.t.sol index 57994320c..813502cf1 100644 --- a/test/periphery/integration/batch-lockup/create-with-durations-ll/createWithDurationsLL.t.sol +++ b/test/periphery/integration/batch-lockup/create-with-durations-ll/createWithDurationsLL.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.22 <0.9.0; -import { Lockup, LockupLinear } from "src/core/types/DataTypes.sol"; import { Errors } from "src/periphery/libraries/Errors.sol"; import { BatchLockup } from "src/periphery/types/DataTypes.sol"; @@ -28,13 +27,10 @@ contract CreateWithDurationsLL_Integration_Test is Periphery_Test { value: defaults.TOTAL_TRANSFER_AMOUNT() }); - (Lockup.CreateWithDurations memory params_, LockupLinear.Durations memory durations_) = - defaults.createWithDurationsBrokerNullLL(); - expectMultipleCallsToCreateWithDurationsLL({ count: defaults.BATCH_SIZE(), - params: params_, - durations: durations_ + params: defaults.createWithDurationsBrokerNull(), + durations: defaults.durations() }); expectMultipleCallsToTransferFrom({ count: defaults.BATCH_SIZE(), diff --git a/test/periphery/integration/batch-lockup/create-with-durations-lt/createWithDurationsLT.t.sol b/test/periphery/integration/batch-lockup/create-with-durations-lt/createWithDurationsLT.t.sol index d1f733cc7..b8ae540d5 100644 --- a/test/periphery/integration/batch-lockup/create-with-durations-lt/createWithDurationsLT.t.sol +++ b/test/periphery/integration/batch-lockup/create-with-durations-lt/createWithDurationsLT.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.22 <0.9.0; -import { Lockup, LockupTranched } from "src/core/types/DataTypes.sol"; import { Errors } from "src/periphery/libraries/Errors.sol"; import { BatchLockup } from "src/periphery/types/DataTypes.sol"; @@ -28,10 +27,11 @@ contract CreateWithDurationsLT_Integration_Test is Periphery_Test { value: defaults.TOTAL_TRANSFER_AMOUNT() }); - (Lockup.CreateWithDurations memory params_, LockupTranched.TrancheWithDuration[] memory tranches_) = - defaults.createWithDurationsBrokerNullLT(); - - expectMultipleCallsToCreateWithDurationsLT({ count: defaults.BATCH_SIZE(), params: params_, tranches: tranches_ }); + expectMultipleCallsToCreateWithDurationsLT({ + count: defaults.BATCH_SIZE(), + params: defaults.createWithDurationsBrokerNull(), + tranches: defaults.tranchesWithDurations() + }); expectMultipleCallsToTransferFrom({ count: defaults.BATCH_SIZE(), from: address(batchLockup), diff --git a/test/periphery/integration/batch-lockup/create-with-timestamps-ld/createWithTimestampsLD.t.sol b/test/periphery/integration/batch-lockup/create-with-timestamps-ld/createWithTimestampsLD.t.sol index 4f2ee7c04..e4b024deb 100644 --- a/test/periphery/integration/batch-lockup/create-with-timestamps-ld/createWithTimestampsLD.t.sol +++ b/test/periphery/integration/batch-lockup/create-with-timestamps-ld/createWithTimestampsLD.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.22 <0.9.0; -import { Lockup, LockupDynamic } from "src/core/types/DataTypes.sol"; import { Errors } from "src/periphery/libraries/Errors.sol"; import { BatchLockup } from "src/periphery/types/DataTypes.sol"; @@ -28,13 +27,10 @@ contract CreateWithTimestampsLD_Integration_Test is Periphery_Test { value: defaults.TOTAL_TRANSFER_AMOUNT() }); - (Lockup.CreateWithTimestamps memory params_, LockupDynamic.Segment[] memory segments_) = - defaults.createWithTimestampsBrokerNullLD(); - expectMultipleCallsToCreateWithTimestampsLD({ count: defaults.BATCH_SIZE(), - params: params_, - segments: segments_ + params: defaults.createWithTimestampsBrokerNull(), + segments: defaults.segments() }); expectMultipleCallsToTransferFrom({ count: defaults.BATCH_SIZE(), diff --git a/test/periphery/integration/batch-lockup/create-with-timestamps-ll/createWithTimestamps.t.sol b/test/periphery/integration/batch-lockup/create-with-timestamps-ll/createWithTimestamps.t.sol index 15cb72270..8dc414936 100644 --- a/test/periphery/integration/batch-lockup/create-with-timestamps-ll/createWithTimestamps.t.sol +++ b/test/periphery/integration/batch-lockup/create-with-timestamps-ll/createWithTimestamps.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.22 <0.9.0; -import { Lockup } from "src/core/types/DataTypes.sol"; import { Errors } from "src/periphery/libraries/Errors.sol"; import { BatchLockup } from "src/periphery/types/DataTypes.sol"; @@ -28,9 +27,11 @@ contract CreateWithTimestampsLL_Integration_Test is Periphery_Test { value: defaults.TOTAL_TRANSFER_AMOUNT() }); - (Lockup.CreateWithTimestamps memory params_, uint40 cliff_) = defaults.createWithTimestampsBrokerNullLL(); - - expectMultipleCallsToCreateWithTimestampsLL({ count: defaults.BATCH_SIZE(), params: params_, cliff: cliff_ }); + expectMultipleCallsToCreateWithTimestampsLL({ + count: defaults.BATCH_SIZE(), + params: defaults.createWithTimestampsBrokerNull(), + cliff: defaults.CLIFF_TIME() + }); expectMultipleCallsToTransferFrom({ count: defaults.BATCH_SIZE(), from: address(batchLockup), diff --git a/test/periphery/integration/batch-lockup/create-with-timestamps-lt/createWithTimestampsLT.t.sol b/test/periphery/integration/batch-lockup/create-with-timestamps-lt/createWithTimestampsLT.t.sol index 2df3e93b5..5fd468265 100644 --- a/test/periphery/integration/batch-lockup/create-with-timestamps-lt/createWithTimestampsLT.t.sol +++ b/test/periphery/integration/batch-lockup/create-with-timestamps-lt/createWithTimestampsLT.t.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.22 <0.9.0; -import { Lockup, LockupTranched } from "src/core/types/DataTypes.sol"; import { Errors } from "src/periphery/libraries/Errors.sol"; import { BatchLockup } from "src/periphery/types/DataTypes.sol"; @@ -28,13 +27,10 @@ contract CreateWithTimestampsLT_Integration_Test is Periphery_Test { value: defaults.TOTAL_TRANSFER_AMOUNT() }); - (Lockup.CreateWithTimestamps memory params_, LockupTranched.Tranche[] memory tranches_) = - defaults.createWithTimestampsBrokerNullLT(); - expectMultipleCallsToCreateWithTimestampsLT({ count: defaults.BATCH_SIZE(), - params: params_, - tranches: tranches_ + params: defaults.createWithTimestampsBrokerNull(), + tranches: defaults.tranches() }); expectMultipleCallsToTransferFrom({ count: defaults.BATCH_SIZE(), diff --git a/test/periphery/integration/merkle-campaign/ll/claim/claim.t.sol b/test/periphery/integration/merkle-campaign/ll/claim/claim.t.sol index 7d22d289a..0e4ba4c4b 100644 --- a/test/periphery/integration/merkle-campaign/ll/claim/claim.t.sol +++ b/test/periphery/integration/merkle-campaign/ll/claim/claim.t.sol @@ -80,11 +80,9 @@ contract Claim_MerkleLL_Integration_Test is Claim_Integration_Test, MerkleLL_Int ); // Assert that the stream has been created successfully. - assertEq(lockup.getDepositedAmount(expectedStreamId), defaults.CLAIM_AMOUNT(), "deposited amount"); - assertEq(lockup.getRefundedAmount(expectedStreamId), 0, "refunded amount"); - assertEq(lockup.getWithdrawnAmount(expectedStreamId), 0, "withdrawn amount"); + assertEq(lockup.getDepositedAmount(expectedStreamId), defaults.CLAIM_AMOUNT(), "depositedAmount"); assertEq(lockup.getAsset(expectedStreamId), dai, "asset"); - assertEq(lockup.getCliff(expectedStreamId), cliffTime, "cliff time"); + assertEq(lockup.getCliffTime(expectedStreamId), cliffTime, "cliff time"); assertEq(lockup.getEndTime(expectedStreamId), startTime + defaults.TOTAL_DURATION(), "end time"); assertEq(lockup.isCancelable(expectedStreamId), defaults.CANCELABLE(), "is cancelable"); assertEq(lockup.isDepleted(expectedStreamId), false, "is depleted"); diff --git a/test/periphery/integration/merkle-campaign/lt/claim/claim.t.sol b/test/periphery/integration/merkle-campaign/lt/claim/claim.t.sol index c4cc71733..981878010 100644 --- a/test/periphery/integration/merkle-campaign/lt/claim/claim.t.sol +++ b/test/periphery/integration/merkle-campaign/lt/claim/claim.t.sol @@ -134,9 +134,7 @@ contract Claim_MerkleLT_Integration_Test is Claim_Integration_Test, MerkleLT_Int ); // Assert that the stream has been created successfully. - assertEq(lockup.getDepositedAmount(expectedStreamId), defaults.CLAIM_AMOUNT(), "deposited amount"); - assertEq(lockup.getRefundedAmount(expectedStreamId), 0, "refunded amount"); - assertEq(lockup.getWithdrawnAmount(expectedStreamId), 0, "withdrawn amount"); + assertEq(lockup.getDepositedAmount(expectedStreamId), defaults.CLAIM_AMOUNT(), "depositedAmount"); assertEq(lockup.getAsset(expectedStreamId), dai, "asset"); assertEq(lockup.getEndTime(expectedStreamId), startTime + defaults.TOTAL_DURATION(), "end time"); assertEq(lockup.isCancelable(expectedStreamId), defaults.CANCELABLE(), "is cancelable"); diff --git a/test/utils/BaseScript.t.sol b/test/utils/BaseScript.t.sol index 764cb1eef..7302c29eb 100644 --- a/test/utils/BaseScript.t.sol +++ b/test/utils/BaseScript.t.sol @@ -17,7 +17,7 @@ contract BaseScript_Test is StdAssertions { function test_ConstructCreate2Salt() public view { string memory chainId = block.chainid.toString(); - string memory version = "1.2.0"; + string memory version = "1.3.0"; string memory salt = string.concat("ChainID ", chainId, ", Version ", version); bytes32 actualSalt = baseScript.constructCreate2Salt(); diff --git a/test/utils/Defaults.sol b/test/utils/Defaults.sol index 0bedc55ea..e057c7fc7 100644 --- a/test/utils/Defaults.sol +++ b/test/utils/Defaults.sol @@ -136,17 +136,14 @@ contract Defaults is Constants, Merkle { return Lockup.CreateAmounts({ deposit: DEPOSIT_AMOUNT, brokerFee: BROKER_FEE_AMOUNT }); } - // TODO: Check this function. function lockupDynamicTimestamps() public view returns (Lockup.Timestamps memory) { return Lockup.Timestamps({ start: START_TIME, cliff: 0, end: END_TIME }); } - // TODO: Check this function. function lockupLinearTimestamps() public view returns (Lockup.Timestamps memory) { return Lockup.Timestamps({ start: START_TIME, cliff: CLIFF_TIME, end: END_TIME }); } - // TODO: Check this function. function lockupTranchedTimestamps() public view returns (Lockup.Timestamps memory) { return Lockup.Timestamps({ start: START_TIME, cliff: 0, end: END_TIME }); } @@ -206,12 +203,8 @@ contract Defaults is Constants, Merkle { CREATE-PARAMS //////////////////////////////////////////////////////////////////////////*/ - function createWithDurationsLD() - public - view - returns (Lockup.CreateWithDurations memory params_, LockupDynamic.SegmentWithDuration[] memory segments_) - { - params_ = Lockup.CreateWithDurations({ + function createWithDurations() public view returns (Lockup.CreateWithDurations memory) { + return Lockup.CreateWithDurations({ sender: users.sender, recipient: users.recipient, totalAmount: TOTAL_AMOUNT, @@ -220,133 +213,16 @@ contract Defaults is Constants, Merkle { transferable: true, broker: broker() }); - segments_ = segmentsWithDurations(); } - function createWithDurationsBrokerNullLD() - public - view - returns (Lockup.CreateWithDurations memory params_, LockupDynamic.SegmentWithDuration[] memory segments_) - { - (params_, segments_) = createWithDurationsLD(); + function createWithDurationsBrokerNull() public view returns (Lockup.CreateWithDurations memory params_) { + params_ = createWithDurations(); params_.totalAmount = DEPOSIT_AMOUNT; params_.broker = brokerNull(); } - function createWithDurationsLL() - public - view - returns (Lockup.CreateWithDurations memory params_, LockupLinear.Durations memory durations_) - { - params_ = Lockup.CreateWithDurations({ - sender: users.sender, - recipient: users.recipient, - totalAmount: TOTAL_AMOUNT, - asset: asset, - cancelable: true, - transferable: true, - broker: broker() - }); - durations_ = durations(); - } - - function createWithDurationsBrokerNullLL() - public - view - returns (Lockup.CreateWithDurations memory params_, LockupLinear.Durations memory durations_) - { - (params_, durations_) = createWithDurationsLL(); - params_.totalAmount = DEPOSIT_AMOUNT; - params_.broker = brokerNull(); - } - - function createWithDurationsLT() - public - view - returns (Lockup.CreateWithDurations memory params_, LockupTranched.TrancheWithDuration[] memory tranches_) - { - params_ = Lockup.CreateWithDurations({ - sender: users.sender, - recipient: users.recipient, - totalAmount: TOTAL_AMOUNT, - asset: asset, - cancelable: true, - transferable: true, - broker: broker() - }); - tranches_ = tranchesWithDurations(); - } - - function createWithDurationsBrokerNullLT() - public - view - returns (Lockup.CreateWithDurations memory params_, LockupTranched.TrancheWithDuration[] memory tranches_) - { - (params_, tranches_) = createWithDurationsLT(); - params_.totalAmount = DEPOSIT_AMOUNT; - params_.broker = brokerNull(); - } - - function createWithTimestampsLD() - public - view - returns (Lockup.CreateWithTimestamps memory params_, LockupDynamic.Segment[] memory segments_) - { - params_ = Lockup.CreateWithTimestamps({ - sender: users.sender, - recipient: users.recipient, - totalAmount: TOTAL_AMOUNT, - asset: asset, - cancelable: true, - transferable: true, - startTime: START_TIME, - endTime: END_TIME, - broker: broker() - }); - segments_ = segments(); - } - - function createWithTimestampsBrokerNullLD() - public - view - returns (Lockup.CreateWithTimestamps memory params_, LockupDynamic.Segment[] memory segments_) - { - (params_, segments_) = createWithTimestampsLD(); - params_.totalAmount = DEPOSIT_AMOUNT; - params_.broker = brokerNull(); - } - - function createWithTimestampsLL() public view returns (Lockup.CreateWithTimestamps memory params_, uint40 cliff_) { - params_ = Lockup.CreateWithTimestamps({ - sender: users.sender, - recipient: users.recipient, - totalAmount: TOTAL_AMOUNT, - asset: asset, - cancelable: true, - transferable: true, - startTime: START_TIME, - endTime: END_TIME, - broker: broker() - }); - cliff_ = CLIFF_TIME; - } - - function createWithTimestampsBrokerNullLL() - public - view - returns (Lockup.CreateWithTimestamps memory params_, uint40 cliff_) - { - (params_, cliff_) = createWithTimestampsLL(); - params_.totalAmount = DEPOSIT_AMOUNT; - params_.broker = brokerNull(); - } - - function createWithTimestampsLT() - public - view - returns (Lockup.CreateWithTimestamps memory params_, LockupTranched.Tranche[] memory tranches_) - { - params_ = Lockup.CreateWithTimestamps({ + function createWithTimestamps() public view returns (Lockup.CreateWithTimestamps memory) { + return Lockup.CreateWithTimestamps({ sender: users.sender, recipient: users.recipient, totalAmount: TOTAL_AMOUNT, @@ -357,15 +233,10 @@ contract Defaults is Constants, Merkle { endTime: END_TIME, broker: broker() }); - tranches_ = tranches(); } - function createWithTimestampsBrokerNullLT() - public - view - returns (Lockup.CreateWithTimestamps memory params_, LockupTranched.Tranche[] memory tranches_) - { - (params_, tranches_) = createWithTimestampsLT(); + function createWithTimestampsBrokerNull() public view returns (Lockup.CreateWithTimestamps memory params_) { + params_ = createWithTimestamps(); params_.totalAmount = DEPOSIT_AMOUNT; params_.broker = brokerNull(); } @@ -380,23 +251,17 @@ contract Defaults is Constants, Merkle { /// @dev Returns a default-size batch of {BatchLockup.CreateWithDurationsLD} parameters. function batchCreateWithDurationsLD() public view returns (BatchLockup.CreateWithDurationsLD[] memory batch) { - (Lockup.CreateWithDurations memory params_, LockupDynamic.SegmentWithDuration[] memory segments_) = - createWithDurationsBrokerNullLD(); - batch = BatchLockupBuilder.fillBatch(params_, segments_, BATCH_SIZE); + batch = BatchLockupBuilder.fillBatch(createWithDurationsBrokerNull(), segmentsWithDurations(), BATCH_SIZE); } /// @dev Returns a default-size batch of {BatchLockup.CreateWithDurationsLL} parameters. function batchCreateWithDurationsLL() public view returns (BatchLockup.CreateWithDurationsLL[] memory batch) { - (Lockup.CreateWithDurations memory params_, LockupLinear.Durations memory durations_) = - createWithDurationsBrokerNullLL(); - batch = BatchLockupBuilder.fillBatch(params_, durations_, BATCH_SIZE); + batch = BatchLockupBuilder.fillBatch(createWithDurationsBrokerNull(), durations(), BATCH_SIZE); } /// @dev Returns a default-size batch of {BatchLockup.CreateWithDurationsLT} parameters. function batchCreateWithDurationsLT() public view returns (BatchLockup.CreateWithDurationsLT[] memory batch) { - (Lockup.CreateWithDurations memory params_, LockupTranched.TrancheWithDuration[] memory tranches_) = - createWithDurationsBrokerNullLT(); - batch = BatchLockupBuilder.fillBatch(params_, tranches_, BATCH_SIZE); + batch = BatchLockupBuilder.fillBatch(createWithDurationsBrokerNull(), tranchesWithDurations(), BATCH_SIZE); } /// @dev Returns a default-size batch of {BatchLockup.CreateWithTimestampsLD} parameters. @@ -410,9 +275,7 @@ contract Defaults is Constants, Merkle { view returns (BatchLockup.CreateWithTimestampsLD[] memory batch) { - (Lockup.CreateWithTimestamps memory params_, LockupDynamic.Segment[] memory segments_) = - createWithTimestampsBrokerNullLD(); - batch = BatchLockupBuilder.fillBatch(params_, segments_, batchSize); + batch = BatchLockupBuilder.fillBatch(createWithTimestampsBrokerNull(), segments(), batchSize); } /// @dev Returns a default-size batch of {BatchLockup.CreateWithTimestampsLL} parameters. @@ -426,8 +289,7 @@ contract Defaults is Constants, Merkle { view returns (BatchLockup.CreateWithTimestampsLL[] memory batch) { - (Lockup.CreateWithTimestamps memory params_, uint40 cliff_) = createWithTimestampsBrokerNullLL(); - batch = BatchLockupBuilder.fillBatch(params_, cliff_, batchSize); + batch = BatchLockupBuilder.fillBatch(createWithTimestampsBrokerNull(), CLIFF_TIME, batchSize); } /// @dev Returns a default-size batch of {BatchLockup.CreateWithTimestampsLT} parameters. @@ -441,9 +303,7 @@ contract Defaults is Constants, Merkle { view returns (BatchLockup.CreateWithTimestampsLT[] memory batch) { - (Lockup.CreateWithTimestamps memory params_, LockupTranched.Tranche[] memory tranches_) = - createWithTimestampsBrokerNullLT(); - batch = BatchLockupBuilder.fillBatch(params_, tranches_, batchSize); + batch = BatchLockupBuilder.fillBatch(createWithTimestampsBrokerNull(), tranches(), batchSize); } /*////////////////////////////////////////////////////////////////////////// diff --git a/test/utils/Modifiers.sol b/test/utils/Modifiers.sol index 190f7f6d9..66b2a2f2a 100644 --- a/test/utils/Modifiers.sol +++ b/test/utils/Modifiers.sol @@ -245,6 +245,10 @@ abstract contract Modifiers is Fuzzers { _; } + modifier whenCallerAuthorizedForAll() virtual { + _; + } + /*////////////////////////////////////////////////////////////////////////// CREATE-COMMON //////////////////////////////////////////////////////////////////////////*/ @@ -538,4 +542,8 @@ abstract contract Modifiers is Fuzzers { modifier givenTransferableStream() { _; } + + modifier whenCallerAuthorizedAllStreams() virtual { + _; + } }