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
Name | Type | Description |
---|
$ | 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
Name | Type | Description |
---|
vaultRegistry | address | The address of the vault registry contract |
_VAULT_REGISTRY
function _VAULT_REGISTRY() internal view returns (address)
Gets the address of the vault registry contract
Returns
Name | Type | Description |
---|
| address | The vault registry contract address |
_subnetworksLength
function _subnetworksLength() internal view returns (uint256)
Gets the total number of registered subnetworks
Returns
Name | Type | Description |
---|
| uint256 | uint256 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
Name | Type | Description |
---|
pos | uint256 | The index position to query |
Returns
Name | Type | Description |
---|
| uint160 | uint160 The subnetwork address |
| uint48 | uint48 The time when the subnetwork was enabled |
| uint48 | uint48 The time when the subnetwork was disabled |
_activeSubnetworks
function _activeSubnetworks() internal view returns (uint160[] memory)
Gets all currently active subnetworks
Returns
Name | Type | Description |
---|
memory | uint160[] | 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
Name | Type | Description |
---|
timestamp | uint48 | The timestamp to check |
Returns
Name | Type | Description |
---|
memory | uint160[] | 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
Name | Type | Description |
---|
timestamp | uint48 | The timestamp to check |
subnetwork | uint96 | The subnetwork identifier |
Returns
Name | Type | Description |
---|
| bool | bool True if the subnetwork was active at the timestamp |
_sharedVaultsLength
function _sharedVaultsLength() internal view returns (uint256)
Gets the total number of shared vaults
Returns
Name | Type | Description |
---|
| uint256 | uint256 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
Name | Type | Description |
---|
pos | uint256 | The index position to query |
Returns
Name | Type | Description |
---|
| address | address The vault address |
| uint48 | uint48 The time when the vault was enabled |
| uint48 | uint48 The time when the vault was disabled |
_activeSharedVaults
function _activeSharedVaults() internal view returns (address[] memory)
Gets all currently active shared vaults
Returns
Name | Type | Description |
---|
memory | address[] | 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
Name | Type | Description |
---|
timestamp | uint48 | The timestamp to check |
Returns
Name | Type | Description |
---|
memory | address[] | 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
Name | Type | Description |
---|
operator | address | The operator address to query |
Returns
Name | Type | Description |
---|
| uint256 | uint256 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
Name | Type | Description |
---|
operator | address | The operator address |
pos | uint256 | The index position to query |
Returns
Name | Type | Description |
---|
| address | address The vault address |
| uint48 | uint48 The time when the vault was enabled |
| uint48 | uint48 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
Name | Type | Description |
---|
operator | address | The operator address |
Returns
Name | Type | Description |
---|
memory | address[] | 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
Name | Type | Description |
---|
timestamp | uint48 | The timestamp to check |
operator | address | The operator address |
Returns
Name | Type | Description |
---|
memory | address[] | address[] Array of active vault addresses |
_activeVaults
function _activeVaults() internal view returns (address[] memory)
Gets all currently active vaults across all operators
Returns
Name | Type | Description |
---|
memory | address[] | 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
Name | Type | Description |
---|
timestamp | uint48 | The timestamp to check |
Returns
Name | Type | Description |
---|
memory | address[] | 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
Name | Type | Description |
---|
operator | address | The operator address |
Returns
Name | Type | Description |
---|
memory | address[] | 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
Name | Type | Description |
---|
timestamp | uint48 | The timestamp to check |
operator | address | The operator address |
Returns
Name | Type | Description |
---|
memory | address[] | 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
Name | Type | Description |
---|
timestamp | uint48 | The timestamp to check |
operator | address | The operator address |
vault | address | The vault address |
Returns
Name | Type | Description |
---|
| bool | bool 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
Name | Type | Description |
---|
timestamp | uint48 | The timestamp to check |
vault | address | The vault address |
Returns
Name | Type | Description |
---|
| bool | bool 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
Name | Type | Description |
---|
timestamp | uint48 | The timestamp to check |
operator | address | The operator address |
vault | address | The vault address |
Returns
Name | Type | Description |
---|
| bool | bool 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
Name | Type | Description |
---|
operator | address | The operator address |
vault | address | The vault address |
subnetwork | uint96 | The subnetwork identifier |
Returns
Name | Type | Description |
---|
| uint256 | uint256 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
Name | Type | Description |
---|
timestamp | uint48 | The timestamp to check |
operator | address | The operator address |
vault | address | The vault address |
subnetwork | uint96 | The subnetwork identifier |
Returns
Name | Type | Description |
---|
| uint256 | uint256 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
Name | Type | Description |
---|
operator | address | The operator address |
Returns
Name | Type | Description |
---|
power | uint256 | power 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
Name | Type | Description |
---|
timestamp | uint48 | The timestamp to check |
operator | address | The operator address |
Returns
Name | Type | Description |
---|
power | uint256 | power 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
Name | Type | Description |
---|
operator | address | The operator address |
vaults | address[] memory | The list of vault addresses |
subnetworks | uint160[] memory | The list of subnetwork identifiers |
Returns
Name | Type | Description |
---|
power | uint256 | power 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
Name | Type | Description |
---|
timestamp | uint48 | The timestamp to check |
operator | address | The operator address |
vaults | address[] memory | The list of vault addresses |
subnetworks | uint160[] memory | The list of subnetwork identifiers |
Returns
Name | Type | Description |
---|
power | uint256 | power 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
Name | Type | Description |
---|
operators | address[] memory | Array of operator addresses |
Returns
Name | Type | Description |
---|
power | uint256 | power The total power amount |
_registerSubnetwork
function _registerSubnetwork(
uint96 subnetwork
) internal
Registers a new subnetwork
Parameters
Name | Type | Description |
---|
subnetwork | uint96 | The subnetwork identifier to register |
_pauseSubnetwork
function _pauseSubnetwork(
uint96 subnetwork
) internal
Pauses a subnetwork
Parameters
Name | Type | Description |
---|
subnetwork | uint96 | The subnetwork identifier to pause |
_unpauseSubnetwork
function _unpauseSubnetwork(
uint96 subnetwork
) internal
Unpauses a subnetwork
Parameters
Name | Type | Description |
---|
subnetwork | uint96 | The subnetwork identifier to unpause |
_unregisterSubnetwork
function _unregisterSubnetwork(
uint96 subnetwork
) internal
Unregisters a subnetwork
Parameters
Name | Type | Description |
---|
subnetwork | uint96 | The subnetwork identifier to unregister |
_registerSharedVault
function _registerSharedVault(
address vault
) internal
Registers a new shared vault
Parameters
Name | Type | Description |
---|
vault | address | The vault address to register |
_registerOperatorVault
function _registerOperatorVault(address operator, address vault) internal
Registers a new operator vault
Parameters
Name | Type | Description |
---|
operator | address | The operator address |
vault | address | The vault address to register |
_pauseSharedVault
function _pauseSharedVault(
address vault
) internal
Pauses a shared vault
Parameters
Name | Type | Description |
---|
vault | address | The vault address to pause |
_unpauseSharedVault
function _unpauseSharedVault(
address vault
) internal
Unpauses a shared vault
Parameters
Name | Type | Description |
---|
vault | address | The vault address to unpause |
_pauseOperatorVault
function _pauseOperatorVault(address operator, address vault) internal
Pauses an operator vault
Parameters
Name | Type | Description |
---|
operator | address | The operator address |
vault | address | The vault address to pause |
_unpauseOperatorVault
function _unpauseOperatorVault(address operator, address vault) internal
Unpauses an operator vault
Parameters
Name | Type | Description |
---|
operator | address | The operator address |
vault | address | The vault address to unpause |
_unregisterSharedVault
function _unregisterSharedVault(
address vault
) internal
Unregisters a shared vault
Parameters
Name | Type | Description |
---|
vault | address | The vault address to unregister |
_unregisterOperatorVault
function _unregisterOperatorVault(address operator, address vault) internal
Unregisters an operator vault
Parameters
Name | Type | Description |
---|
operator | address | The operator address |
vault | address | The 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
Name | Type | Description |
---|
timestamp | uint48 | The timestamp when the slash occurs |
vault | address | The vault address |
subnetwork | bytes32 | The subnetwork identifier |
operator | address | The operator to slash |
amount | uint256 | The amount to slash |
hints | bytes memory | Additional data for the slasher |
Returns
Name | Type | Description |
---|
response | uint256 | response 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
Name | Type | Description |
---|
vault | address | The vault address |
slashIndex | uint256 | The index of the slash to execute |
hints | bytes calldata | Additional data for the veto slasher |
Returns
Name | Type | Description |
---|
slashedAmount | uint256 | slashedAmount The amount that was slashed |