Skip to main content

AppRegistry

Git Source

Inherits: Locker, ISlash, AccessControl

Title: AppRegistry

Registry for app builders who post YELLOW as a service quality guarantee. Authorised adjudicators can slash a participant's balance as penalty for misbehaviour.

Access control:

  • DEFAULT_ADMIN_ROLE is held by the TimelockController (parameter administration) and can grant or revoke ADJUDICATOR_ROLE to multiple addresses.
  • ADJUDICATOR_ROLE holders can call slash. No collateral weight for parameter administration — this registry is purely for collateral management and slashing. See NodeRegistry for the parameter-administration-enabled variant used by node operators. Slashing can occur in both Locked and Unlocking states.

State Variables

ADJUDICATOR_ROLE

bytes32 public constant ADJUDICATOR_ROLE = keccak256("ADJUDICATOR_ROLE")

slashCooldown

Minimum time (seconds) that must elapse between any two slash calls.

uint256 public slashCooldown

lastSlashTimestamp

Timestamp of the last successful slash.

uint256 public lastSlashTimestamp

Functions

constructor

constructor(address asset_, uint256 unlockPeriod_, address admin_) Locker(asset_, unlockPeriod_);

setSlashCooldown

Sets the global cooldown between slash calls.

function setSlashCooldown(uint256 newCooldown) external onlyRole(DEFAULT_ADMIN_ROLE);

Parameters

NameTypeDescription
newCooldownuint256The new cooldown in seconds (0 disables the cooldown).

slash

Reduces a user's locked balance and transfers the slashed tokens to the specified recipient. Callable only by an authorised adjudicator.

function slash(address user, uint256 amount, address recipient, bytes calldata decision)
external
onlyRole(ADJUDICATOR_ROLE)
nonReentrant;

Parameters

NameTypeDescription
useraddressThe user to slash.
amountuint256The amount of tokens to slash.
recipientaddressThe address that receives the slashed tokens (cannot be the caller).
decisionbytesOff-chain reference to the dispute decision.

Events

SlashCooldownUpdated

event SlashCooldownUpdated(uint256 oldCooldown, uint256 newCooldown);

Errors

SlashCooldownActive

error SlashCooldownActive(uint256 availableAt);