Skip to content

Commit 93457a6

Browse files
committed
refactor: nextNonceToAuthorize -> nextBatchStart
A batch can be created to: - Authorize tickets - Refund tickets
1 parent 9e7ff6c commit 93457a6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

contracts/l2.sol

+7-7
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ contract L2 is SignatureChecker {
3838
// `batches` is used to record the fact that tickets with nonce between startingNonce and startingNonce + numTickets-1 are authorized, claimed or refunded.
3939
// Indexed by nonce
4040
mapping(uint256 => Batch) batches;
41-
uint256 nextNonceToAuthorize = 0;
41+
uint256 nextBatchStart = 0;
4242

4343
function depositOnL2(L2Deposit calldata deposit) public payable {
4444
uint256 amountAvailable = deposit.trustedAmount;
@@ -81,7 +81,7 @@ contract L2 is SignatureChecker {
8181
bytes32 message = keccak256(abi.encode(ticketsWithIndex));
8282
uint256 earliestTimestamp = tickets[first].timestamp;
8383

84-
require(nextNonceToAuthorize == first, "Batches must be gapless");
84+
require(nextBatchStart == first, "Batches must be gapless");
8585
require(
8686
recoverSigner(message, signature) == lpAddress,
8787
"Must be signed by liquidity provider"
@@ -93,7 +93,7 @@ contract L2 is SignatureChecker {
9393
);
9494

9595
batches[first] = batch;
96-
nextNonceToAuthorize = last + 1;
96+
nextBatchStart = last + 1;
9797
}
9898

9999
function createBatch(uint256 first, uint256 last)
@@ -195,13 +195,13 @@ contract L2 is SignatureChecker {
195195
);
196196

197197
require(
198-
nextNonceToAuthorize <= index,
198+
nextBatchStart <= index,
199199
"The nonce must not be a part of a batch"
200200
);
201-
(Batch memory batch, ) = createBatch(nextNonceToAuthorize, index);
202-
batches[nextNonceToAuthorize] = batch;
201+
(Batch memory batch, ) = createBatch(nextBatchStart, index);
202+
batches[nextBatchStart] = batch;
203203
batch.status = BatchStatus.Withdrawn;
204-
nextNonceToAuthorize = index + 1;
204+
nextBatchStart = index + 1;
205205

206206
(bool sent, ) = tickets[index].l1Recipient.call{
207207
value: tickets[index].value

0 commit comments

Comments
 (0)