Skip to content

Commit

Permalink
test: replace streamDurations with endTime in Vars struct
Browse files Browse the repository at this point in the history
  • Loading branch information
smol-ninja committed Feb 12, 2024
1 parent dd1f751 commit b5e7199
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Binary file modified bun.lockb
Binary file not shown.
12 changes: 6 additions & 6 deletions test/fork/merkle-lockup/MerkleLockupLD.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ abstract contract MerkleLockupLD_Fork_Test is Fork_Test {
uint128 clawbackAmount;
address expectedLockupLD;
MerkleLockup.ConstructorParams baseParams;
uint40 endTime;
LockupDynamic.Stream expectedStream;
uint256 expectedStreamId;
uint256[] indexes;
Expand All @@ -51,7 +52,6 @@ abstract contract MerkleLockupLD_Fork_Test is Fork_Test {
bytes32 merkleRoot;
address[] recipients;
uint256 recipientsCount;
uint40[] streamDurations;
LockupDynamic.SegmentWithDuration[][] segments;
LockupDynamic.Segment[][] segmentsWithTimestamps;
}
Expand All @@ -78,7 +78,6 @@ abstract contract MerkleLockupLD_Fork_Test is Fork_Test {
vars.recipients = new address[](vars.recipientsCount);
vars.segments = new LockupDynamic.SegmentWithDuration[][](vars.recipientsCount);
vars.segmentsWithTimestamps = new LockupDynamic.Segment[][](vars.recipientsCount);
vars.streamDurations = new uint40[](vars.recipientsCount);

for (uint256 i = 0; i < vars.recipientsCount; ++i) {
vm.assume(params.leafData[i].segments.length > 0);
Expand All @@ -102,9 +101,6 @@ abstract contract MerkleLockupLD_Fork_Test is Fork_Test {

vars.segments[i] = params.leafData[i].segments;
vars.segmentsWithTimestamps[i] = getSegmentsWithTimestamps(params.leafData[i].segments);

vars.streamDurations[i] =
vars.segmentsWithTimestamps[i][params.leafData[i].segments.length - 1].timestamp - getBlockTimestamp();
}

leaves = new uint256[](vars.recipientsCount);
Expand Down Expand Up @@ -176,11 +172,15 @@ abstract contract MerkleLockupLD_Fork_Test is Fork_Test {
merkleProof: getProof(leaves.toBytes32(), vars.leafPos)
});

vars.endTime = vars.segmentsWithTimestamps[params.posBeforeSort][params.leafData[params.posBeforeSort]
.segments
.length - 1].timestamp;

vars.actualStream = lockupDynamic.getStream(vars.actualStreamId);
vars.expectedStream = LockupDynamic.Stream({
amounts: Lockup.Amounts({ deposited: vars.amounts[params.posBeforeSort], refunded: 0, withdrawn: 0 }),
asset: asset,
endTime: uint40(block.timestamp) + vars.streamDurations[params.posBeforeSort],
endTime: vars.endTime,
isCancelable: defaults.CANCELABLE(),
isDepleted: false,
isStream: true,
Expand Down

0 comments on commit b5e7199

Please sign in to comment.