Skip to main content

VaultManager

Git Source

VaultManager

Abstract contract for managing vaults and their relationships with operators and subnetworks

Extends BaseManager and provides functionality for registering, pausing, and managing vaults

Methods

_getVaultManagerStorage

function _getVaultManagerStorage() internal pure returns (VaultManagerStorage storage $) 

Internal helper to access the VaultManager storage struct

Uses assembly to load storage location from a constant slot

Returns

NameTypeDescription
$VaultManagerStorage storage$ Storage pointer to the VaultManagerStorage struct

__VaultManager_init_private

function __VaultManager_init_private(
address vaultRegistry
) internal onlyInitializing

Initializes the VaultManager with required parameters

Parameters

NameTypeDescription
vaultRegistryaddressThe address of the vault registry contract

_VAULT_REGISTRY

function _VAULT_REGISTRY() internal view returns (address) 

Gets the address of the vault registry contract

Returns

NameTypeDescription
addressThe vault registry contract address

_subnetworksLength

function _subnetworksLength() internal view returns (uint256) 

Gets the total number of registered subnetworks

Returns

NameTypeDescription
uint256uint256 The count of registered subnetworks

_subnetworkWithTimesAt

function _subnetworkWithTimesAt(
uint256 pos
) internal view returns (uint160, uint48, uint48)

Gets the subnetwork information at a specific index

Parameters

NameTypeDescription
posuint256The index position to query

Returns

NameTypeDescription
uint160uint160 The subnetwork address
uint48uint48 The time when the subnetwork was enabled
uint48uint48 The time when the subnetwork was disabled

_activeSubnetworks

function _activeSubnetworks() internal view returns (uint160[] memory) 

Gets all currently active subnetworks

Returns

NameTypeDescription
memoryuint160[]uint160[] Array of active subnetwork addresses

_activeSubnetworksAt

function _activeSubnetworksAt(
uint48 timestamp
) internal view returns (uint160[] memory)

Gets all subnetworks that were active at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp to check

Returns

NameTypeDescription
memoryuint160[]uint160[] Array of subnetwork addresses that were active at the timestamp

_subnetworkWasActiveAt

function _subnetworkWasActiveAt(uint48 timestamp, uint96 subnetwork) internal view returns (bool) 

Checks if a subnetwork was active at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp to check
subnetworkuint96The subnetwork identifier

Returns

NameTypeDescription
boolbool True if the subnetwork was active at the timestamp

_sharedVaultsLength

function _sharedVaultsLength() internal view returns (uint256) 

Gets the total number of shared vaults

Returns

NameTypeDescription
uint256uint256 The count of shared vaults

_sharedVaultWithTimesAt

function _sharedVaultWithTimesAt(
uint256 pos
) internal view returns (address, uint48, uint48)

Gets the vault information at a specific index

Parameters

NameTypeDescription
posuint256The index position to query

Returns

NameTypeDescription
addressaddress The vault address
uint48uint48 The time when the vault was enabled
uint48uint48 The time when the vault was disabled

_activeSharedVaults

function _activeSharedVaults() internal view returns (address[] memory) 

Gets all currently active shared vaults

Returns

NameTypeDescription
memoryaddress[]address[] Array of active shared vault addresses

_activeSharedVaultsAt

function _activeSharedVaultsAt(
uint48 timestamp
) internal view returns (address[] memory)

Gets all shared vaults that were active at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp to check

Returns

NameTypeDescription
memoryaddress[]address[] Array of shared vault addresses that were active at the timestamp

_operatorVaultsLength

function _operatorVaultsLength(
address operator
) internal view returns (uint256)

Gets the number of vaults associated with an operator

Parameters

NameTypeDescription
operatoraddressThe operator address to query

Returns

NameTypeDescription
uint256uint256 The count of vaults for the operator

_operatorVaultWithTimesAt

function _operatorVaultWithTimesAt(address operator, uint256 pos) internal view returns (address, uint48, uint48) 

Gets the vault information at a specific index for an operator

Parameters

NameTypeDescription
operatoraddressThe operator address
posuint256The index position to query

Returns

NameTypeDescription
addressaddress The vault address
uint48uint48 The time when the vault was enabled
uint48uint48 The time when the vault was disabled

_activeOperatorVaults

function _activeOperatorVaults(
address operator
) internal view returns (address[] memory)

