Skip to main content

VetoSlasher

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

NETWORK_REGISTRY

function NETWORK_REGISTRY() external view returns (address)

Get the network registry’s address.

Returns

NameTypeDescription
addressaddress of the network registry

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)

executeSlash

function executeSlash(uint256 slashIndex, bytes hints) external nonpayable returns (uint256 slashedAmount)

Execute a slash with a given slash index using hints.

Only a network middleware can call this function.

Parameters

NameTypeDescription
slashIndexuint256index of the slash request
hintsbyteshints for checkpoints’ indexes

Returns

NameTypeDescription
slashedAmountuint256virtual amount of the collateral slashed

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)
addresslatest capture timestamp that was slashed

Returns

NameTypeDescription
valueuint48latest capture timestamp that was slashed

requestSlash

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

Request 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
slashIndexuint256index of the slash request

resolver

function resolver(bytes32 subnetwork, bytes hint) external view returns (address)

Get a resolver for a given subnetwork using a hint.

Parameters

NameTypeDescription
subnetworkbytes32full identifier of the subnetwork (address of the network concatenated with the uint96 identifier)
hintbyteshint for the checkpoint index

Returns

NameTypeDescription
addressaddress of the resolver

resolverAt

function resolverAt(bytes32 subnetwork, uint48 timestamp, bytes hint) external view returns (address)

Get a resolver for a given subnetwork at a particular timestamp using a hint.

Parameters

NameTypeDescription
subnetworkbytes32full identifier of the subnetwork (address of the network concatenated with the uint96 identifier)
timestampuint48timestamp to get the resolver at
hintbyteshint for the checkpoint index

Returns

NameTypeDescription
addressaddress of the resolver

resolverSetEpochsDelay

function resolverSetEpochsDelay() external view returns (uint256)

Get a delay for networks in epochs to update a resolver.

Returns

NameTypeDescription
uint256updating resolver delay in epochs

setResolver

function setResolver(uint96 identifier, address resolver, bytes hints) external nonpayable

Parameters

NameTypeDescription
identifieruint96identifier of the subnetwork
resolveraddressaddress of the resolver
hintsbyteshints for checkpoints’ indexes

slashRequests

function slashRequests(uint256) external view returns (bytes32 subnetwork, address operator, uint256 amount, uint48 captureTimestamp, uint48 vetoDeadline, bool completed)

Get a particular slash request.

Parameters

NameTypeDescription
uint256index of the slash request

Returns

NameTypeDescription
subnetworkbytes32subnetwork that requested the slash
operatoraddressoperator that could be slashed (if the request is not vetoed)
amountuint256maximum amount of the collateral to be slashed
captureTimestampuint48time point when the stake was captured
vetoDeadlineuint48deadline for the resolver to veto the slash (exclusively)
completedboolif the slash was vetoed/executed

slashRequestsLength

function slashRequestsLength() external view returns (uint256)

Get a total number of slash requests.

Returns

NameTypeDescription
uint256total number of slash requests

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

vetoDuration

function vetoDuration() external view returns (uint48)

Get a duration during which resolvers can veto slash requests.

Returns

NameTypeDescription
uint48duration of the veto period

vetoSlash

function vetoSlash(uint256 slashIndex, bytes hints) external nonpayable

Veto a slash with a given slash index using hints.

Only a resolver can call this function.

Parameters

NameTypeDescription
slashIndexuint256index of the slash request
hintsbyteshints for checkpoints’ indexes

Events

ExecuteSlash

event ExecuteSlash(uint256 indexed slashIndex, uint256 slashedAmount)

Emitted when a slash request is executed.

Parameters

NameTypeDescription
slashIndex indexeduint256index of the slash request
slashedAmountuint256virtual amount of the collateral slashed

Initialized

event Initialized(uint64 version)

Triggered when the contract has been initialized or reinitialized.

Parameters

NameTypeDescription
versionuint64

RequestSlash

event RequestSlash(uint256 indexed slashIndex, bytes32 indexed subnetwork, address indexed operator, uint256 slashAmount, uint48 captureTimestamp, uint48 vetoDeadline)

Emitted when a slash request is created.

Parameters

NameTypeDescription
slashIndex indexeduint256index of the slash request
subnetwork indexedbytes32subnetwork that requested the slash
operator indexedaddressoperator that could be slashed (if the request is not vetoed)
slashAmountuint256maximum amount of the collateral to be slashed
captureTimestampuint48time point when the stake was captured
vetoDeadlineuint48deadline for the resolver to veto the slash (exclusively)

SetResolver

event SetResolver(bytes32 indexed subnetwork, address resolver)

Emitted when a resolver is set.

Parameters

NameTypeDescription
subnetwork indexedbytes32full identifier of the subnetwork (address of the network concatenated with the uint96 identifier)
resolveraddressaddress of the resolver

VetoSlash

event VetoSlash(uint256 indexed slashIndex, address indexed resolver)

Emitted when a slash request is vetoed.

Parameters

NameTypeDescription
slashIndex indexeduint256index of the slash request
resolver indexedaddressaddress of the resolver that vetoed the slash

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;
uint48 vetoDuration;
uint256 resolverSetEpochsDelay;
}

Initial parameters needed for a slasher deployment.

Parameters

NameTypeDescription
baseParamsBaseParamsbase parameters for slashers’ deployment
vetoDurationuint48duration of the veto period for a slash request
resolverSetEpochsDelayuint256delay in epochs for a network to update a resolver

SlashRequest

struct SlashRequest {
bytes32 subnetwork;
address operator;
uint256 amount;
uint48 captureTimestamp;
uint48 vetoDeadline;
bool completed;
}

Structure for a slash request.

Parameters

NameTypeDescription
subnetworkbytes32subnetwork that requested the slash
operatoraddressoperator that could be slashed (if the request is not vetoed)
amountuint256maximum amount of the collateral to be slashed
captureTimestampuint48time point when the stake was captured
vetoDeadlineuint48deadline for the resolver to veto the slash (exclusively)
completedboolif the slash was vetoed/executed

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;
uint256 slashIndex;
}

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)
slashIndexuint256index of the slash request

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

RequestSlashHints

struct RequestSlashHints {
bytes slashableStakeHints;
}

Hints for a slash request.

Parameters

NameTypeDescription
slashableStakeHintsbyteshints for the slashable stake checkpoints

ExecuteSlashHints

struct ExecuteSlashHints {
bytes captureResolverHint;
bytes currentResolverHint;
bytes slashableStakeHints;
}

Hints for a slash execute.

Parameters

NameTypeDescription
captureResolverHintbyteshint for the resolver checkpoint at the capture time
currentResolverHintbyteshint for the resolver checkpoint at the current time
slashableStakeHintsbyteshints for the slashable stake checkpoints

VetoSlashHints

struct VetoSlashHints {
bytes captureResolverHint;
bytes currentResolverHint;
}

Hints for a slash veto.

Parameters

NameTypeDescription
captureResolverHintbyteshint for the resolver checkpoint at the capture time
currentResolverHintbyteshint for the resolver checkpoint at the current time

SetResolverHints

struct SetResolverHints {
bytes resolverHint;
}

Hints for a resolver set.

Parameters

NameTypeDescription
resolverHintbyteshint for the resolver checkpoint