Skip to main content

NetworkRestakeDelegator

Git Source

Methods

DEFAULT_ADMIN_ROLE

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns

NameTypeDescription
bytes32

FACTORY

function FACTORY() external view returns (address)

Get the factory's address.

Returns

NameTypeDescription
addressaddress of the factory

HOOK_GAS_LIMIT

function HOOK_GAS_LIMIT() external view returns (uint256)

Get a gas limit for the hook.

Returns

NameTypeDescription
uint256value of the hook gas limit

HOOK_RESERVE

function HOOK_RESERVE() external view returns (uint256)

Get a reserve gas between the gas limit check and the hook's execution.

Returns

NameTypeDescription
uint256value of the reserve gas

HOOK_SET_ROLE

function HOOK_SET_ROLE() external view returns (bytes32)

Get a hook setter's role.

Returns

NameTypeDescription
bytes32identifier of the hook setter role

NETWORK_LIMIT_SET_ROLE

function NETWORK_LIMIT_SET_ROLE() external view returns (bytes32)

Get a subnetwork limit setter's role.

Returns

NameTypeDescription
bytes32identifier of the subnetwork limit setter role

NETWORK_REGISTRY

function NETWORK_REGISTRY() external view returns (address)

Get the network registry's address.

Returns

NameTypeDescription
addressaddress of the network registry

OPERATOR_NETWORK_OPT_IN_SERVICE

function OPERATOR_NETWORK_OPT_IN_SERVICE() external view returns (address)

Get the operator-network opt-in service's address.

Returns

NameTypeDescription
addressaddress of the operator-network opt-in service

OPERATOR_NETWORK_SHARES_SET_ROLE

function OPERATOR_NETWORK_SHARES_SET_ROLE() external view returns (bytes32)

Get an operator-subnetwork shares setter's role.

Returns

NameTypeDescription
bytes32identifier of the operator-subnetwork shares setter role

OPERATOR_VAULT_OPT_IN_SERVICE

function OPERATOR_VAULT_OPT_IN_SERVICE() external view returns (address)

Get the operator-vault opt-in service's address.

Returns

NameTypeDescription
addressaddress of the operator-vault opt-in 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

VERSION

function VERSION() external view returns (uint64)

Get a version of the delegator (different versions mean different interfaces).

Must return 1 for this one.

Returns

NameTypeDescription
uint64version of the delegator

getRoleAdmin

function getRoleAdmin(bytes32 role) external view returns (bytes32)

Returns the admin role that controls role. See grantRole and revokeRole. To change a role's admin, use \_setRoleAdmin.

Parameters

NameTypeDescription
rolebytes32

Returns

NameTypeDescription
bytes32

grantRole

function grantRole(bytes32 role, address account) external nonpayable

Grants role to account. If account had not been already granted role, emits a RoleGranted event. Requirements: - the caller must have role's admin role. May emit a RoleGranted event.

Parameters

NameTypeDescription
rolebytes32
accountaddress

hasRole

function hasRole(bytes32 role, address account) external view returns (bool)

Returns true if account has been granted role.

Parameters

NameTypeDescription
rolebytes32
accountaddress

Returns

NameTypeDescription
bool

hook

function hook() external view returns (address)

Get the hook's address.

The hook can have arbitrary logic under certain functions, however, it doesn't affect the stake guarantees.

Returns

NameTypeDescription
addressaddress of the hook

maxNetworkLimit

function maxNetworkLimit(bytes32 subnetwork) external view returns (uint256 value)

Get a particular subnetwork's maximum limit (meaning the subnetwork is not ready to get more as a stake).

Parameters

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

Returns

NameTypeDescription
valueuint256maximum limit of the subnetwork

networkLimit

function networkLimit(bytes32 subnetwork) external view returns (uint256)

Get a subnetwork's limit (how much stake the vault curator is ready to give to the subnetwork).

Parameters

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

Returns

NameTypeDescription
uint256limit of the subnetwork

networkLimitAt

function networkLimitAt(bytes32 subnetwork, uint48 timestamp, bytes hint) external view returns (uint256)

Get a subnetwork's limit at a given timestamp using a hint (how much stake the vault curator is ready to give to the subnetwork).

Parameters

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

Returns

NameTypeDescription
uint256limit of the subnetwork at the given timestamp

onSlash

function onSlash(bytes32 subnetwork, address operator, uint256 slashedAmount, uint48 captureTimestamp, bytes data) external nonpayable

Called when a slash happens.

Only the vault's slasher can call this function.

Parameters

NameTypeDescription
subnetworkbytes32full identifier of the subnetwork (address of the network concatenated with the uint96 identifier)
operatoraddressaddress of the operator
slashedAmountuint256amount of the collateral slashed
captureTimestampuint48time point when the stake was captured
databytessome additional data