Gets all currently active vaults for a specific operator

Parameters

NameTypeDescription
operatoraddressThe operator address

Returns

NameTypeDescription
memoryaddress[]address[] Array of active vault addresses

_activeOperatorVaultsAt

function _activeOperatorVaultsAt(uint48 timestamp, address operator) internal view returns (address[] memory) 

Gets all currently active vaults for a specific operator at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp to check
operatoraddressThe operator address

Returns

NameTypeDescription
memoryaddress[]address[] Array of active vault addresses

_activeVaults

function _activeVaults() internal view returns (address[] memory) 

Gets all currently active vaults across all operators

Returns

NameTypeDescription
memoryaddress[]address[] Array of all active vault addresses

_activeVaultsAt

function _activeVaultsAt(
uint48 timestamp
) internal view returns (address[] memory)

Gets all vaults that were active at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp to check

Returns

NameTypeDescription
memoryaddress[]address[] Array of vault addresses that were active at the timestamp

_activeVaults

function _activeVaults(
address operator
) internal view returns (address[] memory)

Gets all currently active vaults for a specific operator

Parameters

NameTypeDescription
operatoraddressThe operator address

Returns

NameTypeDescription
memoryaddress[]address[] Array of active vault addresses for the operator

_activeVaultsAt

function _activeVaultsAt(uint48 timestamp, address operator) internal view returns (address[] memory) 

Gets all vaults that were active for an operator at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp to check
operatoraddressThe operator address

Returns

NameTypeDescription
memoryaddress[]address[] Array of vault addresses that were active at the timestamp

_vaultWasActiveAt

function _vaultWasActiveAt(uint48 timestamp, address operator, address vault) internal view returns (bool) 

Checks if a vault was active at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp to check
operatoraddressThe operator address
vaultaddressThe vault address

Returns

NameTypeDescription
boolbool True if the vault was active at the timestamp

_sharedVaultWasActiveAt

function _sharedVaultWasActiveAt(uint48 timestamp, address vault) internal view returns (bool) 

Checks if a shared vault was active at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp to check
vaultaddressThe vault address

Returns

NameTypeDescription
boolbool True if the shared vault was active at the timestamp

_operatorVaultWasActiveAt

function _operatorVaultWasActiveAt(
uint48 timestamp,
address operator,
address vault
) internal view returns (bool)

Checks if an operator vault was active at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp to check
operatoraddressThe operator address
vaultaddressThe vault address

Returns

NameTypeDescription
boolbool True if the operator vault was active at the timestamp

_getOperatorPower

function _getOperatorPower(address operator, address vault, uint96 subnetwork) internal view returns (uint256) 

Gets the power amount for an operator in a vault and subnetwork

Parameters

NameTypeDescription
operatoraddressThe operator address
vaultaddressThe vault address
subnetworkuint96The subnetwork identifier

Returns

NameTypeDescription
uint256uint256 The power amount

_getOperatorPowerAt

function _getOperatorPowerAt(
uint48 timestamp,
address operator,
address vault,
uint96 subnetwork
) internal view returns (uint256)

Gets the power amount for an operator in a vault and subnetwork at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp to check
operatoraddressThe operator address
vaultaddressThe vault address
subnetworkuint96The subnetwork identifier

Returns

NameTypeDescription
uint256uint256 The power amount at the timestamp

_getOperatorPower

function _getOperatorPower(
address operator
) internal view returns (uint256 power)

Gets the total power amount for an operator across all vaults and subnetworks

Parameters

NameTypeDescription
operatoraddressThe operator address

Returns

NameTypeDescription
poweruint256power The total power amount

_getOperatorPowerAt

function _getOperatorPowerAt(uint48 timestamp, address operator) internal view returns (uint256 power) 

Gets the total power amount for an operator across all vaults and subnetworks at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp to check
operatoraddressThe operator address

Returns

NameTypeDescription
poweruint256power The total power amount at the timestamp

_getOperatorPower

function _getOperatorPower(
address operator,
address[] memory vaults,
uint160[] memory subnetworks
) internal view returns (uint256 power)

Gets the total power amount for an operator across all vaults and subnetworks

Parameters

NameTypeDescription
operatoraddressThe operator address
vaultsaddress[] memoryThe list of vault addresses
subnetworksuint160[] memoryThe list of subnetwork identifiers

Returns

NameTypeDescription
poweruint256power The total power amount

