Skip to content

Commit

Permalink
refactor: consistency in calldata related struct parameters (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
smol-ninja authored and andreivladbrg committed Feb 13, 2024
1 parent ced1168 commit 2afc17d
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 80 deletions.
42 changes: 21 additions & 21 deletions src/SablierV2Batch.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ contract SablierV2Batch is ISablierV2Batch {
// Create the stream.
streamIds[i] = lockupLinear.createWithDurations(
LockupLinear.CreateWithDurations({
sender: batch[i].sender,
recipient: batch[i].recipient,
totalAmount: batch[i].totalAmount,
asset: asset,
broker: batch[i].broker,
cancelable: batch[i].cancelable,
transferable: batch[i].transferable,
durations: batch[i].durations,
recipient: batch[i].recipient,
sender: batch[i].sender,
totalAmount: batch[i].totalAmount,
transferable: batch[i].transferable
broker: batch[i].broker
})
);
}
Expand Down Expand Up @@ -103,14 +103,14 @@ contract SablierV2Batch is ISablierV2Batch {
// Create the stream.
streamIds[i] = lockupLinear.createWithRange(
LockupLinear.CreateWithRange({
sender: batch[i].sender,
recipient: batch[i].recipient,
totalAmount: batch[i].totalAmount,
asset: asset,
broker: batch[i].broker,
cancelable: batch[i].cancelable,
transferable: batch[i].transferable,
range: batch[i].range,
recipient: batch[i].recipient,
sender: batch[i].sender,
totalAmount: batch[i].totalAmount,
transferable: batch[i].transferable
broker: batch[i].broker
})
);
}
Expand Down Expand Up @@ -155,14 +155,14 @@ contract SablierV2Batch is ISablierV2Batch {
// Create the stream.
streamIds[i] = lockupDynamic.createWithDeltas(
LockupDynamic.CreateWithDeltas({
sender: batch[i].sender,
recipient: batch[i].recipient,
totalAmount: batch[i].totalAmount,
asset: asset,
broker: batch[i].broker,
cancelable: batch[i].cancelable,
recipient: batch[i].recipient,
transferable: batch[i].transferable,
segments: batch[i].segments,
sender: batch[i].sender,
totalAmount: batch[i].totalAmount,
transferable: batch[i].transferable
broker: batch[i].broker
})
);
}
Expand Down Expand Up @@ -203,15 +203,15 @@ contract SablierV2Batch is ISablierV2Batch {
// Create the stream.
streamIds[i] = lockupDynamic.createWithMilestones(
LockupDynamic.CreateWithMilestones({
sender: batch[i].sender,
recipient: batch[i].recipient,
totalAmount: batch[i].totalAmount,
asset: asset,
broker: batch[i].broker,
cancelable: batch[i].cancelable,
recipient: batch[i].recipient,
segments: batch[i].segments,
sender: batch[i].sender,
transferable: batch[i].transferable,
startTime: batch[i].startTime,
totalAmount: batch[i].totalAmount,
transferable: batch[i].transferable
segments: batch[i].segments,
broker: batch[i].broker
})
);
}
Expand Down
10 changes: 5 additions & 5 deletions src/SablierV2MerkleStreamerLL.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ contract SablierV2MerkleStreamerLL is
// Interactions: create the stream via {SablierV2LockupLinear}.
streamId = LOCKUP_LINEAR.createWithDurations(
LockupLinear.CreateWithDurations({
sender: admin,
recipient: recipient,
totalAmount: amount,
asset: ASSET,
broker: Broker({ account: address(0), fee: ud(0) }),
cancelable: CANCELABLE,
transferable: TRANSFERABLE,
durations: streamDurations,
recipient: recipient,
sender: admin,
totalAmount: amount,
transferable: TRANSFERABLE
broker: Broker({ account: address(0), fee: ud(0) })
})
);

Expand Down
2 changes: 1 addition & 1 deletion src/types/DataTypes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ library Batch {
address sender;
address recipient;
uint128 totalAmount;
uint40 startTime;
bool cancelable;
bool transferable;
uint40 startTime;
LockupDynamic.Segment[] segments;
Broker broker;
}
Expand Down
12 changes: 6 additions & 6 deletions test/fork/batch/createWithMilestones.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ abstract contract CreateWithMilestones_Batch_Fork_Test is Fork_Test {
asset.approve({ spender: address(batch), amount: totalTransferAmount });

LockupDynamic.CreateWithMilestones memory createWithMilestones = LockupDynamic.CreateWithMilestones({
sender: params.sender,
recipient: params.recipient,
totalAmount: params.perStreamAmount,
asset: asset,
broker: defaults.broker(),
cancelable: true,
recipient: params.recipient,
segments: params.segments,
sender: params.sender,
transferable: true,
startTime: params.startTime,
totalAmount: params.perStreamAmount,
transferable: true
segments: params.segments,
broker: defaults.broker()
});
Batch.CreateWithMilestones[] memory batchParams = BatchBuilder.fillBatch(createWithMilestones, params.batchSize);

Expand Down
10 changes: 5 additions & 5 deletions test/fork/batch/createWithRange.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ abstract contract CreateWithRange_Batch_Fork_Test is Fork_Test {
asset.approve({ spender: address(batch), amount: totalTransferAmount });

LockupLinear.CreateWithRange memory createParams = LockupLinear.CreateWithRange({
sender: params.sender,
recipient: params.recipient,
totalAmount: params.perStreamAmount,
asset: asset,
broker: defaults.broker(),
cancelable: true,
recipient: params.recipient,
sender: params.sender,
transferable: true,
range: params.range,
totalAmount: params.perStreamAmount,
transferable: true
broker: defaults.broker()
});
Batch.CreateWithRange[] memory batchParams = BatchBuilder.fillBatch(createParams, params.batchSize);

Expand Down
42 changes: 21 additions & 21 deletions test/utils/BatchBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ library BatchBuilder {
{
batch = new Batch.CreateWithDeltas[](batchSize);
Batch.CreateWithDeltas memory batchSingle = Batch.CreateWithDeltas({
broker: params.broker,
cancelable: params.cancelable,
recipient: params.recipient,
segments: params.segments,
sender: params.sender,
recipient: params.recipient,
totalAmount: params.totalAmount,
transferable: params.transferable
cancelable: params.cancelable,
transferable: params.transferable,
segments: params.segments,
broker: params.broker
});
batch = fillBatch(batchSingle, batchSize);
}
Expand Down Expand Up @@ -69,13 +69,13 @@ library BatchBuilder {
{
batch = new Batch.CreateWithDurations[](batchSize);
Batch.CreateWithDurations memory batchSingle = Batch.CreateWithDurations({
broker: params.broker,
cancelable: params.cancelable,
durations: params.durations,
recipient: params.recipient,
sender: params.sender,
recipient: params.recipient,
totalAmount: params.totalAmount,
transferable: params.transferable
cancelable: params.cancelable,
transferable: params.transferable,
durations: params.durations,
broker: params.broker
});
batch = fillBatch(batchSingle, batchSize);
}
Expand Down Expand Up @@ -106,14 +106,14 @@ library BatchBuilder {
{
batch = new Batch.CreateWithMilestones[](batchSize);
Batch.CreateWithMilestones memory batchSingle = Batch.CreateWithMilestones({
broker: params.broker,
cancelable: params.cancelable,
recipient: params.recipient,
segments: params.segments,
sender: params.sender,
startTime: params.startTime,
recipient: params.recipient,
totalAmount: params.totalAmount,
transferable: params.transferable
cancelable: params.cancelable,
transferable: params.transferable,
startTime: params.startTime,
segments: params.segments,
broker: params.broker
});
batch = fillBatch(batchSingle, batchSize);
}
Expand Down Expand Up @@ -144,13 +144,13 @@ library BatchBuilder {
{
batch = new Batch.CreateWithRange[](batchSize);
Batch.CreateWithRange memory batchSingle = Batch.CreateWithRange({
broker: params.broker,
cancelable: params.cancelable,
range: params.range,
recipient: params.recipient,
sender: params.sender,
recipient: params.recipient,
totalAmount: params.totalAmount,
transferable: params.transferable
cancelable: params.cancelable,
transferable: params.transferable,
range: params.range,
broker: params.broker
});
batch = fillBatch(batchSingle, batchSize);
}
Expand Down
42 changes: 21 additions & 21 deletions test/utils/Defaults.sol
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ contract Defaults is Merkle {

function createWithDeltas(IERC20 asset_) public view returns (LockupDynamic.CreateWithDeltas memory) {
return LockupDynamic.CreateWithDeltas({
sender: users.alice,
recipient: users.recipient0,
totalAmount: PER_STREAM_AMOUNT,
asset: asset_,
broker: broker(),
cancelable: true,
recipient: users.recipient0,
transferable: true,
segments: segmentsWithDeltas(),
sender: users.alice,
totalAmount: PER_STREAM_AMOUNT,
transferable: true
broker: broker()
});
}

Expand All @@ -158,15 +158,15 @@ contract Defaults is Merkle {

function createWithMilestones(IERC20 asset_) public view returns (LockupDynamic.CreateWithMilestones memory) {
return LockupDynamic.CreateWithMilestones({
sender: users.alice,
recipient: users.recipient0,
totalAmount: PER_STREAM_AMOUNT,
asset: asset_,
broker: broker(),
cancelable: true,
recipient: users.recipient0,
segments: segments(),
sender: users.alice,
transferable: true,
startTime: START_TIME,
totalAmount: PER_STREAM_AMOUNT,
transferable: true
segments: segments(),
broker: broker()
});
}

Expand Down Expand Up @@ -220,14 +220,14 @@ contract Defaults is Merkle {

function createWithDurations(IERC20 asset_) public view returns (LockupLinear.CreateWithDurations memory) {
return LockupLinear.CreateWithDurations({
sender: users.alice,
recipient: users.recipient0,
totalAmount: PER_STREAM_AMOUNT,
asset: asset_,
broker: broker(),
cancelable: true,
transferable: true,
durations: durations(),
recipient: users.recipient0,
sender: users.alice,
totalAmount: PER_STREAM_AMOUNT,
transferable: true
broker: broker()
});
}

Expand All @@ -237,14 +237,14 @@ contract Defaults is Merkle {

function createWithRange(IERC20 asset_) public view returns (LockupLinear.CreateWithRange memory) {
return LockupLinear.CreateWithRange({
sender: users.alice,
recipient: users.recipient0,
totalAmount: PER_STREAM_AMOUNT,
asset: asset_,
broker: broker(),
cancelable: true,
transferable: true,
range: linearRange(),
recipient: users.recipient0,
sender: users.alice,
totalAmount: PER_STREAM_AMOUNT,
transferable: true
broker: broker()
});
}

Expand Down

0 comments on commit 2afc17d

Please sign in to comment.