Developer Docs
AppGitHub
  • Welcome!
  • Smart contracts
    • Core
      • Introduction
      • Deep Dive
      • Smart Contract Reference
        • PWN Hub
          • Tags
        • PWN Config
        • PWN Vault
        • Loan Types
          • Simple Loan
        • Proposals
          • Simple Loan Proposal
            • Simple Proposal
            • List Proposal
            • Elastic Proposal
            • Elastic Chainlink Proposal
            • Dutch Proposal
        • PWN Utilized Credit
        • PWN LOAN
        • PWN Revoked Nonce
        • Peripheral Contracts
          • Acceptor Controller
            • World ID
          • State Fingerprint Computer
            • UniV3
            • Chicken Bonds
          • Pool Adapter
            • Aave
            • Compound
            • ERC4626
        • Miscellaneous
          • PWN Fee Calculator
          • PWN Signature Checker
          • PWN Errors
          • PWN Periphery
          • Timelock
    • PWN DAO
      • Governance
        • Optimistic
        • Token
      • Tokens
        • PWN
        • stPWN
        • vePWN
          • Stake
          • Power
          • Metadata
      • Epoch Clock
      • Miscellaneous
        • Errors
        • EpochPowerLib
    • Tools
      • PWN Safe
        • Architecture
        • Security considerations
        • Smart Contract Reference
          • PWN Safe Factory
          • ATR Module
            • Tokenized Asset Manager
            • Recipient Permission Manager
          • Whitelist
          • ATR Guard
            • Operators context
      • Token Bundler
      • PWN Deployer
    • Libraries
      • MultiToken
    • Contract Addresses
  • More documentation
    • PWN Docs
    • FAQ
    • Audits
    • Using PWN without front-end
  • Deprecated
    • PWN Beta
      • Architecture
      • PWN
        • Off-chain signed offer
        • Offer types
      • PWN Vault
      • PWN LOAN
Powered by GitBook
On this page
  • 1. Summary
  • 2. Important links
  • 3. Contract details
  • Features
  • Functions
  • View Functions
  • Events
  • Errors
Edit on GitHub
  1. Smart contracts
  2. Core
  3. Smart Contract Reference

PWN Revoked Nonce

PreviousPWN LOANNextPeripheral Contracts

Last updated 9 months ago

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(uint256 nonce)

Overview

Revokes supplied nonce in the current nonce space for msg.sender.

This function takes one argument supplied by the caller:

  • uint256nonce

Implementation

function revokeNonce(uint256 nonce) external {
    _revokeNonce(msg.sender, _nonceSpace[msg.sender], nonce);
}
revokeNonce(uint256 nonceSpace, uint256 nonce)

Overview

Revokes supplied nonce in the supplied nonce space for msg.sender.

This function takes two arguments supplied by the caller:

  • uint256nonceSpace

  • uint256nonce

Implementation

function revokeNonce(uint256 nonceSpace, uint256 nonce) external {
    _revokeNonce(msg.sender, nonceSpace, nonce);
}
revokeNonce(address owner, uint256 nonce)

Overview

This function takes two arguments supplied by the caller:

  • addressowner

  • uint256nonce

Implementation

function revokeNonce(address owner, uint256 nonce) external onlyWithHubTag {
    _revokeNonce(owner, _nonceSpace[owner], nonce);
}
revokeNonce(address owner, uint256 nonceSpace, uint256 nonce)

Overview

This function takes two arguments supplied by the caller:

  • addressowner

  • uint256nonceSpace

  • uint256nonce

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:

  • addressowner

  • uint256nonceSpace

  • uint256nonce

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:

  • addressowner

  • uint256nonceSpace

  • uint256nonce

Implementation

function isNonceUsable(address owner, uint256 nonceSpace, uint256 nonce) external view returns (bool) {
    if (_nonceSpace[owner] != nonceSpace)
        return false;

    return !_revokedNonce[owner][nonceSpace][nonce];
}
currentNonceSpace

Overview

This function returns current nonce space for an address.

This function takes one argument supplied by the caller:

  • addressowner

Implementation

function currentNonceSpace(address owner) external view returns (uint256) {
    return _nonceSpace[owner];
}

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 indexedowner

  • uint256 indexednonceSpace

  • uint256 indexednonce

NonceSpaceRevoked

A NonceSpaceRevoked event is emitted when a nonce space is revoked.

This event has two parameters:

  • address indexedowner

  • uint256 indexednonceSpace

Errors

error NonceAlreadyRevoked(address addr, uint256 nonceSpace, uint256 nonce);
error NonceNotUsable(address addr, uint256 nonceSpace, uint256 nonce);
NonceAlreadyRevoked

A NonceAlreadyRevoked error is thrown when trying to revoke a nonce that is already revoked.

This error has three parameters:

  • addressaddr

  • uint256nonceSpace

  • uint256nonce

NonceNotUsable

A NonceNotUsable error is thrown when trying to use a nonce that is revoked or not in the current nonce space.

This error has three parameters:

  • addressaddr

  • uint256nonceSpace

  • uint256nonce

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 .

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
PWN Hub
pwn_contracts/PWNRevokedNonce.sol at master · PWNFinance/pwn_contractsGitHub
Logo
183KB
PWNRevokedNonce.json