_getOperatorPowerAt

function _getOperatorPowerAt(
uint48 timestamp,
address operator,
address[] memory vaults,
uint160[] memory subnetworks
) internal view returns (uint256 power)

Gets the total power amount for an operator across all vaults and subnetworks at a specific timestamp

Parameters

NameTypeDescription
timestampuint48The timestamp to check
operatoraddressThe operator address
vaultsaddress[] memoryThe list of vault addresses
subnetworksuint160[] memoryThe list of subnetwork identifiers

Returns

NameTypeDescription
poweruint256power The total power amount at the timestamp

_totalPower

function _totalPower(
address[] memory operators
) internal view returns (uint256 power)

Calculates the total power for a list of operators

Parameters

NameTypeDescription
operatorsaddress[] memoryArray of operator addresses

Returns

NameTypeDescription
poweruint256power The total power amount

_registerSubnetwork

function _registerSubnetwork(
uint96 subnetwork
) internal

Registers a new subnetwork

Parameters

NameTypeDescription
subnetworkuint96The subnetwork identifier to register

_pauseSubnetwork

function _pauseSubnetwork(
uint96 subnetwork
) internal

Pauses a subnetwork

Parameters

NameTypeDescription
subnetworkuint96The subnetwork identifier to pause

_unpauseSubnetwork

function _unpauseSubnetwork(
uint96 subnetwork
) internal

Unpauses a subnetwork

Parameters

NameTypeDescription
subnetworkuint96The subnetwork identifier to unpause

_unregisterSubnetwork

function _unregisterSubnetwork(
uint96 subnetwork
) internal

Unregisters a subnetwork

Parameters

NameTypeDescription
subnetworkuint96The subnetwork identifier to unregister

_registerSharedVault

function _registerSharedVault(
address vault
) internal

Registers a new shared vault

Parameters

NameTypeDescription
vaultaddressThe vault address to register

_registerOperatorVault

function _registerOperatorVault(address operator, address vault) internal 

Registers a new operator vault

Parameters

NameTypeDescription
operatoraddressThe operator address
vaultaddressThe vault address to register

_pauseSharedVault

function _pauseSharedVault(
address vault
) internal

Pauses a shared vault

Parameters

NameTypeDescription
vaultaddressThe vault address to pause

_unpauseSharedVault

function _unpauseSharedVault(
address vault
) internal

Unpauses a shared vault

Parameters

NameTypeDescription
vaultaddressThe vault address to unpause

_pauseOperatorVault

function _pauseOperatorVault(address operator, address vault) internal 

Pauses an operator vault

Parameters

NameTypeDescription
operatoraddressThe operator address
vaultaddressThe vault address to pause

_unpauseOperatorVault

function _unpauseOperatorVault(address operator, address vault) internal 

Unpauses an operator vault

Parameters

NameTypeDescription
operatoraddressThe operator address
vaultaddressThe vault address to unpause

_unregisterSharedVault

function _unregisterSharedVault(
address vault
) internal

Unregisters a shared vault

Parameters

NameTypeDescription
vaultaddressThe vault address to unregister

_unregisterOperatorVault

function _unregisterOperatorVault(address operator, address vault) internal 

Unregisters an operator vault

Parameters

NameTypeDescription
operatoraddressThe operator address
vaultaddressThe vault address to unregister

_slashVault

function _slashVault(
uint48 timestamp,
address vault,
bytes32 subnetwork,
address operator,
uint256 amount,
bytes memory hints
) internal returns (uint256 response)

Slashes a vault based on provided conditions

Parameters

NameTypeDescription
timestampuint48The timestamp when the slash occurs
vaultaddressThe vault address
subnetworkbytes32The subnetwork identifier
operatoraddressThe operator to slash
amountuint256The amount to slash
hintsbytes memoryAdditional data for the slasher

Returns

NameTypeDescription
responseuint256response index for veto slashing or amount for instant slashing

_executeSlash

function _executeSlash(
address vault,
uint256 slashIndex,
bytes calldata hints
) internal returns (uint256 slashedAmount)

Executes a veto-based slash for a vault

Parameters

NameTypeDescription
vaultaddressThe vault address
slashIndexuint256The index of the slash to execute
hintsbytes calldataAdditional data for the veto slasher

Returns

NameTypeDescription
slashedAmountuint256slashedAmount The amount that was slashed