Skip to main content

IInspectorRules

IInspectorRules​

Interface for the InspectorRules contract, which manages the rules, status, and actions for Inspector users.

isInspectorValid​

function isInspectorValid(address account) external view returns (bool)

Checks if an inspector is still valid and has not exceeded their limits (e.g., give-ups).

Parameters​

NameTypeDescription
accountaddressThe address of the inspector to check.

Return Values​

NameTypeDescription
[0]booltrue if the inspector is valid, false otherwise.

canAcceptInspection​

function canAcceptInspection(address account) external view returns (bool)

Checks if an inspector is currently able to accept a new inspection.

Parameters​

NameTypeDescription
accountaddressThe address of the inspector.

Return Values​

NameTypeDescription
[0]booltrue if the inspector can accept an inspection, false otherwise.

afterAcceptInspection​

function afterAcceptInspection(address inspector, uint64 inspectionId) external

A hook to be called after an inspector accepts an inspection.

Updates the inspector's state accordingly.

Parameters​

NameTypeDescription
inspectoraddressThe address of the inspector.
inspectionIduint64The ID of the inspection that was accepted.

afterRealizeInspection​

function afterRealizeInspection(address inspector, uint32 score, uint64 inspectionId) external returns (uint256)

A hook to be called after an inspector successfully completes an inspection.

This function likely updates the inspector's counters and returns their new level or score.

Parameters​

NameTypeDescription
inspectoraddressThe address of the inspector who completed the inspection.
scoreuint32The regenerationScore of the inspection.
inspectionIduint64The inspection unique ID.

Return Values​

NameTypeDescription
[0]uint256The new calculated level for the inspector.

denyInspector​

function denyInspector(address inspector) external

Function to deny inspectors.

getInspector​

function getInspector(address account) external view returns (struct Inspector)

Retrieves the full Inspector struct for a given account.

Parameters​

NameTypeDescription
accountaddressThe address of the inspector.

Return Values​

NameTypeDescription
[0]struct InspectorThe Inspector struct containing the user's data.

addPenalty​

function addPenalty(address inspector, uint64 inspectionId) external returns (uint256)

Adds a penalty to an inspector and returns their new total penalty count.

Parameters​

NameTypeDescription
inspectoraddressThe address of the inspector receiving the penalty.
inspectionIduint64The ID of the inspection related to the penalty.

Return Values​

NameTypeDescription
[0]uint256The new total number of penalties for the inspector.

maxPenalties​

function maxPenalties() external view returns (uint8)

Returns the maximum number of penalties an inspector can have before being denied.

Return Values​

NameTypeDescription
[0]uint8The maximum penalty count.

poolCurrentEra​

function poolCurrentEra() external view returns (uint256)

Returns the current era of the related pool.

Return Values​

NameTypeDescription
[0]uint256The current era number.

decrementInspections​

function decrementInspections(address inspector) external

Decrements the active inspections count for an inspector.

Likely called when an inspection is cancelled or invalidated.

Parameters​

NameTypeDescription
inspectoraddressThe address of the inspector.

removePoolLevels​

function removePoolLevels(address inspector, bool denied) external

Removes a specified level from an inspector's pool configuration.

As specified, this function does not return a value.

Parameters​

NameTypeDescription
inspectoraddressThe address of the inspector.
deniedboolRemove level user status. If true, user is being denied.