Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed Oct 22, 2024
1 parent 5d92abc commit dd82bbd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions contracts/utils/NoncesSemiAbstracted.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {Nonces} from "./Nonces.sol";
* Follows the https://eips.ethereum.org/EIPS/eip-4337#semi-abstracted-nonce-support[ERC-4337's semi-abstracted nonce system].
*/
abstract contract NoncesSemiAbstracted is Nonces {
mapping(address owner => mapping(uint192 key => uint64)) private _nonce;
mapping(address owner => mapping(uint192 key => uint64)) private _nounces;

/**
* @dev Returns the next unused nonce for an address.
Expand All @@ -22,7 +22,7 @@ abstract contract NoncesSemiAbstracted is Nonces {
* @dev Returns the next unused nonce for an address and key. Result contains the key prefix.
*/
function nonces(address owner, uint192 key) public view virtual returns (uint256) {
return (uint256(key) << 64) | _nonce[owner][key];
return (uint256(key) << 64) | _nounces[owner][key];
}

/**
Expand All @@ -41,13 +41,13 @@ abstract contract NoncesSemiAbstracted is Nonces {
*/
function _useNonce(address owner, uint192 key) internal virtual returns (uint256) {
// TODO: use unchecked here? Do we expect 2**64 nonce ever be used for a single owner?
return _nonce[owner][key]++;
return _nounces[owner][key]++;
}

/**
* @dev Same as {_useNonce} but checking that `nonce` is the next valid for `owner`.
*
* This version takes a the key and the nonce in a single uint256 parameter:
* This version takes the key and the nonce in a single uint256 parameter:
* - use the first 8 bytes for the key
* - use the last 24 bytes for the nonce
*/
Expand All @@ -58,7 +58,7 @@ abstract contract NoncesSemiAbstracted is Nonces {
/**
* @dev Same as {_useNonce} but checking that `nonce` is the next valid for `owner`.
*
* This version takes a the key and the nonce as two different parameters.
* This version takes the key and the nonce as two different parameters.
*/
function _useCheckedNonce(address owner, uint192 key, uint64 nonce) internal virtual {
uint256 current = _useNonce(owner, key);
Expand Down

0 comments on commit dd82bbd

Please sign in to comment.