Skip to main content
Version: 1.x

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. Adjudicators are not economically incentivised by slash outcomes by design. Dispute initiators pay the adjudicator's handling fee off-chain (similar to arbitration forums / ODRP). This avoids creating perverse incentives around decision outcomes.

State Variables

ADJUDICATOR_ROLE

bytes32 public constant ADJUDICATOR_ROLE = keccak256("ADJUDICATOR_ROLE")

slashCooldown

Minimum time (seconds) that must elapse between consecutive slashes by the same adjudicator.

uint256 public slashCooldown

lastSlashTimestamp

Timestamp of the last successful slash per adjudicator.

mapping(address => uint256) public lastSlashTimestamp

minSlashAmount

Minimum slash amount. Slashes below this are rejected unless amount == balance (full-balance slash). Prevents zero-amount or dust slashes from resetting the cooldown.

uint256 public minSlashAmount

Functions

constructor

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

setSlashCooldown

Sets the per-adjudicator cooldown between slash calls.

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

Parameters

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

setMinSlashAmount

Sets the minimum slash amount.

function setMinSlashAmount(uint256 newAmount) external onlyRole(DEFAULT_ADMIN_ROLE);

Parameters

NameTypeDescription
newAmountuint256The new minimum amount (0 disables the minimum).

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);

MinSlashAmountUpdated

event MinSlashAmountUpdated(uint256 oldAmount, uint256 newAmount);

Errors

SlashCooldownActive

error SlashCooldownActive(uint256 availableAt);