Skip to main content

Slasher

Git Source

Methods

FACTORY

function FACTORY() external view returns (address)

Get the factory's address.

Returns

NameTypeDescription
addressaddress of the factory

NETWORK_MIDDLEWARE_SERVICE

function NETWORK_MIDDLEWARE_SERVICE() external view returns (address)

Get the network middleware service's address.

Returns

NameTypeDescription
addressaddress of the network middleware service

TYPE

function TYPE() external view returns (uint64)

Get the entity's type.

Returns

NameTypeDescription
uint64type of the entity

VAULT_FACTORY

function VAULT_FACTORY() external view returns (address)

Get the vault factory's address.

Returns

NameTypeDescription
addressaddress of the vault factory

cumulativeSlash

function cumulativeSlash(bytes32 subnetwork, address operator) external view returns (uint256)

Get a cumulative slash amount for an operator on a subnetwork.

Parameters

NameTypeDescription
subnetworkbytes32full identifier of the subnetwork (address of the network concatenated with the uint96 identifier)
operatoraddressaddress of the operator

Returns

NameTypeDescription
uint256cumulative slash amount

cumulativeSlashAt

function cumulativeSlashAt(bytes32 subnetwork, address operator, uint48 timestamp, bytes hint) external view returns (uint256)

Get a cumulative slash amount for an operator on a subnetwork until a given timestamp (inclusively) using a hint.

Parameters

NameTypeDescription
subnetworkbytes32full identifier of the subnetwork (address of the network concatenated with the uint96 identifier)
operatoraddressaddress of the operator
timestampuint48time point to get the cumulative slash amount until (inclusively)
hintbyteshint for the checkpoint index

Returns

NameTypeDescription
uint256cumulative slash amount until the given timestamp (inclusively)

globalCumulativeSlash

function globalCumulativeSlash() external view returns (uint256)

Get a global cumulative slash amount.

Returns

NameTypeDescription
uint256cumulative slash amount

globalCumulativeSlashAt

function globalCumulativeSlashAt(uint48 timestamp, bytes hint) external view returns (uint256)

Get a global cumulative slash amount until a given timestamp (inclusively) using a hint.

Parameters

NameTypeDescription
timestampuint48time point to get the cumulative slash amount until (inclusively)
hintbyteshint for the checkpoint index

Returns

NameTypeDescription
uint256cumulative slash amount until the given timestamp (inclusively)

latestSlashedCaptureTimestamp

function latestSlashedCaptureTimestamp(bytes32 subnetwork, address operator) external view returns (uint48 value)

Get the latest capture timestamp that was slashed on a subnetwork.

Parameters

NameTypeDescription
subnetworkbytes32full identifier of the subnetwork (address of the network concatenated with the uint96 identifier)
operatoraddressaddress of the operator

Returns

NameTypeDescription
uint48latest capture timestamp that was slashed

slash

function slash(bytes32 subnetwork, address operator, uint256 amount, uint48 captureTimestamp, bytes hints) external nonpayable returns (uint256 slashedAmount)

Perform a slash using a subnetwork for a particular operator by a given amount using hints.

Only a network middleware can call this function.

Parameters

NameTypeDescription
subnetworkbytes32full identifier of the subnetwork (address of the network concatenated with the uint96 identifier)
operatoraddressaddress of the operator
amountuint256maximum amount of the collateral to be slashed
captureTimestampuint48time point when the stake was captured
hintsbyteshints for checkpoints' indexes

Returns

NameTypeDescription
slashedAmountuint256amount of the collateral slashed

slashableStake

function slashableStake(bytes32 subnetwork, address operator, uint48 captureTimestamp, bytes hints) external view returns (uint256)

Get a slashable amount of a stake got at a given capture timestamp using hints.

Parameters

NameTypeDescription
subnetworkbytes32full identifier of the subnetwork (address of the network concatenated with the uint96 identifier)
operatoraddressaddress of the operator
captureTimestampuint48time point to get the stake amount at
hintsbyteshints for the checkpoints' indexes

Returns

NameTypeDescription
uint256slashable amount of the stake

staticDelegateCall

function staticDelegateCall(address target, bytes data) external nonpayable

Make a delegatecall from this contract to a given target contract with a particular data (always reverts with a return data).

It allows to use this contract's storage on-chain.

Parameters

NameTypeDescription
targetaddressaddress of the contract to make a delegatecall to
databytesdata to make a delegatecall with

vault

function vault() external view returns (address)

Get the vault's address.

Returns

NameTypeDescription
addressaddress of the vault

Events

Initialized

event Initialized(uint64 version)

Triggered when the contract has been initialized or reinitialized.

Parameters

NameTypeDescription
versionuint64

Slash

event Slash(bytes32 indexed subnetwork, address indexed operator, uint256 slashedAmount, uint48 captureTimestamp)

Emitted when a slash is performed.

Parameters

NameTypeDescription
subnetwork indexedbytes32subnetwork that requested the slash
operator indexedaddressoperator that is slashed
slashedAmountuint256amount of the collateral slashed
captureTimestampuint48time point when the stake was captured

Structs

SlashableStakeHints

struct SlashableStakeHints {
bytes activeStakeHint;
bytes stakeHints;
bytes globalCumulativeSlashFromHint;
bytes cumulativeSlashFromHint;
}

Hints for a slashable stake.

Parameters

NameTypeDescription
activeStakeHintbyteshint for the active stake checkpoint
stakeHintsbyteshints for the stake checkpoints
globalCumulativeSlashFromHintbyteshint for the global cumulative slash amount at a capture timestamp
cumulativeSlashFromHintbyteshint for the cumulative slash amount at a capture timestamp

SlashHints

struct SlashHints {
bytes slashableStakeHints;
}

Hints for a slash.

Parameters

NameTypeDescription
slashableStakeHintsbyteshints for the slashable stake checkpoints