operatorNetworkShares

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

Get an operator's shares for a subnetwork (what percentage, which is equal to the shares divided by the total operators' shares, of the subnetwork's stake the vault curator is ready to give to the operator).

Parameters

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

Returns

NameTypeDescription
uint256shares of the operator for the subnetwork

operatorNetworkSharesAt

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

Get an operator's shares for a subnetwork at a given timestamp using a hint (what percentage, which is equal to the shares divided by the total operators' shares, of the subnetwork's stake the vault curator is ready to give to the operator).

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 operator's shares at
hintbyteshint for checkpoint index

Returns

NameTypeDescription
uint256shares of the operator for the subnetwork at the given timestamp

renounceRole

function renounceRole(bytes32 role, address callerConfirmation) external nonpayable

Revokes role from the calling account. Roles are often managed via grantRole and revokeRole: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked role, emits a RoleRevoked event. Requirements: - the caller must be callerConfirmation. May emit a RoleRevoked event.

Parameters

NameTypeDescription
rolebytes32
callerConfirmationaddress

revokeRole

function revokeRole(bytes32 role, address account) external nonpayable

Revokes role from account. If account had been granted role, emits a RoleRevoked event. Requirements: - the caller must have role's admin role. May emit a RoleRevoked event.

Parameters

NameTypeDescription
rolebytes32
accountaddress

setHook

function setHook(address hook) external nonpayable

Set a new hook.

Only a HOOK_SET_ROLE holder can call this function. The hook can have arbitrary logic under certain functions, however, it doesn't affect the stake guarantees.

Parameters

NameTypeDescription
hookaddressaddress of the hook

setMaxNetworkLimit

function setMaxNetworkLimit(uint96 identifier, uint256 amount) external nonpayable

Set a maximum limit for a subnetwork (how much stake the subnetwork is ready to get). identifier identifier of the subnetwork

Only a network can call this function.

Parameters

NameTypeDescription
identifieruint96identifier of the subnetwork
amountuint256new maximum subnetwork's limit

setNetworkLimit

function setNetworkLimit(bytes32 subnetwork, uint256 amount) external nonpayable

Set a subnetwork's limit (how much stake the vault curator is ready to give to the subnetwork).

Only a NETWORK_LIMIT_SET_ROLE holder can call this function.

Parameters

NameTypeDescription
subnetworkbytes32full identifier of the subnetwork (address of the network concatenated with the uint96 identifier)
amountuint256new limit of the subnetwork

setOperatorNetworkShares

function setOperatorNetworkShares(bytes32 subnetwork, address operator, uint256 shares) external nonpayable

Set an operator's shares for a subnetwork (what percentage, which is equal to the shares divided by the total operators' shares, of the subnetwork's stake the vault curator is ready to give to the operator).

Only an OPERATOR_NETWORK_SHARES_SET_ROLE holder can call this function.

Parameters

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

stake

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

Get a stake that a given subnetwork will be able to slash for a certain operator until the end of the next epoch (if no cross-slashing and no slashings by the subnetwork).

Warning: this function is not safe to use for stake capturing, as it can change by the end of the block.

Parameters

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

Returns

NameTypeDescription
uint256slashable stake until the end of the next epoch

stakeAt

function stakeAt(bytes32 subnetwork, address operator, uint48 timestamp, bytes hints) external view returns (uint256)

Get a stake that a given subnetwork could be able to slash for a certain operator at a given timestamp until the end of the consequent epoch using hints (if no cross-slashing and no slashings by the subnetwork).

Warning: it is not safe to use timestamp >= current one for the stake capturing, as it can change later.

Parameters

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

Returns

NameTypeDescription
uint256slashable stake at the given timestamp until the end of the consequent epoch

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

supportsInterface

function supportsInterface(bytes4 interfaceId) external view returns (bool)

See IERC165-supportsInterface.

Parameters

NameTypeDescription
interfaceIdbytes4

Returns

NameTypeDescription
bool

totalOperatorNetworkShares

function totalOperatorNetworkShares(bytes32 subnetwork) external view returns (uint256)

Get a sum of operators' shares for a subnetwork.

Parameters

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

Returns

NameTypeDescription
uint256total shares of the operators for the subnetwork

totalOperatorNetworkSharesAt

function totalOperatorNetworkSharesAt(bytes32 subnetwork, uint48 timestamp, bytes hint) external view returns (uint256)

Get a sum of operators' shares for a subnetwork at a given timestamp using a hint.

Parameters

NameTypeDescription
subnetworkbytes32full identifier of the subnetwork (address of the network concatenated with the uint96 identifier)
timestampuint48time point to get the total operators' shares at
hintbyteshint for checkpoint index

Returns

NameTypeDescription
uint256total shares of the operators for the subnetwork at the given timestamp

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

OnSlash

