PWN Revoked Nonce
1. Summary
PWNRevokedNonce.sol contract is used for revoking proposals. Each proposal has a unique nonce value which can be revoked. Every address has its own nonce space.
2. Important links
3. Contract details
PWNRevokedNonce.sol is written in Solidity version 0.8.16
Features
Revoke nonces and nonce spaces
Revoke nonce on behalf of the owner
Functions
revokeNonce(address owner, uint256 nonce)
Overview
Revokes supplied nonce on behalf of the owner in the current nonce space. This function can be called only by addresses with the accessTag
set in the PWN Hub.
This function takes two arguments supplied by the caller:
address
owner
uint256
nonce
Implementation
function revokeNonce(address owner, uint256 nonce) external onlyWithHubTag {
_revokeNonce(owner, _nonceSpace[owner], nonce);
}
revokeNonce(address owner, uint256 nonceSpace, uint256 nonce)
Overview
Revokes supplied nonce in the supplied nonce space on behalf of the owner. This function can be called only by addresses with the accessTag
set in the PWN Hub.
This function takes two arguments supplied by the caller:
address
owner
uint256
nonceSpace
uint256
nonce
Implementation
function revokeNonce(address owner, uint256 nonceSpace, uint256 nonce) external onlyWithHubTag {
_revokeNonce(owner, nonceSpace, nonce);
}
revokeNonceSpace
Overview
Revokes all nonces in the current nonce space and increments the nonce space for msg.sender
.
This function doesn't take any arguments.
Implementation
function revokeNonceSpace() external returns (uint256) {
emit NonceSpaceRevoked(msg.sender, _nonceSpace[msg.sender]);
return ++_nonceSpace[msg.sender];
}
View Functions
isNonceRevoked
Overview
This function returns a boolean determining if the supplied nonce is revoked for a given address in supplied nonce space.
This function takes three arguments supplied by the caller:
address
owner
uint256
nonceSpace
uint256
nonce
Implementation
function isNonceRevoked(address owner, uint256 nonceSpace, uint256 nonce) external view returns (bool) {
return _revokedNonce[owner][nonceSpace][nonce];
}
isNonceUsable
Overview
This function returns a boolean determining if the supplied nonce is usable for a given address in supplied nonce space.
This function takes three arguments supplied by the caller:
address
owner
uint256
nonceSpace
uint256
nonce
Implementation
function isNonceUsable(address owner, uint256 nonceSpace, uint256 nonce) external view returns (bool) {
if (_nonceSpace[owner] != nonceSpace)
return false;
return !_revokedNonce[owner][nonceSpace][nonce];
}
Events
The PWN Revoked Nonce contract defines two events and two errors.
event NonceRevoked(address indexed owner, uint256 indexed nonceSpace, uint256 indexed nonce);
event NonceSpaceRevoked(address indexed owner, uint256 indexed nonceSpace);
NonceRevoked
A NonceRevoked event is emitted when a nonce is revoked.
This event has three parameters:
address indexed
owner
uint256 indexed
nonceSpace
uint256 indexed
nonce
NonceSpaceRevoked
A NonceSpaceRevoked event is emitted when a nonce space is revoked.
This event has two parameters:
address indexed
owner
uint256 indexed
nonceSpace
Errors
error NonceAlreadyRevoked(address addr, uint256 nonceSpace, uint256 nonce);
error NonceNotUsable(address addr, uint256 nonceSpace, uint256 nonce);
Last updated