Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Nonces

Provides tracking nonces for addresses. Nonces will only increment.

State Variables

_nonces

mapping(address account => uint256) private _nonces;

Functions

nonces

Returns the next unused nonce for an address.

function nonces(address owner) public view virtual returns (uint256);

_useNonce

Consumes a nonce. Returns the current value and increments nonce.

function _useNonce(address owner) internal virtual returns (uint256);

_useCheckedNonce

Same as _useNonce but checking that nonce is the next valid for owner.

function _useCheckedNonce(address owner, uint256 nonce) internal virtual;

Errors

InvalidAccountNonce

The nonce used for an account is not the expected current nonce.

error InvalidAccountNonce(address account, uint256 currentNonce);