Git Source
Methods
DEFAULT_ADMIN_ROLE
function DEFAULT_ADMIN_ROLE() external view returns (bytes32)
Returns
Name | Type | Description |
---|
| bytes32 | |
FACTORY
function FACTORY() external view returns (address)
Get the factory’s address.
Returns
Name | Type | Description |
---|
| address | address of the factory |
HOOK_GAS_LIMIT
function HOOK_GAS_LIMIT() external view returns (uint256)
Get a gas limit for the hook.
Returns
Name | Type | Description |
---|
| uint256 | value 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
Name | Type | Description |
---|
| uint256 | value of the reserve gas |
HOOK_SET_ROLE
function HOOK_SET_ROLE() external view returns (bytes32)
Get a hook setter’s role.
Returns
Name | Type | Description |
---|
| bytes32 | identifier 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
Name | Type | Description |
---|
| bytes32 | identifier of the subnetwork limit setter role |
NETWORK_REGISTRY
function NETWORK_REGISTRY() external view returns (address)
Get the network registry’s address.
Returns
Name | Type | Description |
---|
| address | address of the network registry |
OPERATOR_NETWORK_LIMIT_SET_ROLE
function OPERATOR_NETWORK_LIMIT_SET_ROLE() external view returns (bytes32)
Get an operator-subnetwork limit setter’s role.
Returns
Name | Type | Description |
---|
| bytes32 | identifier of the operator-subnetwork limit setter role |
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
Name | Type | Description |
---|
| address | address of the operator-network opt-in service |
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
Name | Type | Description |
---|
| address | address of the operator-vault opt-in service |
TYPE
function TYPE() external view returns (uint64)
Get the entity’s type.
Returns
Name | Type | Description |
---|
| uint64 | type of the entity |
VAULT_FACTORY
function VAULT_FACTORY() external view returns (address)
Get the vault factory’s address.
Returns
Name | Type | Description |
---|
| address | address 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
Name | Type | Description |
---|
| uint64 | version 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
Name | Type | Description |
---|
role | bytes32 | |
Returns
Name | Type | Description |
---|
| 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
Name | Type | Description |
---|
role | bytes32 | |
account | address | |
hasRole
function hasRole(bytes32 role, address account) external view returns (bool)
Returns true
if account
has been granted role
.
Parameters
Name | Type | Description |
---|
role | bytes32 | |
account | address | |
Returns
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
Name | Type | Description |
---|
| address | address 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
Name | Type | Description |
---|
subnetwork | bytes32 | full identifier of the subnetwork (address of the network concatenated with the uint96 identifier) |
Returns
Name | Type | Description |
---|
value | uint256 | maximum 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
Name | Type | Description |
---|
subnetwork | bytes32 | full identifier of the subnetwork (address of the network concatenated with the uint96 identifier) |
Returns
Name | Type | Description |
---|
| uint256 | limit 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
Name | Type | Description |
---|
subnetwork | bytes32 | full identifier of the subnetwork (address of the network concatenated with the uint96 identifier) |
timestamp | uint48 | time point to get the subnetwork limit at |
hint | bytes | hint for checkpoint index |
Returns
Name | Type | Description |
---|
| uint256 | limit of the subnetwork at the given timestamp |
onSlash
function onSlash(bytes32 subnetwork, address operator, uint256 amount, uint48 captureTimestamp, bytes data) external nonpayable
Called when a slash happens.
Only the vault’s slasher can call this function.
Parameters
Name | Type | Description |
---|
subnetwork | bytes32 | full identifier of the subnetwork (address of the network concatenated with the uint96 identifier) |
operator | address | address of the operator |
amount | uint256 | amount of the collateral slashed |
captureTimestamp | uint48 | time point when the stake was captured |
data | bytes | some additional data |
operatorNetworkLimit
function operatorNetworkLimit(bytes32 subnetwork, address operator) external view returns (uint256)
Get an operator’s limit for a subnetwork. (how much stake the vault curator is ready to give to the operator for the subnetwork)
Parameters
Name | Type | Description |
---|
subnetwork | bytes32 | full identifier of the subnetwork (address of the network concatenated with the uint96 identifier) |
operator | address | address of the operator |
Returns
Name | Type | Description |
---|
| uint256 | limit of the operator for the subnetwork |
operatorNetworkLimitAt
function operatorNetworkLimitAt(bytes32 subnetwork, address operator, uint48 timestamp, bytes hint) external view returns (uint256)
Get an operator’s limit for a subnetwork at a given timestamp using a hint (how much stake the vault curator is ready to give to the operator for the subnetwork).
Parameters
Name | Type | Description |
---|
subnetwork | bytes32 | full identifier of the subnetwork (address of the network concatenated with the uint96 identifier) |
operator | address | address of the operator |
timestamp | uint48 | time point to get the operator’s limit for the subnetwork at |
hint | bytes | hint for checkpoint index |
Returns
Name | Type | Description |
---|
| uint256 | limit 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
Name | Type | Description |
---|
role | bytes32 | |
callerConfirmation | address | |
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
Name | Type | Description |
---|
role | bytes32 | |
account | address | |
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
Name | Type | Description |
---|
hook | address | address 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
Name | Type | Description |
---|
identifier | uint96 | identifier of the subnetwork |
amount | uint256 | new 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
Name | Type | Description |
---|
subnetwork | bytes32 | full identifier of the subnetwork (address of the network concatenated with the uint96 identifier) |
amount | uint256 | new limit of the subnetwork |
setOperatorNetworkLimit
function setOperatorNetworkLimit(bytes32 subnetwork, address operator, uint256 amount) external nonpayable
Set an operator’s limit for a subnetwork. (how much stake the vault curator is ready to give to the operator for the subnetwork)
Only an OPERATOR_NETWORK_LIMIT_SET_ROLE holder can call this function.
Parameters
Name | Type | Description |
---|
subnetwork | bytes32 | full identifier of the subnetwork (address of the network concatenated with the uint96 identifier) |
operator | address | address of the operator |
amount | uint256 | new limit 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
Name | Type | Description |
---|
subnetwork | bytes32 | full identifier of the subnetwork (address of the network concatenated with the uint96 identifier) |
operator | address | address of the operator |
Returns
Name | Type | Description |
---|
| uint256 | slashable 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
Name | Type | Description |
---|
subnetwork | bytes32 | full identifier of the subnetwork (address of the network concatenated with the uint96 identifier) |
operator | address | address of the operator |
timestamp | uint48 | time point to capture the stake at |
hints | bytes | hints for the checkpoints’ indexes |
Returns
Name | Type | Description |
---|
| uint256 | slashable 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
Name | Type | Description |
---|
target | address | address of the contract to make a delegatecall to |
data | bytes | data to make a delegatecall with |
supportsInterface
function supportsInterface(bytes4 interfaceId) external view returns (bool)
See IERC165-supportsInterface
.
Parameters
Name | Type | Description |
---|
interfaceId | bytes4 | |
Returns
vault
function vault() external view returns (address)
Get the vault’s address.
Returns
Name | Type | Description |
---|
| address | address of the vault |
Events
Initialized
event Initialized(uint64 version)
Triggered when the contract has been initialized or reinitialized.
Parameters
Name | Type | Description |
---|
version | uint64 | |
OnSlash
event OnSlash(bytes32 indexed subnetwork, address indexed operator, uint256 amount, uint48 captureTimestamp)
Emitted when a slash happens.
Parameters
Name | Type | Description |
---|
subnetwork indexed | bytes32 | full identifier of the subnetwork (address of the network concatenated with the uint96 identifier) |
operator indexed | address | address of the operator |
amount | uint256 | amount of the collateral to be slashed |
captureTimestamp | uint48 | time point when the stake was captured |
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
Name | Type | Description |
---|
role indexed | bytes32 | |
previousAdminRole indexed | bytes32 | |
newAdminRole indexed | bytes32 | |
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
Name | Type | Description |
---|
role indexed | bytes32 | |
account indexed | address | |
sender indexed | address | |
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
Name | Type | Description |
---|
role indexed | bytes32 | |
account indexed | address | |
sender indexed | address | |
SetHook
event SetHook(address indexed hook)
Emitted when a hook is set.
Parameters
Name | Type | Description |
---|
hook indexed | address | address of the hook |
SetMaxNetworkLimit
event SetMaxNetworkLimit(bytes32 indexed subnetwork, uint256 amount)
Emitted when a subnetwork’s maximum limit is set.
Parameters
Name | Type | Description |
---|
subnetwork indexed | bytes32 | full identifier of the subnetwork (address of the network concatenated with the uint96 identifier) |
amount | uint256 | new 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
Name | Type | Description |
---|
subnetwork indexed | bytes32 | full identifier of the subnetwork (address of the network concatenated with the uint96 identifier) |
amount | uint256 | new subnetwork’s limit (how much stake the vault curator is ready to give to the subnetwork) |
SetOperatorNetworkLimit
event SetOperatorNetworkLimit(bytes32 indexed subnetwork, address indexed operator, uint256 amount)
Emitted when an operator’s limit for a subnetwork is set.
Parameters
Name | Type | Description |
---|
subnetwork indexed | bytes32 | full identifier of the subnetwork (address of the network concatenated with the uint96 identifier) |
operator indexed | address | address of the operator |
amount | uint256 | new operator’s limit for the subnetwork (how much stake the vault curator is ready to give to the operator for the subnetwork) |
Structs
BaseParams
struct BaseParams {
address defaultAdminRoleHolder;
address hook;
address hookSetRoleHolder;
}
Base parameters needed for delegators’ deployment.
Parameters
Name | Type | Description |
---|
defaultAdminRoleHolder | address | address of the initial DEFAULT_ADMIN_ROLE holder |
hook | address | address of the hook contract |
hookSetRoleHolder | address | address of the initial HOOK_SET_ROLE holder |
InitParams
struct InitParams {
BaseParams baseParams;
address[] networkLimitSetRoleHolders;
address[] operatorNetworkLimitSetRoleHolders;
}
Initial parameters needed for a full restaking delegator deployment.
Parameters
Name | Type | Description |
---|
baseParams | BaseParams | base parameters for delegators’ deployment |
networkLimitSetRoleHolders | address[] | array of addresses of the initial NETWORK_LIMIT_SET_ROLE holders |
operatorNetworkLimitSetRoleHolders | address[] | array of addresses of the initial OPERATOR_NETWORK_LIMIT_SET_ROLE holders |
StakeBaseHints
struct StakeBaseHints {
bytes operatorVaultOptInHint;
bytes operatorNetworkOptInHint;
}
Base hints for a stake.
Parameters
Name | Type | Description |
---|
operatorVaultOptInHint | bytes | hint for the operator-vault opt-in |
operatorNetworkOptInHint | bytes | hint for the operator-network opt-in |
StakeHints
struct StakeHints {
bytes baseHints;
bytes activeStakeHint;
bytes networkLimitHint;
bytes operatorNetworkLimitHint;
}
Hints for a stake.
Parameters
Name | Type | Description |
---|
baseHints | bytes | base hints |
activeStakeHint | bytes | hint for the active stake checkpoint |
networkLimitHint | bytes | hint for the subnetwork limit checkpoint |
operatorNetworkLimitHint | bytes | hint for the operator-subnetwork limit checkpoint |