Skip to main content

PWN Errors

1. Summary

PWNErrors.sol defines global custom errors shared across the PWN Protocol. These are free-standing error definitions (not scoped to a contract) so that any contract can import and revert with them.

Most protocol errors are defined in the contract that triggers them. For example, InvalidLoanContractCaller and CallerMissingHubTag are defined in PWNLOAN, and InvalidInputData is defined in PWNHub. Only the two errors below are shared globally.

3. Implementation

// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.16;


/**
* @notice Thrown when an address is missing a PWN Hub tag.
*/
error AddressMissingHubTag(address addr, bytes32 tag);

/**
* @notice Thrown when a proposal is expired.
*/
error Expired(uint256 current, uint256 expiration);

4. Errors

AddressMissingHubTag

Thrown when an address is missing a required PWN Hub tag. Used by contracts that gate access behind a Hub tag check (e.g. PWNUtilizedCredit, PWNRevokedNonce).

This error has two parameters:

  • addressaddr - The address missing the tag
  • bytes32tag - The required tag

Expired

Thrown when a proposal is past its expiration timestamp.

This error has two parameters:

  • uint256current - The current block timestamp
  • uint256expiration - The proposal expiration timestamp