Skip to content

Commit e4cefe5

Browse files
committed
refactor: reduce BatchStatus to Authorized and Withdrawn
At the moment, L2 contract is not concerned with WHY a batch has been withdrawn
1 parent 4dea020 commit e4cefe5

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

contracts/l2.sol

+5-7
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ struct L2Deposit {
1616
}
1717

1818
// Authorized: all tickets in this batch are authorized but not claimed
19-
// Claimed: all tickets in this batch are claimed
20-
// Refunded: all tickets in this batch have been refunded, due to inactivity or provable fraud.
19+
// Withdrawn: all tickets in this batch are withdrawn (either claimed or refunded)
2120
enum BatchStatus {
2221
Authorized,
23-
Claimed,
24-
Refunded
22+
Withdrawn
2523
}
2624

2725
struct Batch {
@@ -132,7 +130,7 @@ contract L2 is SignatureChecker {
132130
"safetyDelay must have passed since authorization timestamp"
133131
);
134132

135-
batch.status = BatchStatus.Claimed;
133+
batch.status = BatchStatus.Withdrawn;
136134
batches[first] = batch;
137135
(bool sent, ) = lpAddress.call{value: batch.total}("");
138136
require(sent, "Failed to send Ether");
@@ -188,7 +186,7 @@ contract L2 is SignatureChecker {
188186
require(sent, "Failed to send Ether");
189187
}
190188

191-
batches[honestStartNonce].status = BatchStatus.Refunded;
189+
batches[honestStartNonce].status = BatchStatus.Withdrawn;
192190
}
193191

194192
function refund(uint256 index) public {
@@ -203,7 +201,7 @@ contract L2 is SignatureChecker {
203201
);
204202
(Batch memory batch, ) = createBatch(nextNonceToAuthorize, index);
205203
batches[nextNonceToAuthorize] = batch;
206-
batch.status = BatchStatus.Refunded;
204+
batch.status = BatchStatus.Withdrawn;
207205
nextNonceToAuthorize = index + 1;
208206

209207
(bool sent, ) = tickets[index].l1Recipient.call{

0 commit comments

Comments
 (0)