Skip to content

Commit 9e7ff6c

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 fd27008 commit 9e7ff6c

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 {
@@ -131,7 +129,7 @@ contract L2 is SignatureChecker {
131129
"safetyDelay must have passed since authorization timestamp"
132130
);
133131

134-
batch.status = BatchStatus.Claimed;
132+
batch.status = BatchStatus.Withdrawn;
135133
batches[first] = batch;
136134
(bool sent, ) = lpAddress.call{value: batch.total}("");
137135
require(sent, "Failed to send Ether");
@@ -187,7 +185,7 @@ contract L2 is SignatureChecker {
187185
require(sent, "Failed to send Ether");
188186
}
189187

190-
batches[honestStartNonce].status = BatchStatus.Refunded;
188+
batches[honestStartNonce].status = BatchStatus.Withdrawn;
191189
}
192190

193191
function refund(uint256 index) public {
@@ -202,7 +200,7 @@ contract L2 is SignatureChecker {
202200
);
203201
(Batch memory batch, ) = createBatch(nextNonceToAuthorize, index);
204202
batches[nextNonceToAuthorize] = batch;
205-
batch.status = BatchStatus.Refunded;
203+
batch.status = BatchStatus.Withdrawn;
206204
nextNonceToAuthorize = index + 1;
207205

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

0 commit comments

Comments
 (0)