Skip to content

Commit 13643ae

Browse files
committed
refactor: nextNonceToAuthorize -> nextBatchStart
A batch can be created to: - Authorize tickets - Refund tickets
1 parent e4cefe5 commit 13643ae

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
// TODO: check payment amount
4444
function depositOnL2(L2Deposit calldata deposit) public payable {
@@ -82,7 +82,7 @@ contract L2 is SignatureChecker {
8282
bytes32 message = keccak256(abi.encode(ticketsWithIndex));
8383
uint256 earliestTimestamp = tickets[first].timestamp;
8484

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

9696
batches[first] = batch;
97-
nextNonceToAuthorize = last + 1;
97+
nextBatchStart = last + 1;
9898
}
9999

100100
function createBatch(uint256 first, uint256 last)
@@ -196,13 +196,13 @@ contract L2 is SignatureChecker {
196196
);
197197

198198
require(
199-
nextNonceToAuthorize <= index,
199+
nextBatchStart <= index,
200200
"The nonce must not be a part of a batch"
201201
);
202-
(Batch memory batch, ) = createBatch(nextNonceToAuthorize, index);
203-
batches[nextNonceToAuthorize] = batch;
202+
(Batch memory batch, ) = createBatch(nextBatchStart, index);
203+
batches[nextBatchStart] = batch;
204204
batch.status = BatchStatus.Withdrawn;
205-
nextNonceToAuthorize = index + 1;
205+
nextBatchStart = index + 1;
206206

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

0 commit comments

Comments
 (0)