Skip to main content

Slasher

Git Source

Methods

BURNER_GAS_LIMIT

function BURNER_GAS_LIMIT() external view returns (uint256)

Get a gas limit for the burner.

Returns

NameTypeDescription
uint256value of the burner gas limit

BURNER_RESERVE

function BURNER_RESERVE() external view returns (uint256)

Get a reserve gas between the gas limit check and the burner’s execution.

Returns

NameTypeDescription
uint256value of the reserve gas

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)

isBurnerHook

function isBurnerHook() external view returns (bool)

Get if the burner is needed to be called on a slashing.

Returns

NameTypeDescription
boolif the burner is a hook

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
slashedAmountuint256virtual amount 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 to perform slashings on

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
slashedAmountuint256virtual amount of the collateral slashed
captureTimestampuint48time point when the stake was captured

Structs

BaseParams

struct BaseParams {
bool isBurnerHook;
}

Base parameters needed for slashers’ deployment.

Parameters

NameTypeDescription
isBurnerHookboolif the burner is needed to be called on a slashing

InitParams

struct InitParams {
BaseParams baseParams;
}

Initial parameters needed for a slasher deployment.

Parameters

NameTypeDescription
baseParamsBaseParamsbase parameters for slashers’ deployment

GeneralDelegatorData

struct GeneralDelegatorData {
uint64 slasherType;
bytes data;
}

General data for the delegator.

Parameters

NameTypeDescription
slasherTypeuint64type of the slasher
databytesslasher-dependent data for the delegator

DelegatorData

struct DelegatorData {
uint256 slashableStake;
uint256 stakeAt;
}

Extra data for the delegator.

Parameters

NameTypeDescription
slashableStakeuint256amount of the slashable stake before the slash (cache)
stakeAtuint256amount of the stake at the capture time (cache)

SlashableStakeHints

struct SlashableStakeHints {
bytes stakeHints;
bytes cumulativeSlashFromHint;
}

Hints for a slashable stake.

Parameters

NameTypeDescription
stakeHintsbyteshints for the stake checkpoints
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