event OnSlash(bytes32 indexed subnetwork, address indexed operator, uint256 slashedAmount)

Emitted when a slash happened.

Parameters

NameTypeDescription
subnetwork indexedbytes32full identifier of the subnetwork (address of the network concatenated with the uint96 identifier)
operator indexedaddressaddress of the operator
slashedAmountuint256amount of the collateral slashed

RoleAdminChanged

event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)

Emitted when newAdminRole is set as role's admin role, replacing previousAdminRole DEFAULT_ADMIN_ROLE is the starting admin for all roles, despite RoleAdminChanged not being emitted signaling this.

Parameters

NameTypeDescription
role indexedbytes32
previousAdminRole indexedbytes32
newAdminRole indexedbytes32

RoleGranted

event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)

Emitted when account is granted role. sender is the account that originated the contract call, an admin role bearer except when using AccessControl-\_setupRole.

Parameters

NameTypeDescription
role indexedbytes32
account indexedaddress
sender indexedaddress

RoleRevoked

event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)

Emitted when account is revoked role. sender is the account that originated the contract call: - if using revokeRole, it is the admin role bearer - if using renounceRole, it is the role bearer (i.e. account)

Parameters

NameTypeDescription
role indexedbytes32
account indexedaddress
sender indexedaddress

SetHook

event SetHook(address indexed hook)

Emitted when a hook is set.

Parameters

NameTypeDescription
hook indexedaddressaddress of the hook

SetMaxNetworkLimit

event SetMaxNetworkLimit(bytes32 indexed subnetwork, uint256 amount)

Emitted when a subnetwork's maximum limit is set.

Parameters

NameTypeDescription
subnetwork indexedbytes32full identifier of the subnetwork (address of the network concatenated with the uint96 identifier)
amountuint256new maximum subnetwork's limit (how much stake the subnetwork is ready to get)

SetNetworkLimit

event SetNetworkLimit(bytes32 indexed subnetwork, uint256 amount)

Emitted when a subnetwork's limit is set.

Parameters

NameTypeDescription
subnetwork indexedbytes32full identifier of the subnetwork (address of the network concatenated with the uint96 identifier)
amountuint256new subnetwork's limit (how much stake the vault curator is ready to give to the subnetwork)

SetOperatorNetworkShares

event SetOperatorNetworkShares(bytes32 indexed subnetwork, address indexed operator, uint256 shares)

Emitted when an operator's shares inside a subnetwork are set.

Parameters

NameTypeDescription
subnetwork indexedbytes32full identifier of the subnetwork (address of the network concatenated with the uint96 identifier)
operator indexedaddressaddress of the operator
sharesuint256new operator's shares inside the subnetwork (what percentage, which is equal to the shares divided by the total operators' shares, of the subnetwork's stake the vault curator is ready to give to the operator)

Structs

BaseParams

struct BaseParams {
address defaultAdminRoleHolder;
address hook;
address hookSetRoleHolder;
}

Base parameters needed for delegators' deployment.

Parameters

NameTypeDescription
defaultAdminRoleHolderaddressaddress of the initial DEFAULT_ADMIN_ROLE holder
hookaddressaddress of the hook contract
hookSetRoleHolderaddressaddress of the initial HOOK_SET_ROLE holder

InitParams

struct InitParams {
BaseParams baseParams;
address[] networkLimitSetRoleHolders;
address[] operatorNetworkSharesSetRoleHolders;
}

Initial parameters needed for a full restaking delegator deployment.

Parameters

NameTypeDescription
baseParamsBaseParamsbase parameters for delegators' deployment
networkLimitSetRoleHoldersaddress[]array of addresses of the initial NETWORK_LIMIT_SET_ROLE holders
operatorNetworkSharesSetRoleHoldersaddress[]array of addresses of the initial OPERATOR_NETWORK_SHARES_SET_ROLE holders

StakeBaseHints

struct StakeBaseHints {
bytes operatorVaultOptInHint;
bytes operatorNetworkOptInHint;
}

Base hints for a stake.

Parameters

NameTypeDescription
operatorVaultOptInHintbyteshint for the operator-vault opt-in
operatorNetworkOptInHintbyteshint for the operator-network opt-in

StakeHints

struct StakeHints {
bytes baseHints;
bytes activeStakeHint;
bytes networkLimitHint;
bytes totalOperatorNetworkSharesHint;
bytes operatorNetworkSharesHint;
}

Hints for a stake.

Parameters

NameTypeDescription
baseHintsbytesbase hints
activeStakeHintbyteshint for the active stake checkpoint
networkLimitHintbyteshint for the subnetwork limit checkpoint
totalOperatorNetworkSharesHintbyteshint for the total operator-subnetwork shares checkpoint
operatorNetworkSharesHintbyteshint for the operator-subnetwork shares checkpoint