Skip to main content

Errors

Centralized error definitions library providing standardized error messages and gas-efficient error handling across all TokenOps vesting contracts.

Library Information

File Location: contracts/libraries/Errors.sol

Usage Pattern:

import {Errors} from "./libraries/Errors.sol";

contract MyContract {
function someFunction() external {
if (condition) {
revert Errors.InvalidInput();
}
}
}

Overview

The Errors library centralizes all error definitions used across the TokenOps vesting system. By using custom errors instead of string-based require statements, the library provides gas-efficient error handling while maintaining clear, consistent error messages. This approach reduces deployment costs and improves debugging capabilities.

Key Features

  • Gas-efficient errors - Custom errors cost less gas than string-based errors
  • Centralized definitions - All errors defined in one location for consistency
  • Type safety - Compile-time error checking and better IDE support
  • Parameterized errors - Support for dynamic error parameters
  • Categorized errors - Organized by functional domain for easy maintenance
  • Backwards compatibility - Works with both custom errors and traditional reverts

Errors

AdminAccessRequired

Thrown when an operation requires admin access but caller is not an admin

error AdminAccessRequired();

NotFeeCollector

Thrown when an operation requires fee collector access but caller is not the fee collector

error NotFeeCollector();

NotVestingOwner

Thrown when an operation requires vesting ownership but caller is not the owner

error NotVestingOwner();

NotMilestoneOwner

Thrown when an operation requires milestone ownership but caller is not the owner

error NotMilestoneOwner();

NotAuthorizedForTransfer

Thrown when an operation requires transfer authorization but caller is not authorized

error NotAuthorizedForTransfer();

VaultUnauthorized

Thrown when a vault operation is attempted by an unauthorized address

error VaultUnauthorized();

CannotRemoveLastAdmin

Thrown when an operation requires at least one admin but would leave none

error CannotRemoveLastAdmin();

InvalidAddress

Thrown when an invalid address (typically zero address) is provided

error InvalidAddress();

InvalidRange

Thrown when a range of values is invalid

error InvalidRange();

ArrayLengthMismatch

Thrown when arrays in a function call don't have the same length

error ArrayLengthMismatch();

EmptyArray

Thrown when an empty array is provided but non-empty is required

error EmptyArray();

AdminStatusAlreadyActive

Thrown when a flag is already set with the same value for an address

error AdminStatusAlreadyActive();

InvalidToken

Thrown when an invalid token address is provided

error InvalidToken();

InvalidStepIndex

Thrown when an invalid step index is provided

error InvalidStepIndex();

FeeTooLow

Thrown when a fee is below the minimum required

error FeeTooLow();

FeeTooHigh

Thrown when a fee exceeds the maximum allowed

error FeeTooHigh();

InsufficientFee

Thrown when insufficient fees are provided

error InsufficientFee();

CustomFeeNotSet

Thrown when a custom fee is not set for an address

error CustomFeeNotSet();

TransferFailed

Thrown when a transfer operation fails

error TransferFailed();

InsufficientBalance

Thrown when there's insufficient balance for an operation

error InsufficientBalance();

InvalidFundingAmount

Thrown when an invalid funding amount is provided

error InvalidFundingAmount();

FundingLimitExceeded

Thrown when trying to exceed a funding limit

error FundingLimitExceeded();

VestingFullyFunded

Thrown when a vesting is fully funded and additional funding is attempted

error VestingFullyFunded();

InsufficientFunding

Thrown when insufficient funding is provided

error InsufficientFunding();

VaultZeroAddressDelegate

Thrown when an operation would delegate to a zero address

error VaultZeroAddressDelegate();

VaultAlreadyInitialized

Thrown when a vault is already initialized

error VaultAlreadyInitialized();

VaultDeploymentFailed

Thrown when vault deployment fails

error VaultDeploymentFailed();

VaultInitializationFailed

Thrown when vault initialization fails

error VaultInitializationFailed();

EmptyVesting

Thrown when a vesting is empty (not initialized)

error EmptyVesting();

VestingNotActive

Thrown when a vesting is not active

error VestingNotActive();

FullyVested

Thrown when a vesting is fully vested

error FullyVested();

VestingNotRevocable

Thrown when a vesting is not revocable but revocation is attempted

error VestingNotRevocable();

TimelockEnabled

Thrown when a timelock is enabled but an operation would violate it

error TimelockEnabled();

InvalidVestedAmount

Thrown when an invalid vested amount is provided

error InvalidVestedAmount();

InvalidStartTimestamp

Thrown when an invalid start timestamp is provided

error InvalidStartTimestamp();

InvalidEndTimestamp

Thrown when an invalid end timestamp is provided

error InvalidEndTimestamp();

InvalidReleaseInterval

Thrown when an invalid release interval is provided

error InvalidReleaseInterval();

InvalidIntervalLength

Thrown when an invalid interval length is provided

error InvalidIntervalLength();

InvalidCliffRelease

Thrown when an invalid cliff release timestamp is provided

error InvalidCliffRelease();

InvalidCliffReleaseTimestamp

Thrown when an invalid cliff release timestamp is provided

error InvalidCliffReleaseTimestamp();

InvalidCliffAmount

Thrown when an invalid cliff amount is provided

error InvalidCliffAmount();

InvalidUnlockTimestamp

Thrown when an invalid unlock timestamp is provided

error InvalidUnlockTimestamp();

NoPendingTransfer

Thrown when no pending transfer exists but one is expected

error NoPendingTransfer();

PendingTransferExists

Thrown when a pending transfer exists but none is expected

error PendingTransferExists();

MilestoneAlreadyExists

Thrown when a milestone with the same ID already exists

error MilestoneAlreadyExists(bytes32 milestoneId);

MilestoneNotExists

Thrown when a milestone doesn't exist

error MilestoneNotExists();

MilestoneNotActive

Thrown when a milestone is not active

error MilestoneNotActive();

MilestoneAlreadyRevoked

Thrown when a milestone is already revoked

error MilestoneAlreadyRevoked();

MilestoneIsRevoked

Thrown when a milestone is revoked but operation assumes it's active

error MilestoneIsRevoked();

StepAlreadyApproved

Thrown when a step is already approved but approval is attempted again

error StepAlreadyApproved();

StepAlreadyRevoked

Thrown when a step is already revoked but revocation is attempted again

error StepAlreadyRevoked();

StepNotApproved

Thrown when a step needs to be approved but isn't

error StepNotApproved();

MilestoneFullyFunded

Thrown when a milestone is fully funded but additional funding is attempted

error MilestoneFullyFunded();

StepFullyFunded

Thrown when a milestone step is fully funded but additional funding is attempted

error StepFullyFunded();

StartTimestampNotReached

Thrown when a start timestamp is not reached but operation requires it

error StartTimestampNotReached();

VestingAlreadyEnded

Thrown when a vesting has already ended but operation assumes it's active

error VestingAlreadyEnded();

The Errors library provides a comprehensive, gas-efficient error handling system that improves code maintainability, reduces deployment costs, and enhances debugging capabilities across the entire TokenOps vesting ecosystem.