Skip to content
This repository was archived by the owner on Jul 25, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions solidity/contracts/Peggy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -376,17 +376,17 @@ contract Peggy is
) external nonReentrant whenNotPaused {
// CHECKS scoped to reduce stack depth
{
uint256 currentBatchNonce = state_lastBatchNonces[_tokenContract];

// Check that the batch nonce is higher than the last nonce for this token
require(
state_lastBatchNonces[_tokenContract] < _batchNonce,
currentBatchNonce < _batchNonce,
"New batch nonce must be greater than the current nonce"
);

// Prevent insane jumps potentially leaving the contract unable to process further batches
require(
_batchNonce <
state_lastBatchNonces[_tokenContract] +
MAX_NONCE_JUMP_LIMIT,
_batchNonce < currentBatchNonce + MAX_NONCE_JUMP_LIMIT,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the comment correct?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, why would it be wrong?

"New batch nonce must be less than 10_000_000_000_000 greater than the current nonce"
);

Expand Down Expand Up @@ -515,6 +515,8 @@ contract Peggy is
transferAmount = balanceAfterTransfer - balanceBeforeTransfer;
}

require(transferAmount > 0, "Transfer amount must be greater than 0");

Comment thread
gorgos marked this conversation as resolved.
state_lastEventNonce = state_lastEventNonce + 1;

emit SendToInjectiveEvent(
Expand Down