diff --git a/benchmark/Benchmark.t.sol b/benchmark/Benchmark.t.sol index b2aaa3afe..7e8792532 100644 --- a/benchmark/Benchmark.t.sol +++ b/benchmark/Benchmark.t.sol @@ -14,7 +14,6 @@ abstract contract Benchmark_Test is Base_Test { uint128 internal immutable AMOUNT_PER_SEGMENT = 100e18; uint128 internal immutable AMOUNT_PER_TRANCHE = 100e18; - uint256[7] internal streamIds = [50, 51, 52, 53, 54, 55, 56]; /// @dev The directory where the benchmark files are stored. string internal benchmarkResults = "benchmark/results/"; @@ -27,6 +26,8 @@ abstract contract Benchmark_Test is Base_Test { ISablierV2Lockup internal lockup; + uint256[7] internal streamIds = [50, 51, 52, 53, 54, 55, 56]; + /*////////////////////////////////////////////////////////////////////////// SET-UP FUNCTION //////////////////////////////////////////////////////////////////////////*/ @@ -47,11 +48,11 @@ abstract contract Benchmark_Test is Base_Test { function gasBurn() internal { // Set the caller to the Recipient for `burn` and change timestamp to the end time. - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); vm.warp({ newTimestamp: defaults.END_TIME() }); - lockup.withdrawMax(streamIds[0], users.recipient0); + lockup.withdrawMax(streamIds[0], users.recipient); uint256 initialGas = gasleft(); lockup.burn(streamIds[0]); @@ -101,7 +102,7 @@ abstract contract Benchmark_Test is Base_Test { string memory gasUsed = vm.toString(initialGas - gasleft()); // Check if caller is recipient or not. - bool isCallerRecipient = caller == users.recipient0; + bool isCallerRecipient = caller == users.recipient; string memory s = isCallerRecipient ? string.concat("| `withdraw` ", extraInfo, " (by Recipient) | ") @@ -138,13 +139,13 @@ abstract contract Benchmark_Test is Base_Test { } function gasWithdraw_ByAnyone(uint256 streamId1, uint256 streamId2, string memory extraInfo) internal { - gasWithdraw_AfterEndTime(streamId1, users.sender, users.recipient0, extraInfo); - gasWithdraw_BeforeEndTime(streamId2, users.sender, users.recipient0, extraInfo); + gasWithdraw_AfterEndTime(streamId1, users.sender, users.recipient, extraInfo); + gasWithdraw_BeforeEndTime(streamId2, users.sender, users.recipient, extraInfo); } function gasWithdraw_ByRecipient(uint256 streamId1, uint256 streamId2, string memory extraInfo) internal { - gasWithdraw_AfterEndTime(streamId1, users.recipient0, users.alice, extraInfo); - gasWithdraw_BeforeEndTime(streamId2, users.recipient0, users.alice, extraInfo); + gasWithdraw_AfterEndTime(streamId1, users.recipient, users.alice, extraInfo); + gasWithdraw_BeforeEndTime(streamId2, users.recipient, users.alice, extraInfo); } /*////////////////////////////////////////////////////////////////////////// diff --git a/codecov.yml b/codecov.yml index 1ab56482e..c4868077c 100644 --- a/codecov.yml +++ b/codecov.yml @@ -7,6 +7,6 @@ coverage: ignore: - "precompiles" - "script" - - "src/libraries/NFTSVG.sol" - - "src/libraries/SVGElements.sol" + - "src/core/libraries/NFTSVG.sol" + - "src/core/libraries/SVGElements.sol" - "test" diff --git a/foundry.toml b/foundry.toml index 4959d4d8a..373e8e17e 100644 --- a/foundry.toml +++ b/foundry.toml @@ -9,9 +9,13 @@ ] gas_limit = 9223372036854775807 gas_reports = [ + "SablierV2BatchLockup", "SablierV2LockupDynamic", "SablierV2LockupLinear", "SablierV2LockupTranched", + "SablierV2MerkleLL", + "SablierV2MerkleLockupFactory", + "SablierV2MerkleLT", "SablierV2NFTDescriptor", ] optimizer = true diff --git a/precompiles/Precompiles.sol b/precompiles/Precompiles.sol index 9853f20c3..d432d6d34 100644 --- a/precompiles/Precompiles.sol +++ b/precompiles/Precompiles.sol @@ -7,7 +7,6 @@ import { ISablierV2LockupLinear } from "../src/core/interfaces/ISablierV2LockupL import { ISablierV2LockupTranched } from "../src/core/interfaces/ISablierV2LockupTranched.sol"; import { ISablierV2NFTDescriptor } from "../src/core/interfaces/ISablierV2NFTDescriptor.sol"; import { SablierV2NFTDescriptor } from "../src/core/SablierV2NFTDescriptor.sol"; - import { ISablierV2BatchLockup } from "../src/periphery/interfaces/ISablierV2BatchLockup.sol"; import { ISablierV2MerkleLockupFactory } from "../src/periphery/interfaces/ISablierV2MerkleLockupFactory.sol"; diff --git a/shell/deploy-multi-chain.sh b/shell/deploy-multi-chain.sh index a0414ff07..f67e93a02 100755 --- a/shell/deploy-multi-chain.sh +++ b/shell/deploy-multi-chain.sh @@ -141,7 +141,7 @@ else echo -e "${WC}Missing '.env.deployment'. Provide details below: ${NC}\n" # initialize chains - initialize_interactive + initialize_interactive fi # Check for arguments passed to the script @@ -201,7 +201,7 @@ for ((i=1; i<=$#; i++)); do # Check if '--script' flag is provided in the arguments if [[ ${arg} == "--script" || ${arg} == "-s" ]]; then - files=(script/*.s.sol) + files=(script/**/*.s.sol) # Present the list of available scripts echo "Please select a script:" diff --git a/test/Base.t.sol b/test/Base.t.sol index 9908c0445..23be527f9 100644 --- a/test/Base.t.sol +++ b/test/Base.t.sol @@ -11,8 +11,11 @@ import { SablierV2LockupDynamic } from "src/core/SablierV2LockupDynamic.sol"; import { SablierV2LockupLinear } from "src/core/SablierV2LockupLinear.sol"; import { SablierV2LockupTranched } from "src/core/SablierV2LockupTranched.sol"; import { SablierV2NFTDescriptor } from "src/core/SablierV2NFTDescriptor.sol"; +import { LockupDynamic, LockupLinear, LockupTranched } from "src/core/types/DataTypes.sol"; import { ISablierV2MerkleLockupFactory } from "src/periphery/interfaces/ISablierV2MerkleLockupFactory.sol"; import { ISablierV2BatchLockup } from "src/periphery/interfaces/ISablierV2BatchLockup.sol"; +import { ISablierV2MerkleLL } from "src/periphery/interfaces/ISablierV2MerkleLL.sol"; +import { ISablierV2MerkleLT } from "src/periphery/interfaces/ISablierV2MerkleLT.sol"; import { SablierV2BatchLockup } from "src/periphery/SablierV2BatchLockup.sol"; import { SablierV2MerkleLockupFactory } from "src/periphery/SablierV2MerkleLockupFactory.sol"; @@ -48,6 +51,8 @@ abstract contract Base_Test is Assertions, Calculations, Constants, DeployOptimi ISablierV2LockupLinear internal lockupLinear; ISablierV2LockupTranched internal lockupTranched; ISablierV2MerkleLockupFactory internal merkleLockupFactory; + ISablierV2MerkleLL internal merkleLL; + ISablierV2MerkleLT internal merkleLT; ISablierV2NFTDescriptor internal nftDescriptor; Noop internal noop; RecipientGood internal recipientGood; @@ -86,7 +91,7 @@ abstract contract Base_Test is Assertions, Calculations, Constants, DeployOptimi users.broker = createUser("Broker"); users.eve = createUser("Eve"); users.operator = createUser("Operator"); - users.recipient0 = createUser("Recipient0"); + users.recipient = createUser("Recipient"); users.recipient1 = createUser("Recipient1"); users.recipient2 = createUser("Recipient2"); users.recipient3 = createUser("Recipient3"); @@ -104,6 +109,13 @@ abstract contract Base_Test is Assertions, Calculations, Constants, DeployOptimi HELPERS //////////////////////////////////////////////////////////////////////////*/ + /// @dev Approve `spender` to spend assets from `from`. + function approveContract(IERC20 asset_, address from, address spender) internal { + resetPrank({ msgSender: from }); + (bool success,) = address(asset_).call(abi.encodeCall(IERC20.approve, (spender, MAX_UINT256))); + success; + } + /// @dev Approves all contracts to spend assets from the address passed. function approveProtocol(address from) internal { resetPrank({ msgSender: from }); @@ -156,7 +168,7 @@ abstract contract Base_Test is Assertions, Calculations, Constants, DeployOptimi } /*////////////////////////////////////////////////////////////////////////// - CALL EXPECTS + CALL EXPECTS - IERC20 //////////////////////////////////////////////////////////////////////////*/ /// @dev Expects a call to {IERC20.transfer}. @@ -178,4 +190,125 @@ abstract contract Base_Test is Assertions, Calculations, Constants, DeployOptimi function expectCallToTransferFrom(IERC20 asset, address from, address to, uint256 value) internal { vm.expectCall({ callee: address(asset), data: abi.encodeCall(IERC20.transferFrom, (from, to, value)) }); } + + /// @dev Expects multiple calls to {IERC20.transfer}. + function expectMultipleCallsToTransfer(uint64 count, address to, uint256 value) internal { + vm.expectCall({ callee: address(dai), count: count, data: abi.encodeCall(IERC20.transfer, (to, value)) }); + } + + /// @dev Expects multiple calls to {IERC20.transferFrom}. + function expectMultipleCallsToTransferFrom(uint64 count, address from, address to, uint256 value) internal { + expectMultipleCallsToTransferFrom(dai, count, from, to, value); + } + + /// @dev Expects multiple calls to {IERC20.transferFrom}. + function expectMultipleCallsToTransferFrom( + IERC20 asset, + uint64 count, + address from, + address to, + uint256 value + ) + internal + { + vm.expectCall({ + callee: address(asset), + count: count, + data: abi.encodeCall(IERC20.transferFrom, (from, to, value)) + }); + } + + /*////////////////////////////////////////////////////////////////////////// + CALL EXPECTS - LOCKUP + //////////////////////////////////////////////////////////////////////////*/ + + /// @dev Expects multiple calls to {ISablierV2LockupDynamic.createWithDurations}, each with the specified + /// `params`. + function expectMultipleCallsToCreateWithDurationsLD( + uint64 count, + LockupDynamic.CreateWithDurations memory params + ) + internal + { + vm.expectCall({ + callee: address(lockupDynamic), + count: count, + data: abi.encodeCall(ISablierV2LockupDynamic.createWithDurations, (params)) + }); + } + + /// @dev Expects multiple calls to {ISablierV2LockupLinear.createWithDurations}, each with the specified + /// `params`. + function expectMultipleCallsToCreateWithDurationsLL( + uint64 count, + LockupLinear.CreateWithDurations memory params + ) + internal + { + vm.expectCall({ + callee: address(lockupLinear), + count: count, + data: abi.encodeCall(ISablierV2LockupLinear.createWithDurations, (params)) + }); + } + + /// @dev Expects multiple calls to {ISablierV2LockupTranched.createWithDurations}, each with the specified + /// `params`. + function expectMultipleCallsToCreateWithDurationsLT( + uint64 count, + LockupTranched.CreateWithDurations memory params + ) + internal + { + vm.expectCall({ + callee: address(lockupTranched), + count: count, + data: abi.encodeCall(ISablierV2LockupTranched.createWithDurations, (params)) + }); + } + + /// @dev Expects multiple calls to {ISablierV2LockupDynamic.createWithTimestamps}, each with the specified + /// `params`. + function expectMultipleCallsToCreateWithTimestampsLD( + uint64 count, + LockupDynamic.CreateWithTimestamps memory params + ) + internal + { + vm.expectCall({ + callee: address(lockupDynamic), + count: count, + data: abi.encodeCall(ISablierV2LockupDynamic.createWithTimestamps, (params)) + }); + } + + /// @dev Expects multiple calls to {ISablierV2LockupLinear.createWithTimestamps}, each with the specified + /// `params`. + function expectMultipleCallsToCreateWithTimestampsLL( + uint64 count, + LockupLinear.CreateWithTimestamps memory params + ) + internal + { + vm.expectCall({ + callee: address(lockupLinear), + count: count, + data: abi.encodeCall(ISablierV2LockupLinear.createWithTimestamps, (params)) + }); + } + + /// @dev Expects multiple calls to {ISablierV2LockupTranched.createWithTimestamps}, each with the specified + /// `params`. + function expectMultipleCallsToCreateWithTimestampsLT( + uint64 count, + LockupTranched.CreateWithTimestamps memory params + ) + internal + { + vm.expectCall({ + callee: address(lockupTranched), + count: count, + data: abi.encodeCall(ISablierV2LockupTranched.createWithTimestamps, (params)) + }); + } } 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/createWithDurations.t.sol index 5d7baf4c2..79072fc32 100644 --- a/test/core/integration/concrete/lockup-dynamic/create-with-durations/createWithDurations.t.sol +++ b/test/core/integration/concrete/lockup-dynamic/create-with-durations/createWithDurations.t.sol @@ -146,7 +146,7 @@ contract CreateWithDurations_LockupDynamic_Integration_Concrete_Test is streamId: streamId, funder: funder, sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, amounts: defaults.lockupCreateAmounts(), asset: dai, cancelable: true, @@ -179,7 +179,7 @@ contract CreateWithDurations_LockupDynamic_Integration_Concrete_Test is // Assert that the NFT has been minted. address actualNFTOwner = lockupDynamic.ownerOf({ tokenId: streamId }); - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } } 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/createWithTimestamps.t.sol index d076dfada..f5e00fc95 100644 --- a/test/core/integration/concrete/lockup-dynamic/create-with-timestamps/createWithTimestamps.t.sol +++ b/test/core/integration/concrete/lockup-dynamic/create-with-timestamps/createWithTimestamps.t.sol @@ -353,7 +353,7 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is streamId: streamId, funder: funder, sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, amounts: defaults.lockupCreateAmounts(), segments: defaults.segments(), asset: IERC20(asset), @@ -384,7 +384,7 @@ contract CreateWithTimestamps_LockupDynamic_Integration_Concrete_Test is // Assert that the NFT has been minted. address actualNFTOwner = lockupDynamic.ownerOf({ tokenId: streamId }); - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } } 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 04e1370ed..2362e29d9 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 @@ -67,7 +67,7 @@ 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.recipient0, amount: defaults.WITHDRAW_AMOUNT() }); + lockupDynamic.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: defaults.WITHDRAW_AMOUNT() }); // Run the test. uint128 actualWithdrawableAmount = lockupDynamic.withdrawableAmountOf(defaultStreamId); 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/createWithDurations.t.sol index 039d06d58..623d87884 100644 --- a/test/core/integration/concrete/lockup-linear/create-with-durations/createWithDurations.t.sol +++ b/test/core/integration/concrete/lockup-linear/create-with-durations/createWithDurations.t.sol @@ -109,7 +109,7 @@ contract CreateWithDurations_LockupLinear_Integration_Concrete_Test is streamId: streamId, funder: funder, sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, amounts: defaults.lockupCreateAmounts(), asset: dai, cancelable: true, @@ -141,7 +141,7 @@ contract CreateWithDurations_LockupLinear_Integration_Concrete_Test is // Assert that the NFT has been minted. address actualNFTOwner = lockupLinear.ownerOf({ tokenId: streamId }); - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } } 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/createWithTimestamps.t.sol index 45435e9be..b809172e7 100644 --- a/test/core/integration/concrete/lockup-linear/create-with-timestamps/createWithTimestamps.t.sol +++ b/test/core/integration/concrete/lockup-linear/create-with-timestamps/createWithTimestamps.t.sol @@ -103,7 +103,7 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is // Assert that the NFT has been minted. address actualNFTOwner = lockupLinear.ownerOf({ tokenId: streamId }); - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } @@ -260,7 +260,7 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is streamId: streamId, funder: funder, sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, amounts: defaults.lockupCreateAmounts(), asset: IERC20(asset), cancelable: true, @@ -290,7 +290,7 @@ contract CreateWithTimestamps_LockupLinear_Integration_Concrete_Test is // Assert that the NFT has been minted. address actualNFTOwner = lockupLinear.ownerOf({ tokenId: streamId }); - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } } 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 a65fa35c4..c5a6d9d44 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 @@ -47,7 +47,7 @@ contract WithdrawableAmountOf_LockupLinear_Integration_Concrete_Test is } modifier givenPreviousWithdrawals() { - lockupLinear.withdraw({ streamId: defaultStreamId, to: users.recipient0, amount: defaults.WITHDRAW_AMOUNT() }); + lockupLinear.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: defaults.WITHDRAW_AMOUNT() }); _; } 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/createWithDurations.t.sol index 08b50dc23..b8e7a2579 100644 --- a/test/core/integration/concrete/lockup-tranched/create-with-durations/createWithDurations.t.sol +++ b/test/core/integration/concrete/lockup-tranched/create-with-durations/createWithDurations.t.sol @@ -140,7 +140,7 @@ contract CreateWithDurations_LockupTranched_Integration_Concrete_Test is streamId: streamId, funder: funder, sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, amounts: defaults.lockupCreateAmounts(), asset: dai, cancelable: true, @@ -173,7 +173,7 @@ contract CreateWithDurations_LockupTranched_Integration_Concrete_Test is // Assert that the NFT has been minted. address actualNFTOwner = lockupTranched.ownerOf({ tokenId: streamId }); - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } } 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/createWithTimestamps.t.sol index 471125ae8..4d30b16db 100644 --- a/test/core/integration/concrete/lockup-tranched/create-with-timestamps/createWithTimestamps.t.sol +++ b/test/core/integration/concrete/lockup-tranched/create-with-timestamps/createWithTimestamps.t.sol @@ -353,7 +353,7 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is streamId: streamId, funder: funder, sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, amounts: defaults.lockupCreateAmounts(), tranches: defaults.tranches(), asset: IERC20(asset), @@ -384,7 +384,7 @@ contract CreateWithTimestamps_LockupTranched_Integration_Concrete_Test is // Assert that the NFT has been minted. address actualNFTOwner = lockupTranched.ownerOf({ tokenId: streamId }); - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } } 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 a7ae4d8f6..0f1ea9bd2 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 @@ -66,7 +66,7 @@ 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.recipient0, amount: defaults.CLIFF_AMOUNT() }); + lockupTranched.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: defaults.CLIFF_AMOUNT() }); // Run the test. uint128 actualWithdrawableAmount = lockupTranched.withdrawableAmountOf(defaultStreamId); diff --git a/test/core/integration/concrete/lockup/burn/burn.t.sol b/test/core/integration/concrete/lockup/burn/burn.t.sol index 437e3f5f8..57a12ba57 100644 --- a/test/core/integration/concrete/lockup/burn/burn.t.sol +++ b/test/core/integration/concrete/lockup/burn/burn.t.sol @@ -18,7 +18,7 @@ abstract contract Burn_Integration_Concrete_Test is Integration_Test, Lockup_Int notTransferableStreamId = createDefaultStreamNotTransferable(); // Make the Recipient (owner of the NFT) the caller in this test suite. - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); } function test_RevertWhen_DelegateCalled() external { @@ -87,14 +87,14 @@ abstract contract Burn_Integration_Concrete_Test is Integration_Test, Lockup_Int vm.warp({ newTimestamp: defaults.CLIFF_TIME() }); resetPrank({ msgSender: users.sender }); lockup.cancel(streamId); - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); vm.expectRevert(abi.encodeWithSelector(Errors.SablierV2Lockup_StreamNotDepleted.selector, streamId)); lockup.burn(streamId); } modifier givenStreamHasBeenDepleted(uint256 streamId_) { vm.warp({ newTimestamp: defaults.END_TIME() }); - lockup.withdrawMax({ streamId: streamId_, to: users.recipient0 }); + lockup.withdrawMax({ streamId: streamId_, to: users.recipient }); _; } diff --git a/test/core/integration/concrete/lockup/cancel-multiple/cancelMultiple.t.sol b/test/core/integration/concrete/lockup/cancel-multiple/cancelMultiple.t.sol index e5cf0114e..a1fe88a41 100644 --- a/test/core/integration/concrete/lockup/cancel-multiple/cancelMultiple.t.sol +++ b/test/core/integration/concrete/lockup/cancel-multiple/cancelMultiple.t.sol @@ -81,11 +81,11 @@ abstract contract CancelMultiple_Integration_Concrete_Test is whenCallerUnauthorized { // Make the Recipient the caller in this test. - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); // Run the test. vm.expectRevert( - abi.encodeWithSelector(Errors.SablierV2Lockup_Unauthorized.selector, testStreamIds[0], users.recipient0) + abi.encodeWithSelector(Errors.SablierV2Lockup_Unauthorized.selector, testStreamIds[0], users.recipient) ); lockup.cancelMultiple(testStreamIds); } @@ -120,11 +120,11 @@ abstract contract CancelMultiple_Integration_Concrete_Test is whenCallerUnauthorized { // Make the Recipient the caller in this test. - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); // Run the test. vm.expectRevert( - abi.encodeWithSelector(Errors.SablierV2Lockup_Unauthorized.selector, testStreamIds[0], users.recipient0) + abi.encodeWithSelector(Errors.SablierV2Lockup_Unauthorized.selector, testStreamIds[0], users.recipient) ); lockup.cancelMultiple(testStreamIds); } @@ -181,7 +181,7 @@ abstract contract CancelMultiple_Integration_Concrete_Test is emit CancelLockupStream({ streamId: testStreamIds[0], sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, asset: dai, senderAmount: senderAmount0, recipientAmount: defaults.DEPOSIT_AMOUNT() - senderAmount0 @@ -190,7 +190,7 @@ abstract contract CancelMultiple_Integration_Concrete_Test is emit CancelLockupStream({ streamId: testStreamIds[1], sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, asset: dai, senderAmount: senderAmount1, recipientAmount: defaults.DEPOSIT_AMOUNT() - senderAmount1 @@ -213,7 +213,7 @@ abstract contract CancelMultiple_Integration_Concrete_Test is assertEq(lockup.getRefundedAmount(testStreamIds[1]), senderAmount1, "refundedAmount1"); // Assert that the NFTs have not been burned. - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(lockup.getRecipient(testStreamIds[0]), expectedNFTOwner, "NFT owner0"); assertEq(lockup.getRecipient(testStreamIds[1]), expectedNFTOwner, "NFT owner1"); } diff --git a/test/core/integration/concrete/lockup/cancel/cancel.t.sol b/test/core/integration/concrete/lockup/cancel/cancel.t.sol index 0aec17acc..4f6ba46ec 100644 --- a/test/core/integration/concrete/lockup/cancel/cancel.t.sol +++ b/test/core/integration/concrete/lockup/cancel/cancel.t.sol @@ -29,7 +29,7 @@ abstract contract Cancel_Integration_Concrete_Test is Integration_Test, Cancel_I function test_RevertGiven_StatusDepleted() external whenNotDelegateCalled givenNotNull givenStreamCold { vm.warp({ newTimestamp: defaults.END_TIME() }); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); vm.expectRevert(abi.encodeWithSelector(Errors.SablierV2Lockup_StreamDepleted.selector, defaultStreamId)); lockup.cancel(defaultStreamId); } @@ -72,11 +72,11 @@ abstract contract Cancel_Integration_Concrete_Test is Integration_Test, Cancel_I whenCallerUnauthorized { // Make the Recipient the caller in this test. - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); // Run the test. vm.expectRevert( - abi.encodeWithSelector(Errors.SablierV2Lockup_Unauthorized.selector, defaultStreamId, users.recipient0) + abi.encodeWithSelector(Errors.SablierV2Lockup_Unauthorized.selector, defaultStreamId, users.recipient) ); lockup.cancel(defaultStreamId); } diff --git a/test/core/integration/concrete/lockup/get-recipient/getRecipient.t.sol b/test/core/integration/concrete/lockup/get-recipient/getRecipient.t.sol index 13b38625c..8bfcd06ae 100644 --- a/test/core/integration/concrete/lockup/get-recipient/getRecipient.t.sol +++ b/test/core/integration/concrete/lockup/get-recipient/getRecipient.t.sol @@ -28,10 +28,10 @@ abstract contract GetRecipient_Integration_Concrete_Test is Integration_Test, Lo vm.warp({ newTimestamp: defaults.END_TIME() }); // Make the Recipient the caller. - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); // Deplete the stream. - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); // Burn the NFT. lockup.burn(defaultStreamId); @@ -47,7 +47,7 @@ abstract contract GetRecipient_Integration_Concrete_Test is Integration_Test, Lo function test_GetRecipient() external view givenNotNull givenNFTNotBurned { address actualRecipient = lockup.getRecipient(defaultStreamId); - address expectedRecipient = users.recipient0; + address expectedRecipient = users.recipient; assertEq(actualRecipient, expectedRecipient, "recipient"); } } diff --git a/test/core/integration/concrete/lockup/get-refunded-amount/getRefundedAmount.t.sol b/test/core/integration/concrete/lockup/get-refunded-amount/getRefundedAmount.t.sol index 86b56cde8..bf8632a74 100644 --- a/test/core/integration/concrete/lockup/get-refunded-amount/getRefundedAmount.t.sol +++ b/test/core/integration/concrete/lockup/get-refunded-amount/getRefundedAmount.t.sol @@ -45,7 +45,7 @@ abstract contract GetRefundedAmount_Integration_Concrete_Test is Integration_Tes { vm.warp({ newTimestamp: defaults.CLIFF_TIME() }); lockup.cancel(defaultStreamId); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); uint128 actualRefundedAmount = lockup.getRefundedAmount(defaultStreamId); uint128 expectedRefundedAmount = defaults.REFUND_AMOUNT(); assertEq(actualRefundedAmount, expectedRefundedAmount, "refundedAmount"); @@ -78,7 +78,7 @@ abstract contract GetRefundedAmount_Integration_Concrete_Test is Integration_Tes function test_GetRefundedAmount_StatusDepleted() external givenNotNull givenStreamHasNotBeenCanceled { vm.warp({ newTimestamp: defaults.END_TIME() }); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); uint128 actualRefundedAmount = lockup.getRefundedAmount(defaultStreamId); uint128 expectedRefundedAmount = 0; assertEq(actualRefundedAmount, expectedRefundedAmount, "refundedAmount"); diff --git a/test/core/integration/concrete/lockup/get-withdrawn-amount/getWithdrawnAmount.t.sol b/test/core/integration/concrete/lockup/get-withdrawn-amount/getWithdrawnAmount.t.sol index fd6198386..61614c844 100644 --- a/test/core/integration/concrete/lockup/get-withdrawn-amount/getWithdrawnAmount.t.sol +++ b/test/core/integration/concrete/lockup/get-withdrawn-amount/getWithdrawnAmount.t.sol @@ -38,7 +38,7 @@ abstract contract GetWithdrawnAmount_Integration_Concrete_Test is uint128 withdrawAmount = lockup.streamedAmountOf(defaultStreamId); // Make the withdrawal. - lockup.withdraw({ streamId: defaultStreamId, to: users.recipient0, amount: withdrawAmount }); + lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: withdrawAmount }); // Assert that the withdrawn amount has been updated. uint128 actualWithdrawnAmount = lockup.getWithdrawnAmount(defaultStreamId); diff --git a/test/core/integration/concrete/lockup/is-cold/isCold.t.sol b/test/core/integration/concrete/lockup/is-cold/isCold.t.sol index 657a73e6e..0af6bd4bc 100644 --- a/test/core/integration/concrete/lockup/is-cold/isCold.t.sol +++ b/test/core/integration/concrete/lockup/is-cold/isCold.t.sol @@ -49,7 +49,7 @@ abstract contract IsCold_Integration_Concrete_Test is Integration_Test, Lockup_I function test_IsCold_StatusDepleted() external givenNotNull { vm.warp({ newTimestamp: defaults.END_TIME() }); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); bool isCold = lockup.isCold(defaultStreamId); assertTrue(isCold, "isCold"); } diff --git a/test/core/integration/concrete/lockup/is-depleted/isDepleted.t.sol b/test/core/integration/concrete/lockup/is-depleted/isDepleted.t.sol index 6404a05e8..7ea200621 100644 --- a/test/core/integration/concrete/lockup/is-depleted/isDepleted.t.sol +++ b/test/core/integration/concrete/lockup/is-depleted/isDepleted.t.sol @@ -29,7 +29,7 @@ abstract contract IsDepleted_Integration_Concrete_Test is Integration_Test, Lock modifier givenStreamDepleted() { vm.warp({ newTimestamp: defaults.END_TIME() }); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); _; } diff --git a/test/core/integration/concrete/lockup/is-warm/isWarm.t.sol b/test/core/integration/concrete/lockup/is-warm/isWarm.t.sol index 06b017503..3ba90957f 100644 --- a/test/core/integration/concrete/lockup/is-warm/isWarm.t.sol +++ b/test/core/integration/concrete/lockup/is-warm/isWarm.t.sol @@ -49,7 +49,7 @@ abstract contract IsWarm_Integration_Concrete_Test is Integration_Test, Lockup_I function test_IsWarm_StatusDepleted() external givenNotNull { vm.warp({ newTimestamp: defaults.END_TIME() }); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); bool isWarm = lockup.isWarm(defaultStreamId); assertFalse(isWarm, "isWarm"); } diff --git a/test/core/integration/concrete/lockup/refundable-amount-of/refundableAmountOf.t.sol b/test/core/integration/concrete/lockup/refundable-amount-of/refundableAmountOf.t.sol index b6f1a419d..48fbb8057 100644 --- a/test/core/integration/concrete/lockup/refundable-amount-of/refundableAmountOf.t.sol +++ b/test/core/integration/concrete/lockup/refundable-amount-of/refundableAmountOf.t.sol @@ -60,7 +60,7 @@ abstract contract RefundableAmountOf_Integration_Concrete_Test is Integration_Te { vm.warp({ newTimestamp: defaults.CLIFF_TIME() }); lockup.cancel(defaultStreamId); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); vm.warp({ newTimestamp: defaults.CLIFF_TIME() + 10 seconds }); uint128 actualRefundableAmount = lockup.refundableAmountOf(defaultStreamId); uint128 expectedRefundableAmount = 0; @@ -114,7 +114,7 @@ abstract contract RefundableAmountOf_Integration_Concrete_Test is Integration_Te givenStreamHasNotBeenCanceled { vm.warp({ newTimestamp: defaults.END_TIME() }); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); uint128 actualRefundableAmount = lockup.refundableAmountOf(defaultStreamId); uint128 expectedReturnableAmount = 0; assertEq(actualRefundableAmount, expectedReturnableAmount, "refundableAmount"); diff --git a/test/core/integration/concrete/lockup/renounce/renounce.t.sol b/test/core/integration/concrete/lockup/renounce/renounce.t.sol index 66cc4e4e7..ce319d185 100644 --- a/test/core/integration/concrete/lockup/renounce/renounce.t.sol +++ b/test/core/integration/concrete/lockup/renounce/renounce.t.sol @@ -40,7 +40,7 @@ abstract contract Renounce_Integration_Concrete_Test is Integration_Test, Lockup function test_RevertGiven_StatusDepleted() external whenNotDelegateCalled givenStreamCold { vm.warp({ newTimestamp: defaults.END_TIME() }); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); vm.expectRevert(abi.encodeWithSelector(Errors.SablierV2Lockup_StreamDepleted.selector, defaultStreamId)); lockup.renounce(defaultStreamId); } diff --git a/test/core/integration/concrete/lockup/status-of/statusOf.t.sol b/test/core/integration/concrete/lockup/status-of/statusOf.t.sol index 4f7d34151..c426e86fa 100644 --- a/test/core/integration/concrete/lockup/status-of/statusOf.t.sol +++ b/test/core/integration/concrete/lockup/status-of/statusOf.t.sol @@ -25,7 +25,7 @@ abstract contract StatusOf_Integration_Concrete_Test is Integration_Test, Lockup function test_StatusOf_AssetsFullyWithdrawn() external givenNotNull { vm.warp({ newTimestamp: defaults.END_TIME() }); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); Lockup.Status actualStatus = lockup.statusOf(defaultStreamId); Lockup.Status expectedStatus = Lockup.Status.DEPLETED; assertEq(actualStatus, expectedStatus); diff --git a/test/core/integration/concrete/lockup/streamed-amount-of/streamedAmountOf.t.sol b/test/core/integration/concrete/lockup/streamed-amount-of/streamedAmountOf.t.sol index 3de2649f5..3fc0557ec 100644 --- a/test/core/integration/concrete/lockup/streamed-amount-of/streamedAmountOf.t.sol +++ b/test/core/integration/concrete/lockup/streamed-amount-of/streamedAmountOf.t.sol @@ -40,7 +40,7 @@ abstract contract StreamedAmountOf_Integration_Concrete_Test is { vm.warp({ newTimestamp: defaults.CLIFF_TIME() }); lockup.cancel(defaultStreamId); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); vm.warp({ newTimestamp: defaults.CLIFF_TIME() + 10 seconds }); uint128 actualStreamedAmount = lockup.streamedAmountOf(defaultStreamId); uint128 expectedStreamedAmount = defaults.CLIFF_AMOUNT(); @@ -63,7 +63,7 @@ abstract contract StreamedAmountOf_Integration_Concrete_Test is function test_StreamedAmountOf_StatusDepleted() external givenNotNull givenStreamHasNotBeenCanceled { vm.warp({ newTimestamp: defaults.END_TIME() }); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); uint128 actualStreamedAmount = lockup.streamedAmountOf(defaultStreamId); uint128 expectedStreamedAmount = defaults.DEPOSIT_AMOUNT(); assertEq(actualStreamedAmount, expectedStreamedAmount, "streamedAmount"); diff --git a/test/core/integration/concrete/lockup/transfer-from/transferFrom.t.sol b/test/core/integration/concrete/lockup/transfer-from/transferFrom.t.sol index a63c105fb..3a48922a6 100644 --- a/test/core/integration/concrete/lockup/transfer-from/transferFrom.t.sol +++ b/test/core/integration/concrete/lockup/transfer-from/transferFrom.t.sol @@ -8,7 +8,7 @@ import { Integration_Test } from "../../../Integration.t.sol"; abstract contract TransferFrom_Integration_Concrete_Test is Integration_Test, Lockup_Integration_Shared_Test { function setUp() public virtual override(Integration_Test, Lockup_Integration_Shared_Test) { - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); } function test_RevertGiven_StreamNotTransferable() external { @@ -16,7 +16,7 @@ abstract contract TransferFrom_Integration_Concrete_Test is Integration_Test, Lo vm.expectRevert( abi.encodeWithSelector(Errors.SablierV2Lockup_NotTransferable.selector, notTransferableStreamId) ); - lockup.transferFrom({ from: users.recipient0, to: users.alice, tokenId: notTransferableStreamId }); + lockup.transferFrom({ from: users.recipient, to: users.alice, tokenId: notTransferableStreamId }); } modifier givenStreamTransferable() { @@ -31,10 +31,10 @@ abstract contract TransferFrom_Integration_Concrete_Test is Integration_Test, Lo vm.expectEmit({ emitter: address(lockup) }); emit MetadataUpdate({ _tokenId: streamId }); vm.expectEmit({ emitter: address(lockup) }); - emit Transfer({ from: users.recipient0, to: users.alice, tokenId: streamId }); + emit Transfer({ from: users.recipient, to: users.alice, tokenId: streamId }); // Transfer the NFT. - lockup.transferFrom({ from: users.recipient0, to: users.alice, tokenId: streamId }); + lockup.transferFrom({ from: users.recipient, to: users.alice, tokenId: streamId }); // Assert that Alice is the new stream recipient (and NFT owner). address actualRecipient = lockup.getRecipient(streamId); diff --git a/test/core/integration/concrete/lockup/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol b/test/core/integration/concrete/lockup/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol index 3f2c26638..1430c679b 100644 --- a/test/core/integration/concrete/lockup/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol +++ b/test/core/integration/concrete/lockup/withdraw-max-and-transfer/withdrawMaxAndTransfer.t.sol @@ -24,7 +24,7 @@ abstract contract WithdrawMaxAndTransfer_Integration_Concrete_Test is function test_RevertGiven_Null() external whenNotDelegateCalled { uint256 nullStreamId = 1729; vm.expectRevert(abi.encodeWithSelector(Errors.SablierV2Lockup_Null.selector, nullStreamId)); - lockup.withdrawMaxAndTransfer({ streamId: nullStreamId, newRecipient: users.recipient0 }); + lockup.withdrawMaxAndTransfer({ streamId: nullStreamId, newRecipient: users.recipient }); } function test_RevertWhen_CallerNotCurrentRecipient() external whenNotDelegateCalled givenNotNull { @@ -41,14 +41,14 @@ abstract contract WithdrawMaxAndTransfer_Integration_Concrete_Test is function test_RevertGiven_NFTBurned() external whenNotDelegateCalled givenNotNull whenCallerCurrentRecipient { // Deplete the stream. vm.warp({ newTimestamp: defaults.END_TIME() }); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); // Burn the NFT. lockup.burn({ streamId: defaultStreamId }); // Run the test. vm.expectRevert( - abi.encodeWithSelector(Errors.SablierV2Lockup_Unauthorized.selector, defaultStreamId, users.recipient0) + abi.encodeWithSelector(Errors.SablierV2Lockup_Unauthorized.selector, defaultStreamId, users.recipient) ); lockup.withdrawMaxAndTransfer({ streamId: defaultStreamId, newRecipient: users.alice }); } @@ -61,7 +61,7 @@ abstract contract WithdrawMaxAndTransfer_Integration_Concrete_Test is givenNFTNotBurned { vm.warp({ newTimestamp: defaults.END_TIME() }); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); lockup.withdrawMaxAndTransfer({ streamId: defaultStreamId, newRecipient: users.alice }); } @@ -77,7 +77,7 @@ abstract contract WithdrawMaxAndTransfer_Integration_Concrete_Test is vm.expectRevert( abi.encodeWithSelector(Errors.SablierV2Lockup_NotTransferable.selector, notTransferableStreamId) ); - lockup.withdrawMaxAndTransfer({ streamId: notTransferableStreamId, newRecipient: users.recipient0 }); + lockup.withdrawMaxAndTransfer({ streamId: notTransferableStreamId, newRecipient: users.recipient }); } function test_WithdrawMaxAndTransfer() @@ -96,20 +96,20 @@ abstract contract WithdrawMaxAndTransfer_Integration_Concrete_Test is uint128 expectedWithdrawnAmount = lockup.withdrawableAmountOf(defaultStreamId); // Expect the assets to be transferred to the Recipient. - expectCallToTransfer({ to: users.recipient0, value: expectedWithdrawnAmount }); + expectCallToTransfer({ to: users.recipient, value: expectedWithdrawnAmount }); // Expect the relevant events to be emitted. vm.expectEmit({ emitter: address(lockup) }); emit WithdrawFromLockupStream({ streamId: defaultStreamId, - to: users.recipient0, + to: users.recipient, amount: expectedWithdrawnAmount, asset: dai }); vm.expectEmit({ emitter: address(lockup) }); emit MetadataUpdate({ _tokenId: defaultStreamId }); vm.expectEmit({ emitter: address(lockup) }); - emit Transfer({ from: users.recipient0, to: users.alice, tokenId: defaultStreamId }); + emit Transfer({ from: users.recipient, to: users.alice, tokenId: defaultStreamId }); // Make the max withdrawal and transfer the NFT. uint128 actualWithdrawnAmount = diff --git a/test/core/integration/concrete/lockup/withdraw-max/withdrawMax.t.sol b/test/core/integration/concrete/lockup/withdraw-max/withdrawMax.t.sol index 260128e87..1874af85b 100644 --- a/test/core/integration/concrete/lockup/withdraw-max/withdrawMax.t.sol +++ b/test/core/integration/concrete/lockup/withdraw-max/withdrawMax.t.sol @@ -16,19 +16,19 @@ abstract contract WithdrawMax_Integration_Concrete_Test is Integration_Test, Wit vm.warp({ newTimestamp: defaults.END_TIME() + 1 seconds }); // Expect the ERC-20 assets to be transferred to the Recipient. - expectCallToTransfer({ to: users.recipient0, value: defaults.DEPOSIT_AMOUNT() }); + expectCallToTransfer({ to: users.recipient, value: defaults.DEPOSIT_AMOUNT() }); // Expect the relevant event to be emitted. vm.expectEmit({ emitter: address(lockup) }); emit WithdrawFromLockupStream({ streamId: defaultStreamId, - to: users.recipient0, + to: users.recipient, amount: defaults.DEPOSIT_AMOUNT(), asset: dai }); // Make the max withdrawal. - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); // Assert that the withdrawn amount has been updated. uint128 actualWithdrawnAmount = lockup.getWithdrawnAmount(defaultStreamId); @@ -46,7 +46,7 @@ abstract contract WithdrawMax_Integration_Concrete_Test is Integration_Test, Wit // Assert that the NFT has not been burned. address actualNFTowner = lockup.ownerOf({ tokenId: defaultStreamId }); - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(actualNFTowner, expectedNFTOwner, "NFT owner"); } @@ -58,19 +58,19 @@ abstract contract WithdrawMax_Integration_Concrete_Test is Integration_Test, Wit uint128 expectedWithdrawnAmount = lockup.withdrawableAmountOf(defaultStreamId); // Expect the assets to be transferred to the Recipient. - expectCallToTransfer({ to: users.recipient0, value: expectedWithdrawnAmount }); + expectCallToTransfer({ to: users.recipient, value: expectedWithdrawnAmount }); // Expect the relevant event to be emitted. vm.expectEmit({ emitter: address(lockup) }); emit WithdrawFromLockupStream({ streamId: defaultStreamId, - to: users.recipient0, + to: users.recipient, amount: expectedWithdrawnAmount, asset: dai }); // Make the max withdrawal. - uint128 actualWithdrawnAmount = lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + uint128 actualWithdrawnAmount = lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); // Assert that the withdrawn amount has been updated. assertEq(actualWithdrawnAmount, expectedWithdrawnAmount, "withdrawnAmount"); diff --git a/test/core/integration/concrete/lockup/withdraw-multiple/withdrawMultiple.t.sol b/test/core/integration/concrete/lockup/withdraw-multiple/withdrawMultiple.t.sol index dc47ab507..f49c86a23 100644 --- a/test/core/integration/concrete/lockup/withdraw-multiple/withdrawMultiple.t.sol +++ b/test/core/integration/concrete/lockup/withdraw-multiple/withdrawMultiple.t.sol @@ -97,7 +97,7 @@ abstract contract WithdrawMultiple_Integration_Concrete_Test is vm.warp({ newTimestamp: defaults.END_TIME() }); // Deplete the first test stream. - lockup.withdrawMax({ streamId: testStreamIds[0], to: users.recipient0 }); + lockup.withdrawMax({ streamId: testStreamIds[0], to: users.recipient }); // Expect the relevant error to be thrown. vm.expectRevert(abi.encodeWithSelector(Errors.SablierV2Lockup_StreamDepleted.selector, testStreamIds[0])); @@ -117,7 +117,7 @@ abstract contract WithdrawMultiple_Integration_Concrete_Test is vm.warp({ newTimestamp: defaults.END_TIME() }); // Deplete the first test stream. - lockup.withdrawMax({ streamId: testStreamIds[0], to: users.recipient0 }); + lockup.withdrawMax({ streamId: testStreamIds[0], to: users.recipient }); // Expect the relevant error to be thrown. vm.expectRevert(abi.encodeWithSelector(Errors.SablierV2Lockup_StreamDepleted.selector, testStreamIds[0])); @@ -190,29 +190,29 @@ abstract contract WithdrawMultiple_Integration_Concrete_Test is resetPrank({ msgSender: caller }); // Expect the withdrawals to be made. - expectCallToTransfer({ to: users.recipient0, value: testAmounts[0] }); - expectCallToTransfer({ to: users.recipient0, value: testAmounts[1] }); - expectCallToTransfer({ to: users.recipient0, value: testAmounts[2] }); + expectCallToTransfer({ to: users.recipient, value: testAmounts[0] }); + expectCallToTransfer({ to: users.recipient, value: testAmounts[1] }); + expectCallToTransfer({ to: users.recipient, value: testAmounts[2] }); // Expect the relevant events to be emitted. vm.expectEmit({ emitter: address(lockup) }); emit WithdrawFromLockupStream({ streamId: testStreamIds[0], - to: users.recipient0, + to: users.recipient, asset: dai, amount: testAmounts[0] }); vm.expectEmit({ emitter: address(lockup) }); emit WithdrawFromLockupStream({ streamId: testStreamIds[1], - to: users.recipient0, + to: users.recipient, asset: dai, amount: testAmounts[1] }); vm.expectEmit({ emitter: address(lockup) }); emit WithdrawFromLockupStream({ streamId: testStreamIds[2], - to: users.recipient0, + to: users.recipient, asset: dai, amount: testAmounts[2] }); @@ -231,8 +231,8 @@ abstract contract WithdrawMultiple_Integration_Concrete_Test is assertEq(lockup.getWithdrawnAmount(testStreamIds[2]), testAmounts[2], "withdrawnAmount2"); // Assert that the stream NFTs have not been burned. - assertEq(lockup.getRecipient(testStreamIds[0]), users.recipient0, "NFT owner0"); - assertEq(lockup.getRecipient(testStreamIds[1]), users.recipient0, "NFT owner1"); - assertEq(lockup.getRecipient(testStreamIds[2]), users.recipient0, "NFT owner2"); + 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"); } } diff --git a/test/core/integration/concrete/lockup/withdraw/withdraw.t.sol b/test/core/integration/concrete/lockup/withdraw/withdraw.t.sol index d14bef221..4d4247b37 100644 --- a/test/core/integration/concrete/lockup/withdraw/withdraw.t.sol +++ b/test/core/integration/concrete/lockup/withdraw/withdraw.t.sol @@ -22,7 +22,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test, Withdr function test_RevertWhen_DelegateCalled() external { uint128 withdrawAmount = defaults.WITHDRAW_AMOUNT(); bytes memory callData = - abi.encodeCall(ISablierV2Lockup.withdraw, (defaultStreamId, users.recipient0, withdrawAmount)); + abi.encodeCall(ISablierV2Lockup.withdraw, (defaultStreamId, users.recipient, withdrawAmount)); (bool success, bytes memory returnData) = address(lockup).delegatecall(callData); expectRevertDueToDelegateCall(success, returnData); } @@ -31,16 +31,16 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test, Withdr uint256 nullStreamId = 1729; uint128 withdrawAmount = defaults.WITHDRAW_AMOUNT(); vm.expectRevert(abi.encodeWithSelector(Errors.SablierV2Lockup_Null.selector, nullStreamId)); - lockup.withdraw({ streamId: nullStreamId, to: users.recipient0, amount: withdrawAmount }); + lockup.withdraw({ streamId: nullStreamId, to: users.recipient, amount: withdrawAmount }); } function test_RevertGiven_StreamDepleted() external whenNotDelegateCalled givenNotNull { vm.warp({ newTimestamp: defaults.END_TIME() }); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); uint128 withdrawAmount = defaults.WITHDRAW_AMOUNT(); vm.expectRevert(abi.encodeWithSelector(Errors.SablierV2Lockup_StreamDepleted.selector, defaultStreamId)); - lockup.withdraw({ streamId: defaultStreamId, to: users.recipient0, amount: withdrawAmount }); + lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: withdrawAmount }); } function test_RevertWhen_ToZeroAddress() external whenNotDelegateCalled givenNotNull givenStreamNotDepleted { @@ -57,7 +57,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test, Withdr whenToNonZeroAddress { vm.expectRevert(abi.encodeWithSelector(Errors.SablierV2Lockup_WithdrawAmountZero.selector, defaultStreamId)); - lockup.withdraw({ streamId: defaultStreamId, to: users.recipient0, amount: 0 }); + lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: 0 }); } function test_RevertWhen_Overdraw() @@ -74,7 +74,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test, Withdr Errors.SablierV2Lockup_Overdraw.selector, defaultStreamId, MAX_UINT128, withdrawableAmount ) ); - lockup.withdraw({ streamId: defaultStreamId, to: users.recipient0, amount: MAX_UINT128 }); + lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: MAX_UINT128 }); } function test_RevertWhen_CallerUnknown() @@ -139,7 +139,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test, Withdr whenWithdrawalAddressNotRecipient { // Transfer the stream to Alice. - lockup.transferFrom(users.recipient0, users.alice, defaultStreamId); + lockup.transferFrom(users.recipient, users.alice, defaultStreamId); // Run the test. uint128 withdrawAmount = defaults.WITHDRAW_AMOUNT(); @@ -147,11 +147,11 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test, Withdr abi.encodeWithSelector( Errors.SablierV2Lockup_WithdrawalAddressNotRecipient.selector, defaultStreamId, - users.recipient0, - users.recipient0 + users.recipient, + users.recipient ) ); - lockup.withdraw({ streamId: defaultStreamId, to: users.recipient0, amount: withdrawAmount }); + lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: withdrawAmount }); } function test_Withdraw_CallerApprovedOperator() @@ -233,7 +233,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test, Withdr vm.warp({ newTimestamp: defaults.WARP_26_PERCENT() }); // Make the withdrawal. - lockup.withdraw({ streamId: defaultStreamId, to: users.recipient0, amount: defaults.WITHDRAW_AMOUNT() }); + lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: defaults.WITHDRAW_AMOUNT() }); // Assert that the withdrawn amount has been updated. uint128 actualWithdrawnAmount = lockup.getWithdrawnAmount(defaultStreamId); @@ -255,7 +255,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test, Withdr vm.warp({ newTimestamp: defaults.WARP_26_PERCENT() }); // Make the withdrawal. - lockup.withdraw({ streamId: defaultStreamId, to: users.recipient0, amount: defaults.WITHDRAW_AMOUNT() }); + lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: defaults.WITHDRAW_AMOUNT() }); // Assert that the withdrawn amount has been updated. uint128 actualWithdrawnAmount = lockup.getWithdrawnAmount(defaultStreamId); @@ -278,7 +278,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test, Withdr vm.warp({ newTimestamp: defaults.END_TIME() }); // Make the withdrawal. - lockup.withdraw({ streamId: defaultStreamId, to: users.recipient0, amount: defaults.DEPOSIT_AMOUNT() }); + lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: defaults.DEPOSIT_AMOUNT() }); // Assert that the stream's status is "DEPLETED". Lockup.Status actualStatus = lockup.statusOf(defaultStreamId); @@ -291,7 +291,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test, Withdr // Assert that the NFT has not been burned. address actualNFTowner = lockup.ownerOf({ tokenId: defaultStreamId }); - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(actualNFTowner, expectedNFTOwner, "NFT owner"); } @@ -314,7 +314,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test, Withdr uint128 withdrawAmount = lockup.withdrawableAmountOf(defaultStreamId); // Make the withdrawal. - lockup.withdraw({ streamId: defaultStreamId, to: users.recipient0, amount: withdrawAmount }); + lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: withdrawAmount }); // Assert that the stream's status is "DEPLETED". Lockup.Status actualStatus = lockup.statusOf(defaultStreamId); @@ -328,7 +328,7 @@ abstract contract Withdraw_Integration_Concrete_Test is Integration_Test, Withdr // Assert that the NFT has not been burned. address actualNFTowner = lockup.ownerOf({ tokenId: defaultStreamId }); - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(actualNFTowner, expectedNFTOwner, "NFT owner"); } diff --git a/test/core/integration/concrete/lockup/withdrawable-amount-of/withdrawableAmountOf.t.sol b/test/core/integration/concrete/lockup/withdrawable-amount-of/withdrawableAmountOf.t.sol index f038c2b3e..bdccef21b 100644 --- a/test/core/integration/concrete/lockup/withdrawable-amount-of/withdrawableAmountOf.t.sol +++ b/test/core/integration/concrete/lockup/withdrawable-amount-of/withdrawableAmountOf.t.sol @@ -40,7 +40,7 @@ abstract contract WithdrawableAmountOf_Integration_Concrete_Test is { vm.warp({ newTimestamp: defaults.CLIFF_TIME() }); lockup.cancel(defaultStreamId); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); vm.warp({ newTimestamp: defaults.CLIFF_TIME() + 10 seconds }); uint128 actualWithdrawableAmount = lockup.withdrawableAmountOf(defaultStreamId); uint128 expectedWithdrawableAmount = 0; @@ -63,7 +63,7 @@ abstract contract WithdrawableAmountOf_Integration_Concrete_Test is function test_WithdrawableAmountOf_StatusDepleted() external givenNotNull givenStreamHasNotBeenCanceled { vm.warp({ newTimestamp: defaults.END_TIME() }); - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); uint128 actualWithdrawableAmount = lockup.withdrawableAmountOf(defaultStreamId); uint128 expectedWithdrawableAmount = 0; assertEq(actualWithdrawableAmount, expectedWithdrawableAmount, "withdrawableAmount"); diff --git a/test/core/integration/fuzz/lockup-dynamic/createWithDurations.t.sol b/test/core/integration/fuzz/lockup-dynamic/createWithDurations.t.sol index 7d359064c..4dc092c94 100644 --- a/test/core/integration/fuzz/lockup-dynamic/createWithDurations.t.sol +++ b/test/core/integration/fuzz/lockup-dynamic/createWithDurations.t.sol @@ -77,7 +77,7 @@ contract CreateWithDurations_LockupDynamic_Integration_Fuzz_Test is streamId: streamId, funder: vars.funder, sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, amounts: vars.createAmounts, asset: dai, cancelable: true, @@ -108,7 +108,7 @@ contract CreateWithDurations_LockupDynamic_Integration_Fuzz_Test is assertEq(actualStream.isDepleted, false, "isDepleted"); assertEq(actualStream.isStream, true, "isStream"); assertEq(actualStream.isTransferable, true, "isTransferable"); - assertEq(actualStream.recipient, users.recipient0, "recipient"); + assertEq(actualStream.recipient, users.recipient, "recipient"); assertEq(actualStream.segments, vars.segmentsWithTimestamps, "segments"); assertEq(actualStream.sender, users.sender, "sender"); assertEq(actualStream.startTime, timestamps.start, "startTime"); @@ -126,7 +126,7 @@ contract CreateWithDurations_LockupDynamic_Integration_Fuzz_Test is // Assert that the NFT has been minted. vars.actualNFTOwner = lockupDynamic.ownerOf({ tokenId: streamId }); - vars.expectedNFTOwner = users.recipient0; + vars.expectedNFTOwner = users.recipient; assertEq(vars.actualNFTOwner, vars.expectedNFTOwner, "NFT owner"); } } diff --git a/test/core/integration/fuzz/lockup-dynamic/withdraw.t.sol b/test/core/integration/fuzz/lockup-dynamic/withdraw.t.sol index 9c5fe5399..b4c241bd3 100644 --- a/test/core/integration/fuzz/lockup-dynamic/withdraw.t.sol +++ b/test/core/integration/fuzz/lockup-dynamic/withdraw.t.sol @@ -102,7 +102,7 @@ contract Withdraw_LockupDynamic_Integration_Fuzz_Test is emit MetadataUpdate({ _tokenId: vars.streamId }); // Make the Recipient the caller. - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); // Make the withdrawal. lockupDynamic.withdraw({ streamId: vars.streamId, to: params.to, amount: vars.withdrawAmount }); diff --git a/test/core/integration/fuzz/lockup-dynamic/withdrawableAmountOf.t.sol b/test/core/integration/fuzz/lockup-dynamic/withdrawableAmountOf.t.sol index 1f3b672d3..719b6b619 100644 --- a/test/core/integration/fuzz/lockup-dynamic/withdrawableAmountOf.t.sol +++ b/test/core/integration/fuzz/lockup-dynamic/withdrawableAmountOf.t.sol @@ -92,7 +92,7 @@ contract WithdrawableAmountOf_LockupDynamic_Integration_Fuzz_Test is withdrawAmount = boundUint128(withdrawAmount, 1, streamedAmount); // Make the withdrawal. - lockupDynamic.withdraw({ streamId: streamId, to: users.recipient0, amount: withdrawAmount }); + lockupDynamic.withdraw({ streamId: streamId, to: users.recipient, amount: withdrawAmount }); // Run the test. uint128 actualWithdrawableAmount = lockupDynamic.withdrawableAmountOf(streamId); diff --git a/test/core/integration/fuzz/lockup-linear/createWithDurations.t.sol b/test/core/integration/fuzz/lockup-linear/createWithDurations.t.sol index 50613f004..8a0900bb4 100644 --- a/test/core/integration/fuzz/lockup-linear/createWithDurations.t.sol +++ b/test/core/integration/fuzz/lockup-linear/createWithDurations.t.sol @@ -79,7 +79,7 @@ contract CreateWithDurations_LockupLinear_Integration_Fuzz_Test is streamId: streamId, funder: funder, sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, amounts: defaults.lockupCreateAmounts(), asset: dai, cancelable: true, @@ -111,7 +111,7 @@ contract CreateWithDurations_LockupLinear_Integration_Fuzz_Test is // Assert that the NFT has been minted. address actualNFTOwner = lockupLinear.ownerOf({ tokenId: streamId }); - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(actualNFTOwner, expectedNFTOwner, "NFT owner"); } } diff --git a/test/core/integration/fuzz/lockup-linear/withdrawableAmountOf.t.sol b/test/core/integration/fuzz/lockup-linear/withdrawableAmountOf.t.sol index ed871061e..68f2469bf 100644 --- a/test/core/integration/fuzz/lockup-linear/withdrawableAmountOf.t.sol +++ b/test/core/integration/fuzz/lockup-linear/withdrawableAmountOf.t.sol @@ -119,7 +119,7 @@ contract WithdrawableAmountOf_LockupLinear_Integration_Fuzz_Test is withdrawAmount = boundUint128(withdrawAmount, 1, streamedAmount); // Make the withdrawal. - lockupLinear.withdraw({ streamId: streamId, to: users.recipient0, amount: withdrawAmount }); + lockupLinear.withdraw({ streamId: streamId, to: users.recipient, amount: withdrawAmount }); // Run the test. uint128 actualWithdrawableAmount = lockupLinear.withdrawableAmountOf(streamId); diff --git a/test/core/integration/fuzz/lockup-tranched/createWithDurations.t.sol b/test/core/integration/fuzz/lockup-tranched/createWithDurations.t.sol index eadeff6ab..1c4396ea5 100644 --- a/test/core/integration/fuzz/lockup-tranched/createWithDurations.t.sol +++ b/test/core/integration/fuzz/lockup-tranched/createWithDurations.t.sol @@ -77,7 +77,7 @@ contract CreateWithDurations_LockupTranched_Integration_Fuzz_Test is streamId: streamId, funder: vars.funder, sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, amounts: vars.createAmounts, asset: dai, cancelable: true, @@ -126,7 +126,7 @@ contract CreateWithDurations_LockupTranched_Integration_Fuzz_Test is // Assert that the NFT has been minted. vars.actualNFTOwner = lockupTranched.ownerOf({ tokenId: streamId }); - vars.expectedNFTOwner = users.recipient0; + vars.expectedNFTOwner = users.recipient; assertEq(vars.actualNFTOwner, vars.expectedNFTOwner, "NFT owner"); } } diff --git a/test/core/integration/fuzz/lockup-tranched/withdraw.t.sol b/test/core/integration/fuzz/lockup-tranched/withdraw.t.sol index 1bc5349e2..153062f3b 100644 --- a/test/core/integration/fuzz/lockup-tranched/withdraw.t.sol +++ b/test/core/integration/fuzz/lockup-tranched/withdraw.t.sol @@ -93,7 +93,7 @@ contract Withdraw_LockupTranched_Integration_Fuzz_Test is vars.withdrawAmount = boundUint128(vars.withdrawAmount, 1, vars.withdrawableAmount); // Make the Recipient the caller. - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); // Expect the assets to be transferred to the fuzzed `to` address. expectCallToTransfer({ to: params.to, value: vars.withdrawAmount }); diff --git a/test/core/integration/fuzz/lockup-tranched/withdrawableAmountOf.t.sol b/test/core/integration/fuzz/lockup-tranched/withdrawableAmountOf.t.sol index 868e2b014..74cb15aaf 100644 --- a/test/core/integration/fuzz/lockup-tranched/withdrawableAmountOf.t.sol +++ b/test/core/integration/fuzz/lockup-tranched/withdrawableAmountOf.t.sol @@ -94,7 +94,7 @@ contract WithdrawableAmountOf_LockupTranched_Integration_Fuzz_Test is withdrawAmount = boundUint128(withdrawAmount, 1, streamedAmount); // Make the withdrawal. - lockupTranched.withdraw({ streamId: streamId, to: users.recipient0, amount: withdrawAmount }); + lockupTranched.withdraw({ streamId: streamId, to: users.recipient, amount: withdrawAmount }); // Run the test. uint128 actualWithdrawableAmount = lockupTranched.withdrawableAmountOf(streamId); diff --git a/test/core/integration/fuzz/lockup/cancelMultiple.t.sol b/test/core/integration/fuzz/lockup/cancelMultiple.t.sol index 9e0957777..b18b52cd1 100644 --- a/test/core/integration/fuzz/lockup/cancelMultiple.t.sol +++ b/test/core/integration/fuzz/lockup/cancelMultiple.t.sol @@ -47,7 +47,7 @@ abstract contract CancelMultiple_Integration_Fuzz_Test is Integration_Test, Canc emit CancelLockupStream({ streamId: streamIds[0], sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, asset: dai, senderAmount: senderAmount0, recipientAmount: defaults.DEPOSIT_AMOUNT() - senderAmount0 @@ -56,7 +56,7 @@ abstract contract CancelMultiple_Integration_Fuzz_Test is Integration_Test, Canc emit CancelLockupStream({ streamId: streamIds[1], sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, asset: dai, senderAmount: senderAmount1, recipientAmount: defaults.DEPOSIT_AMOUNT() - senderAmount1 @@ -84,7 +84,7 @@ abstract contract CancelMultiple_Integration_Fuzz_Test is Integration_Test, Canc assertEq(lockup.getRefundedAmount(streamIds[1]), expectedRefundedAmount1, "refundedAmount1"); // Assert that the NFTs have not been burned. - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(lockup.getRecipient(streamIds[0]), expectedNFTOwner, "NFT owner0"); assertEq(lockup.getRecipient(streamIds[1]), expectedNFTOwner, "NFT owner1"); } diff --git a/test/core/integration/fuzz/lockup/getWithdrawnAmount.t.sol b/test/core/integration/fuzz/lockup/getWithdrawnAmount.t.sol index 3b8bdfded..71da96105 100644 --- a/test/core/integration/fuzz/lockup/getWithdrawnAmount.t.sol +++ b/test/core/integration/fuzz/lockup/getWithdrawnAmount.t.sol @@ -42,7 +42,7 @@ abstract contract GetWithdrawnAmount_Integration_Fuzz_Test is withdrawAmount = boundUint128(withdrawAmount, 1, streamedAmount); // Make the withdrawal. - lockup.withdraw({ streamId: defaultStreamId, to: users.recipient0, amount: withdrawAmount }); + lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: withdrawAmount }); // Assert that the withdrawn amount has been updated. uint128 actualWithdrawnAmount = lockup.getWithdrawnAmount(defaultStreamId); diff --git a/test/core/integration/fuzz/lockup/withdraw.t.sol b/test/core/integration/fuzz/lockup/withdraw.t.sol index 594a1ff4d..14835faff 100644 --- a/test/core/integration/fuzz/lockup/withdraw.t.sol +++ b/test/core/integration/fuzz/lockup/withdraw.t.sol @@ -22,7 +22,7 @@ abstract contract Withdraw_Integration_Fuzz_Test is Integration_Test, Withdraw_I whenWithdrawAmountNotZero whenNoOverdraw { - vm.assume(caller != users.sender && caller != users.recipient0); + vm.assume(caller != users.sender && caller != users.recipient); // Make the fuzzed address the caller in this test. resetPrank({ msgSender: caller }); @@ -31,7 +31,7 @@ abstract contract Withdraw_Integration_Fuzz_Test is Integration_Test, Withdraw_I vm.warp({ newTimestamp: defaults.WARP_26_PERCENT() }); // Make the withdrawal. - lockup.withdraw({ streamId: defaultStreamId, to: users.recipient0, amount: defaults.WITHDRAW_AMOUNT() }); + lockup.withdraw({ streamId: defaultStreamId, to: users.recipient, amount: defaults.WITHDRAW_AMOUNT() }); // Assert that the stream's status is still "STREAMING". Lockup.Status actualStatus = lockup.statusOf(defaultStreamId); @@ -108,7 +108,7 @@ abstract contract Withdraw_Integration_Fuzz_Test is Integration_Test, Withdraw_I // Cancel the stream. resetPrank({ msgSender: users.sender }); lockup.cancel({ streamId: defaultStreamId }); - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); // Bound the withdraw amount. uint128 withdrawableAmount = lockup.withdrawableAmountOf(defaultStreamId); @@ -142,7 +142,7 @@ abstract contract Withdraw_Integration_Fuzz_Test is Integration_Test, Withdraw_I // Assert that the NFT has not been burned. address actualNFTowner = lockup.ownerOf({ tokenId: defaultStreamId }); - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(actualNFTowner, expectedNFTOwner, "NFT owner"); } @@ -212,7 +212,7 @@ abstract contract Withdraw_Integration_Fuzz_Test is Integration_Test, Withdraw_I // Assert that the NFT has not been burned. address actualNFTowner = lockup.ownerOf({ tokenId: defaultStreamId }); - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(actualNFTowner, expectedNFTOwner, "NFT owner"); } } diff --git a/test/core/integration/fuzz/lockup/withdrawMax.t.sol b/test/core/integration/fuzz/lockup/withdrawMax.t.sol index 41760fb22..90ed13ed3 100644 --- a/test/core/integration/fuzz/lockup/withdrawMax.t.sol +++ b/test/core/integration/fuzz/lockup/withdrawMax.t.sol @@ -18,19 +18,19 @@ abstract contract WithdrawMax_Integration_Fuzz_Test is Integration_Test, Withdra vm.warp({ newTimestamp: defaults.START_TIME() + timeJump }); // Expect the ERC-20 assets to be transferred to the Recipient. - expectCallToTransfer({ to: users.recipient0, value: defaults.DEPOSIT_AMOUNT() }); + expectCallToTransfer({ to: users.recipient, value: defaults.DEPOSIT_AMOUNT() }); // Expect the relevant event to be emitted. vm.expectEmit({ emitter: address(lockup) }); emit WithdrawFromLockupStream({ streamId: defaultStreamId, - to: users.recipient0, + to: users.recipient, asset: dai, amount: defaults.DEPOSIT_AMOUNT() }); // Make the max withdrawal. - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); // Assert that the withdrawn amount has been updated. uint128 actualWithdrawnAmount = lockup.getWithdrawnAmount(defaultStreamId); @@ -48,7 +48,7 @@ abstract contract WithdrawMax_Integration_Fuzz_Test is Integration_Test, Withdra // Assert that the NFT has not been burned. address actualNFTowner = lockup.ownerOf({ tokenId: defaultStreamId }); - address expectedNFTOwner = users.recipient0; + address expectedNFTOwner = users.recipient; assertEq(actualNFTowner, expectedNFTOwner, "NFT owner"); } @@ -62,19 +62,19 @@ abstract contract WithdrawMax_Integration_Fuzz_Test is Integration_Test, Withdra uint128 withdrawAmount = lockup.withdrawableAmountOf(defaultStreamId); // Expect the assets to be transferred to the Recipient. - expectCallToTransfer({ to: users.recipient0, value: withdrawAmount }); + expectCallToTransfer({ to: users.recipient, value: withdrawAmount }); // Expect the relevant event to be emitted. vm.expectEmit({ emitter: address(lockup) }); emit WithdrawFromLockupStream({ streamId: defaultStreamId, - to: users.recipient0, + to: users.recipient, asset: dai, amount: withdrawAmount }); // Make the max withdrawal. - lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient0 }); + lockup.withdrawMax({ streamId: defaultStreamId, to: users.recipient }); // Assert that the withdrawn amount has been updated. uint128 actualWithdrawnAmount = lockup.getWithdrawnAmount(defaultStreamId); diff --git a/test/core/integration/fuzz/lockup/withdrawMaxAndTransfer.t.sol b/test/core/integration/fuzz/lockup/withdrawMaxAndTransfer.t.sol index cd4fb11e2..ecde8780a 100644 --- a/test/core/integration/fuzz/lockup/withdrawMaxAndTransfer.t.sol +++ b/test/core/integration/fuzz/lockup/withdrawMaxAndTransfer.t.sol @@ -38,13 +38,13 @@ abstract contract WithdrawMaxAndTransfer_Integration_Fuzz_Test is if (withdrawAmount > 0) { // Expect the assets to be transferred to the fuzzed recipient. - expectCallToTransfer({ to: users.recipient0, value: withdrawAmount }); + expectCallToTransfer({ to: users.recipient, value: withdrawAmount }); // Expect the relevant event to be emitted. vm.expectEmit({ emitter: address(lockup) }); emit WithdrawFromLockupStream({ streamId: defaultStreamId, - to: users.recipient0, + to: users.recipient, asset: dai, amount: withdrawAmount }); @@ -52,7 +52,7 @@ abstract contract WithdrawMaxAndTransfer_Integration_Fuzz_Test is // Expect the relevant event to be emitted. vm.expectEmit({ emitter: address(lockup) }); - emit Transfer({ from: users.recipient0, to: newRecipient, tokenId: defaultStreamId }); + emit Transfer({ from: users.recipient, to: newRecipient, tokenId: defaultStreamId }); // Make the max withdrawal and transfer the NFT. lockup.withdrawMaxAndTransfer({ streamId: defaultStreamId, newRecipient: newRecipient }); diff --git a/test/core/integration/fuzz/lockup/withdrawMultiple.t.sol b/test/core/integration/fuzz/lockup/withdrawMultiple.t.sol index ab72262a4..5ffb0d931 100644 --- a/test/core/integration/fuzz/lockup/withdrawMultiple.t.sol +++ b/test/core/integration/fuzz/lockup/withdrawMultiple.t.sol @@ -52,21 +52,21 @@ abstract contract WithdrawMultiple_Integration_Fuzz_Test is ongoingWithdrawAmount = boundUint128(ongoingWithdrawAmount, 1, ongoingWithdrawableAmount); // Expect the withdrawals to be made. - expectCallToTransfer({ to: users.recipient0, value: ongoingWithdrawAmount }); - expectCallToTransfer({ to: users.recipient0, value: settledWithdrawAmount }); + expectCallToTransfer({ to: users.recipient, value: ongoingWithdrawAmount }); + expectCallToTransfer({ to: users.recipient, value: settledWithdrawAmount }); // Expect the relevant events to be emitted. vm.expectEmit({ emitter: address(lockup) }); emit WithdrawFromLockupStream({ streamId: ongoingStreamId, - to: users.recipient0, + to: users.recipient, asset: dai, amount: ongoingWithdrawAmount }); vm.expectEmit({ emitter: address(lockup) }); emit WithdrawFromLockupStream({ streamId: settledStreamId, - to: users.recipient0, + to: users.recipient, asset: dai, amount: settledWithdrawAmount }); @@ -85,7 +85,7 @@ abstract contract WithdrawMultiple_Integration_Fuzz_Test is assertEq(lockup.getWithdrawnAmount(streamIds[1]), amounts[1], "withdrawnAmount1"); // Assert that the stream NFTs have not been burned. - assertEq(lockup.getRecipient(streamIds[0]), users.recipient0, "NFT owner0"); - assertEq(lockup.getRecipient(streamIds[1]), users.recipient0, "NFT owner1"); + assertEq(lockup.getRecipient(streamIds[0]), users.recipient, "NFT owner0"); + assertEq(lockup.getRecipient(streamIds[1]), users.recipient, "NFT owner1"); } } diff --git a/test/core/integration/shared/lockup-dynamic/LockupDynamic.t.sol b/test/core/integration/shared/lockup-dynamic/LockupDynamic.t.sol index 0bdcfaaa3..a74578e03 100644 --- a/test/core/integration/shared/lockup-dynamic/LockupDynamic.t.sol +++ b/test/core/integration/shared/lockup-dynamic/LockupDynamic.t.sol @@ -22,7 +22,7 @@ abstract contract LockupDynamic_Integration_Shared_Test is Lockup_Integration_Sh Lockup_Integration_Shared_Test.setUp(); _params.createWithDurations.sender = users.sender; - _params.createWithDurations.recipient = users.recipient0; + _params.createWithDurations.recipient = users.recipient; _params.createWithDurations.totalAmount = defaults.TOTAL_AMOUNT(); _params.createWithDurations.asset = dai; _params.createWithDurations.cancelable = true; @@ -30,7 +30,7 @@ abstract contract LockupDynamic_Integration_Shared_Test is Lockup_Integration_Sh _params.createWithDurations.broker = defaults.broker(); _params.createWithTimestamps.sender = users.sender; - _params.createWithTimestamps.recipient = users.recipient0; + _params.createWithTimestamps.recipient = users.recipient; _params.createWithTimestamps.totalAmount = defaults.TOTAL_AMOUNT(); _params.createWithTimestamps.asset = dai; _params.createWithTimestamps.cancelable = true; diff --git a/test/core/integration/shared/lockup-tranched/LockupTranched.t.sol b/test/core/integration/shared/lockup-tranched/LockupTranched.t.sol index 90a675ffa..81213515a 100644 --- a/test/core/integration/shared/lockup-tranched/LockupTranched.t.sol +++ b/test/core/integration/shared/lockup-tranched/LockupTranched.t.sol @@ -22,7 +22,7 @@ abstract contract LockupTranched_Integration_Shared_Test is Lockup_Integration_S Lockup_Integration_Shared_Test.setUp(); _params.createWithDurations.sender = users.sender; - _params.createWithDurations.recipient = users.recipient0; + _params.createWithDurations.recipient = users.recipient; _params.createWithDurations.totalAmount = defaults.TOTAL_AMOUNT(); _params.createWithDurations.asset = dai; _params.createWithDurations.cancelable = true; @@ -30,7 +30,7 @@ abstract contract LockupTranched_Integration_Shared_Test is Lockup_Integration_S _params.createWithDurations.broker = defaults.broker(); _params.createWithTimestamps.sender = users.sender; - _params.createWithTimestamps.recipient = users.recipient0; + _params.createWithTimestamps.recipient = users.recipient; _params.createWithTimestamps.totalAmount = defaults.TOTAL_AMOUNT(); _params.createWithTimestamps.asset = dai; _params.createWithTimestamps.cancelable = true; diff --git a/test/core/integration/shared/lockup/getWithdrawnAmount.t.sol b/test/core/integration/shared/lockup/getWithdrawnAmount.t.sol index dfce20e73..e7a3985ca 100644 --- a/test/core/integration/shared/lockup/getWithdrawnAmount.t.sol +++ b/test/core/integration/shared/lockup/getWithdrawnAmount.t.sol @@ -7,7 +7,7 @@ abstract contract GetWithdrawnAmount_Integration_Shared_Test is Lockup_Integrati uint256 internal defaultStreamId; function setUp() public virtual override { - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); } modifier givenNotNull() { diff --git a/test/core/integration/shared/lockup/withdraw.t.sol b/test/core/integration/shared/lockup/withdraw.t.sol index d5c53369c..75fe7fa5e 100644 --- a/test/core/integration/shared/lockup/withdraw.t.sol +++ b/test/core/integration/shared/lockup/withdraw.t.sol @@ -8,7 +8,7 @@ abstract contract Withdraw_Integration_Shared_Test is Lockup_Integration_Shared_ function setUp() public virtual override { defaultStreamId = createDefaultStream(); - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); } modifier givenEndTimeInTheFuture() { diff --git a/test/core/integration/shared/lockup/withdrawMax.t.sol b/test/core/integration/shared/lockup/withdrawMax.t.sol index 0ce0623a6..f19c3323c 100644 --- a/test/core/integration/shared/lockup/withdrawMax.t.sol +++ b/test/core/integration/shared/lockup/withdrawMax.t.sol @@ -8,7 +8,7 @@ abstract contract WithdrawMax_Integration_Shared_Test is Lockup_Integration_Shar function setUp() public virtual override { defaultStreamId = createDefaultStream(); - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); } modifier givenEndTimeInTheFuture() { diff --git a/test/core/integration/shared/lockup/withdrawMaxAndTransfer.t.sol b/test/core/integration/shared/lockup/withdrawMaxAndTransfer.t.sol index 03c5bd4b0..222cb78eb 100644 --- a/test/core/integration/shared/lockup/withdrawMaxAndTransfer.t.sol +++ b/test/core/integration/shared/lockup/withdrawMaxAndTransfer.t.sol @@ -8,7 +8,7 @@ abstract contract WithdrawMaxAndTransfer_Integration_Shared_Test is Lockup_Integ function setUp() public virtual override { defaultStreamId = createDefaultStream(); - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); } modifier givenNFTNotBurned() { diff --git a/test/core/integration/shared/lockup/withdrawMultiple.t.sol b/test/core/integration/shared/lockup/withdrawMultiple.t.sol index cd5e98baf..ca236ecff 100644 --- a/test/core/integration/shared/lockup/withdrawMultiple.t.sol +++ b/test/core/integration/shared/lockup/withdrawMultiple.t.sol @@ -58,12 +58,12 @@ abstract contract WithdrawMultiple_Integration_Shared_Test is Lockup_Integration caller = users.sender; _; createTestStreams(); - caller = users.recipient0; - resetPrank({ msgSender: users.recipient0 }); + caller = users.recipient; + resetPrank({ msgSender: users.recipient }); _; createTestStreams(); caller = users.operator; - resetPrank({ msgSender: users.recipient0 }); + resetPrank({ msgSender: users.recipient }); lockup.setApprovalForAll({ operator: users.operator, approved: true }); caller = users.operator; resetPrank({ msgSender: users.operator }); diff --git a/test/periphery/Periphery.t.sol b/test/periphery/Periphery.t.sol index 87f114cf6..8c6bc43d7 100644 --- a/test/periphery/Periphery.t.sol +++ b/test/periphery/Periphery.t.sol @@ -3,161 +3,19 @@ pragma solidity >=0.8.22 <0.9.0; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import { ISablierV2LockupDynamic } from "src/core/interfaces/ISablierV2LockupDynamic.sol"; -import { ISablierV2LockupLinear } from "src/core/interfaces/ISablierV2LockupLinear.sol"; -import { ISablierV2LockupTranched } from "src/core/interfaces/ISablierV2LockupTranched.sol"; -import { LockupDynamic, LockupLinear, LockupTranched } from "src/core/types/DataTypes.sol"; -import { ISablierV2MerkleLL } from "src/periphery/interfaces/ISablierV2MerkleLL.sol"; -import { ISablierV2MerkleLT } from "src/periphery/interfaces/ISablierV2MerkleLT.sol"; import { SablierV2MerkleLL } from "src/periphery/SablierV2MerkleLL.sol"; import { SablierV2MerkleLT } from "src/periphery/SablierV2MerkleLT.sol"; import { Base_Test } from "../Base.t.sol"; contract Periphery_Test is Base_Test { - ISablierV2MerkleLL internal merkleLL; - ISablierV2MerkleLT internal merkleLT; - /*////////////////////////////////////////////////////////////////////////// - SET-UP + SET-UP FUNCTION //////////////////////////////////////////////////////////////////////////*/ - function setUp() public virtual override { Base_Test.setUp(); } - /*////////////////////////////////////////////////////////////////////////// - HELPERS - //////////////////////////////////////////////////////////////////////////*/ - - /// @dev Approve `spender` to spend assets from `from`. - function approveContract(IERC20 asset_, address from, address spender) internal { - resetPrank({ msgSender: from }); - (bool success,) = address(asset_).call(abi.encodeCall(IERC20.approve, (spender, MAX_UINT256))); - success; - } - - /*////////////////////////////////////////////////////////////////////////// - EXPECT-CALLS - //////////////////////////////////////////////////////////////////////////*/ - - /// @dev Expects multiple calls to {ISablierV2LockupDynamic.createWithDurations}, each with the specified - /// `params`. - function expectMultipleCallsToCreateWithDurationsLD( - uint64 count, - LockupDynamic.CreateWithDurations memory params - ) - internal - { - vm.expectCall({ - callee: address(lockupDynamic), - count: count, - data: abi.encodeCall(ISablierV2LockupDynamic.createWithDurations, (params)) - }); - } - - /// @dev Expects multiple calls to {ISablierV2LockupLinear.createWithDurations}, each with the specified - /// `params`. - function expectMultipleCallsToCreateWithDurationsLL( - uint64 count, - LockupLinear.CreateWithDurations memory params - ) - internal - { - vm.expectCall({ - callee: address(lockupLinear), - count: count, - data: abi.encodeCall(ISablierV2LockupLinear.createWithDurations, (params)) - }); - } - - /// @dev Expects multiple calls to {ISablierV2LockupTranched.createWithDurations}, each with the specified - /// `params`. - function expectMultipleCallsToCreateWithDurationsLT( - uint64 count, - LockupTranched.CreateWithDurations memory params - ) - internal - { - vm.expectCall({ - callee: address(lockupTranched), - count: count, - data: abi.encodeCall(ISablierV2LockupTranched.createWithDurations, (params)) - }); - } - - /// @dev Expects multiple calls to {ISablierV2LockupDynamic.createWithTimestamps}, each with the specified - /// `params`. - function expectMultipleCallsToCreateWithTimestampsLD( - uint64 count, - LockupDynamic.CreateWithTimestamps memory params - ) - internal - { - vm.expectCall({ - callee: address(lockupDynamic), - count: count, - data: abi.encodeCall(ISablierV2LockupDynamic.createWithTimestamps, (params)) - }); - } - - /// @dev Expects multiple calls to {ISablierV2LockupLinear.createWithTimestamps}, each with the specified - /// `params`. - function expectMultipleCallsToCreateWithTimestampsLL( - uint64 count, - LockupLinear.CreateWithTimestamps memory params - ) - internal - { - vm.expectCall({ - callee: address(lockupLinear), - count: count, - data: abi.encodeCall(ISablierV2LockupLinear.createWithTimestamps, (params)) - }); - } - - /// @dev Expects multiple calls to {ISablierV2LockupTranched.createWithTimestamps}, each with the specified - /// `params`. - function expectMultipleCallsToCreateWithTimestampsLT( - uint64 count, - LockupTranched.CreateWithTimestamps memory params - ) - internal - { - vm.expectCall({ - callee: address(lockupTranched), - count: count, - data: abi.encodeCall(ISablierV2LockupTranched.createWithTimestamps, (params)) - }); - } - - /// @dev Expects multiple calls to {IERC20.transfer}. - function expectMultipleCallsToTransfer(uint64 count, address to, uint256 value) internal { - vm.expectCall({ callee: address(dai), count: count, data: abi.encodeCall(IERC20.transfer, (to, value)) }); - } - - /// @dev Expects multiple calls to {IERC20.transferFrom}. - function expectMultipleCallsToTransferFrom(uint64 count, address from, address to, uint256 value) internal { - expectMultipleCallsToTransferFrom(dai, count, from, to, value); - } - - /// @dev Expects multiple calls to {IERC20.transferFrom}. - function expectMultipleCallsToTransferFrom( - IERC20 asset, - uint64 count, - address from, - address to, - uint256 value - ) - internal - { - vm.expectCall({ - callee: address(asset), - count: count, - data: abi.encodeCall(IERC20.transferFrom, (from, to, value)) - }); - } - /*////////////////////////////////////////////////////////////////////////// MERKLE-LOCKUP //////////////////////////////////////////////////////////////////////////*/ diff --git a/test/periphery/fork/Fork.t.sol b/test/periphery/fork/Fork.t.sol index 617e254c5..4f97e0ebd 100644 --- a/test/periphery/fork/Fork.t.sol +++ b/test/periphery/fork/Fork.t.sol @@ -34,7 +34,7 @@ abstract contract Fork_Test is Periphery_Test, Merkle { // Fork Ethereum Mainnet at a specific block number. vm.createSelectFork({ blockNumber: 20_339_512, urlOrAlias: "mainnet" }); - // Set up the base test contract. + // Set up the parent test contract. Periphery_Test.setUp(); // Load the external dependencies. diff --git a/test/periphery/fork/merkle-lockup/MerkleLL.t.sol b/test/periphery/fork/merkle-lockup/MerkleLL.t.sol index 62ccfec60..6fd0aac55 100644 --- a/test/periphery/fork/merkle-lockup/MerkleLL.t.sol +++ b/test/periphery/fork/merkle-lockup/MerkleLL.t.sol @@ -58,7 +58,7 @@ abstract contract MerkleLL_Fork_Test is Fork_Test { function testForkFuzz_MerkleLL(Params memory params) external { vm.assume(params.admin != address(0) && params.admin != users.admin); - vm.assume(params.leafData.length > 1); + vm.assume(params.leafData.length > 0); assumeNoBlacklisted({ token: address(FORK_ASSET), addr: params.admin }); params.posBeforeSort = _bound(params.posBeforeSort, 0, params.leafData.length - 1); diff --git a/test/periphery/fork/merkle-lockup/MerkleLT.t.sol b/test/periphery/fork/merkle-lockup/MerkleLT.t.sol index e8b50fbcc..027d4f5e5 100644 --- a/test/periphery/fork/merkle-lockup/MerkleLT.t.sol +++ b/test/periphery/fork/merkle-lockup/MerkleLT.t.sol @@ -59,7 +59,7 @@ abstract contract MerkleLT_Fork_Test is Fork_Test { function testForkFuzz_MerkleLT(Params memory params) external { vm.assume(params.admin != address(0) && params.admin != users.admin); - vm.assume(params.leafData.length > 1); + vm.assume(params.leafData.length > 0); assumeNoBlacklisted({ token: address(FORK_ASSET), addr: params.admin }); params.posBeforeSort = _bound(params.posBeforeSort, 0, params.leafData.length - 1); diff --git a/test/utils/Constants.sol b/test/utils/Constants.sol index 592eaacfc..82943e274 100644 --- a/test/utils/Constants.sol +++ b/test/utils/Constants.sol @@ -4,10 +4,10 @@ pragma solidity >=0.8.22; import { UD60x18 } from "@prb/math/src/UD60x18.sol"; abstract contract Constants { + uint40 internal constant JULY_1_2024 = 1_719_792_000; UD60x18 internal constant MAX_BROKER_FEE = UD60x18.wrap(0.1e18); // 10% uint128 internal constant MAX_UINT128 = type(uint128).max; uint256 internal constant MAX_UINT256 = type(uint256).max; uint40 internal constant MAX_UINT40 = type(uint40).max; uint40 internal constant MAX_UNIX_TIMESTAMP = 2_147_483_647; // 2^31 - 1 - uint40 internal constant JULY_1_2024 = 1_719_792_000; } diff --git a/test/utils/Defaults.sol b/test/utils/Defaults.sol index 8704d6177..c2c03f571 100644 --- a/test/utils/Defaults.sol +++ b/test/utils/Defaults.sol @@ -36,11 +36,11 @@ contract Defaults is Constants, Merkle { uint40 public immutable MAX_SEGMENT_DURATION; uint256 public constant MAX_TRANCHE_COUNT = 10_000; uint128 public constant REFUND_AMOUNT = DEPOSIT_AMOUNT - CLIFF_AMOUNT; - uint256 public SEGMENT_COUNT; + uint256 public constant SEGMENT_COUNT = 2; uint40 public immutable START_TIME; uint128 public constant TOTAL_AMOUNT = 10_030.090270812437311935e18; // deposit + broker fee uint40 public constant TOTAL_DURATION = 10_000 seconds; - uint256 public TRANCHE_COUNT; + uint256 public constant TRANCHE_COUNT = 3; uint128 public constant TOTAL_TRANSFER_AMOUNT = DEPOSIT_AMOUNT * uint128(BATCH_SIZE); uint128 public constant WITHDRAW_AMOUNT = 2600e18; uint40 public immutable WARP_26_PERCENT; // 26% of the way through the stream @@ -53,7 +53,7 @@ contract Defaults is Constants, Merkle { bool public constant CANCELABLE = false; uint128 public constant CLAIM_AMOUNT = 10_000e18; uint40 public immutable EXPIRATION; - uint40 public immutable FIRST_CLAIM_TIME; + uint40 public constant FIRST_CLAIM_TIME = JULY_1_2024; uint256 public constant INDEX1 = 1; uint256 public constant INDEX2 = 2; uint256 public constant INDEX3 = 3; @@ -82,13 +82,9 @@ contract Defaults is Constants, Merkle { START_TIME = JULY_1_2024 + 2 days; CLIFF_TIME = START_TIME + CLIFF_DURATION; END_TIME = START_TIME + TOTAL_DURATION; + EXPIRATION = JULY_1_2024 + 12 weeks; MAX_SEGMENT_DURATION = TOTAL_DURATION / uint40(MAX_SEGMENT_COUNT); - SEGMENT_COUNT = 2; - TRANCHE_COUNT = 3; WARP_26_PERCENT = START_TIME + CLIFF_DURATION + 100 seconds; - - EXPIRATION = JULY_1_2024 + 12 weeks; - FIRST_CLAIM_TIME = JULY_1_2024; } /*////////////////////////////////////////////////////////////////////////// @@ -147,7 +143,7 @@ contract Defaults is Constants, Merkle { isDepleted: false, isStream: true, isTransferable: true, - recipient: users.recipient0, + recipient: users.recipient, segments: segments(), sender: users.sender, startTime: START_TIME, @@ -169,7 +165,7 @@ contract Defaults is Constants, Merkle { isTransferable: true, isDepleted: false, isStream: true, - recipient: users.recipient0, + recipient: users.recipient, sender: users.sender, startTime: START_TIME, wasCanceled: false @@ -189,7 +185,7 @@ contract Defaults is Constants, Merkle { isDepleted: false, isStream: true, isTransferable: true, - recipient: users.recipient0, + recipient: users.recipient, sender: users.sender, startTime: START_TIME, tranches: tranches(), @@ -259,7 +255,7 @@ contract Defaults is Constants, Merkle { function createWithDurationsLD() public view returns (LockupDynamic.CreateWithDurations memory) { return LockupDynamic.CreateWithDurations({ sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, totalAmount: TOTAL_AMOUNT, asset: asset, cancelable: true, @@ -279,7 +275,7 @@ contract Defaults is Constants, Merkle { function createWithDurationsLL() public view returns (LockupLinear.CreateWithDurations memory) { return LockupLinear.CreateWithDurations({ sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, totalAmount: TOTAL_AMOUNT, asset: asset, cancelable: true, @@ -299,7 +295,7 @@ contract Defaults is Constants, Merkle { function createWithDurationsLT() public view returns (LockupTranched.CreateWithDurations memory) { return LockupTranched.CreateWithDurations({ sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, totalAmount: TOTAL_AMOUNT, asset: asset, cancelable: true, @@ -319,7 +315,7 @@ contract Defaults is Constants, Merkle { function createWithTimestampsLD() public view returns (LockupDynamic.CreateWithTimestamps memory) { return LockupDynamic.CreateWithTimestamps({ sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, totalAmount: TOTAL_AMOUNT, asset: asset, cancelable: true, @@ -340,7 +336,7 @@ contract Defaults is Constants, Merkle { function createWithTimestampsLL() public view returns (LockupLinear.CreateWithTimestamps memory) { return LockupLinear.CreateWithTimestamps({ sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, totalAmount: TOTAL_AMOUNT, asset: asset, cancelable: true, @@ -360,7 +356,7 @@ contract Defaults is Constants, Merkle { function createWithTimestampsLT() public view returns (LockupTranched.CreateWithTimestamps memory) { return LockupTranched.CreateWithTimestamps({ sender: users.sender, - recipient: users.recipient0, + recipient: users.recipient, totalAmount: TOTAL_AMOUNT, asset: asset, cancelable: true, diff --git a/test/utils/Types.sol b/test/utils/Types.sol index 173661031..ed5aa2454 100644 --- a/test/utils/Types.sol +++ b/test/utils/Types.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.22; struct Users { - // Default admin for all contracts. + // Default admin. address payable admin; // Impartial user. address payable alice; @@ -12,8 +12,9 @@ struct Users { address payable eve; // Default NFT operator. address payable operator; - // Default stream recipients. - address payable recipient0; + // Default stream recipient. + address payable recipient; + // Other recipients. address payable recipient1; address payable recipient2; address payable recipient3;