PWN Revoked Nonce
Last updated
Last updated
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.
PWNRevokedNonce.sol is written in Solidity version 0.8.16
Revoke nonces and nonce spaces
Revoke nonce on behalf of the owner
revokeNonce(address owner, uint256 nonce)
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
function revokeNonce(address owner, uint256 nonce) external onlyWithHubTag {
_revokeNonce(owner, _nonceSpace[owner], nonce);
}
revokeNonce(address owner, uint256 nonceSpace, uint256 nonce)
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
function revokeNonce(address owner, uint256 nonceSpace, uint256 nonce) external onlyWithHubTag {
_revokeNonce(owner, nonceSpace, nonce);
}
revokeNonceSpace
Revokes all nonces in the current nonce space and increments the nonce space for msg.sender
.
This function doesn't take any arguments.
function revokeNonceSpace() external returns (uint256) {
emit NonceSpaceRevoked(msg.sender, _nonceSpace[msg.sender]);
return ++_nonceSpace[msg.sender];
}
isNonceRevoked
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
function isNonceRevoked(address owner, uint256 nonceSpace, uint256 nonce) external view returns (bool) {
return _revokedNonce[owner][nonceSpace][nonce];
}
isNonceUsable
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
function isNonceUsable(address owner, uint256 nonceSpace, uint256 nonce) external view returns (bool) {
if (_nonceSpace[owner] != nonceSpace)
return false;
return !_revokedNonce[owner][nonceSpace][nonce];
}
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
error NonceAlreadyRevoked(address addr, uint256 nonceSpace, uint256 nonce);
error NonceNotUsable(address addr, uint256 nonceSpace, uint256 nonce);